<commit_before>name: data_product_management

docstring: |
  Services to register and manage the resources related to data products and their metadata.

spec: https://confluence.oceanobservatories.org/display/syseng/CIAD+SA+OV+Data+Product+Management+Service

dependencies: [resource_registry, pubsub_management, data_acquisition_management, dataset_management, ingestion_management]

methods:
  create_data_product:
    docstring: Define a realization of a uniquely identified presentation of a defined collection of information. The presentation consists of a particular subset of the collection.
    in:
      data_product: !DataProduct
      stream_definition_id: ""
      parameter_dictionary: ""
    out:
      data_product_id: ""

  update_data_product:
    in:
      data_product: !DataProduct
    out:
    throws:
      NotFound: object with specified id does not exist

  read_data_product:
    docstring: Retrieve data product information
    in:
      data_product_id: ""
    out:
      data_product: !DataProduct

  delete_data_product:
    in:
      data_product_id: ""
    out:
    throws:
      NotFound: object with specified id does not exist

  find_data_products:
    in:
      filters: !ResourceFilter
    out:
      data_product_list: []

  activate_data_product_persistence:
    docstring: Persist data product data into a data set
    in:
      data_product_id: ""
    out:
    throws:
      NotFound: object with specified id does not exist

  suspend_data_product_persistence:
    docstring: Suspend data product data persistnce into a data set, multiple options
    in:
      data_product_id: ""
    out:
    throws:
      NotFound: object with specified id does not exist

  get_data_product_provenance:
    in:
      data_product_id: ""
    out:
      provenance_information: {}
    throws:
      BadRequest: if provenance can not be retrieved
      NotFound: object with specified id does not exist

  get_data_product_provenance_report:
    in:
      data_product_id: ""
    out:
      provenance_information: ""
    throws:
      BadRequest: if provenance can not be retrieved
      NotFound: object with specified id does not exist
      
  create_data_product_version:
    docstring: |
      Define a new version of an existing set of information that represent an inprovement in the quality or
      understanding of the information. Only creates the second and higher versions of a DataProduct.
      The first version is implicit in the crate_data_product() operation.
    in:
      data_product_id: ""
      data_product_version: !DataProductVersion
    out:
      data_product_version_id: ""
    throws:
      BadRequest: if object does not have _id or _rev attribute
      NotFound: object with specified id does not exist

  update_data_product_version:
    in:
      data_product: !DataProductVersion
    out:
    throws:
      NotFound: object with specified id does not exist

  read_data_product_version:
    docstring: Retrieve data product information
    in:
      data_product_version_id: ""
    out:
      data_product: !DataProductVersion

  delete_data_product_version:
    docstring: Remove a version of an data product.
    in:
      data_product_version_id: ""
    out:
    throws:
      BadRequest: if object does not have _id or _rev attribute
      NotFound: object with specified id does not exist


  execute_data_product_lifecycle:
    in:
      data_product_id: ""
      lifecycle_event: ""
    out:

  get_last_update:
    in:
      data_product_id: ""
    out:
      last_update: {}
    throws:
      NotFound: Data product not found or cache for data product not found.

#-------

  get_earliest_data_datetime:
    docstring: |
      Returns the datetime of the earliest values in the data product
    in:
      data_product_id: ""
    out:
      first_sample_time: ""
    throws:
      BadRequest: A parameter is missing
      NotFound: An object with the specified data_product_id does not exist

  get_product_download_size_estimated:
    docstring: |
      Returns the size of the full data product if downloaded/presented in a given presentation form
    in:
      data_product_id: ""
    out:
      estimated_size: 0  #in bytes
    throws:
      BadRequest: A parameter is missing
      NotFound: An object with the specified data_product_id does not exist


  get_product_storage_size_estimated:
    docstring: |
      Returns the storage size occupied by the data content of the resource, in bytes.
    in:
      data_product_id: ""
    out:
      estimated_size: 0  #in bytes
    throws:
      BadRequest: A parameter is missing
      NotFound: An object with the specified data_product_id does not exist<commit_msg>fix signature<commit_after>name: data_product_management

docstring: |
  Services to register and manage the resources related to data products and their metadata.

spec: https://confluence.oceanobservatories.org/display/syseng/CIAD+SA+OV+Data+Product+Management+Service

dependencies: [resource_registry, pubsub_management, data_acquisition_management, dataset_management, ingestion_management]

methods:
  create_data_product:
    docstring: Define a realization of a uniquely identified presentation of a defined collection of information. The presentation consists of a particular subset of the collection.
    in:
      data_product: !DataProduct
      stream_definition_id: ""
      parameter_dictionary: ""
    out:
      data_product_id: ""

  update_data_product:
    in:
      data_product: !DataProduct
    out:
    throws:
      NotFound: object with specified id does not exist

  read_data_product:
    docstring: Retrieve data product information
    in:
      data_product_id: ""
    out:
      data_product: !DataProduct

  delete_data_product:
    in:
      data_product_id: ""
    out:
    throws:
      NotFound: object with specified id does not exist

  find_data_products:
    in:
      filters: !ResourceFilter
    out:
      data_product_list: []

  activate_data_product_persistence:
    docstring: Persist data product data into a data set
    in:
      data_product_id: ""
    out:
    throws:
      NotFound: object with specified id does not exist

  suspend_data_product_persistence:
    docstring: Suspend data product data persistnce into a data set, multiple options
    in:
      data_product_id: ""
    out:
    throws:
      NotFound: object with specified id does not exist

  get_data_product_provenance:
    in:
      data_product_id: ""
    out:
      provenance_information: {}
    throws:
      BadRequest: if provenance can not be retrieved
      NotFound: object with specified id does not exist

  get_data_product_provenance_report:
    in:
      data_product_id: ""
    out:
      provenance_information: ""
    throws:
      BadRequest: if provenance can not be retrieved
      NotFound: object with specified id does not exist
      
  create_data_product_version:
    docstring: |
      Define a new version of an existing set of information that represent an inprovement in the quality or
      understanding of the information. Only creates the second and higher versions of a DataProduct.
      The first version is implicit in the crate_data_product() operation.
    in:
      data_product_id: ""
      data_product_version: !DataProductVersion
    out:
      data_product_version_id: ""
    throws:
      BadRequest: if object does not have _id or _rev attribute
      NotFound: object with specified id does not exist

  update_data_product_version:
    in:
      data_product: !DataProductVersion
    out:
    throws:
      NotFound: object with specified id does not exist

  read_data_product_version:
    docstring: Retrieve data product information
    in:
      data_product_version_id: ""
    out:
      data_product: !DataProductVersion

  delete_data_product_version:
    docstring: Remove a version of an data product.
    in:
      data_product_version_id: ""
    out:
    throws:
      BadRequest: if object does not have _id or _rev attribute
      NotFound: object with specified id does not exist


  execute_data_product_lifecycle:
    in:
      data_product_id: ""
      lifecycle_event: ""
    out:

  get_last_update:
    in:
      data_product_id: ""
    out:
      last_update: {}
    throws:
      NotFound: Data product not found or cache for data product not found.

#-------

  get_data_product_extension:
    docstring: |
      Returns an DataProductExtension object containing additional related information
    in:
      data_product_id: ""
      ext_associations: {}  # An optional dict of names and associations to get other associations dynamically
      ext_exclude: [] # An optional list of field names to exclude from retrieving
    out:
      data_product: !DataProductExtension
    throws:
      BadRequest: A parameter is missing
      NotFound: An object with the specified data_product_id does not exist
{'fraction_non_alphanumeric': 0.05197435032062099, 'fraction_numerical': 0.0002249971875351558, 'mean_word_length': 3.074243813015582, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '10434', 'n_tokens_mistral': 2482, 'n_tokens_neox': 2406, 'n_words': 845}