Skip to content

Update ETL translators to use ProvenanceMetadata class - #1404

Merged
pkalita-lbl merged 5 commits into
mainfrom
issue-1374-translator-provenance
Mar 13, 2026
Merged

pkalita-lbl merged 5 commits into
mainfrom
issue-1374-translator-provenance

Conversation

@pkalita-lbl

@pkalita-lbl pkalita-lbl commented Mar 12, 2026 •

Copy link
Copy Markdown
Collaborator

On this branch, I update the translators for the submission and GOLD ETLs to use the new ProvenanceMetadata class.

Details

Previously these translators used the add_date and mod_date slots that were directly on Biosample and NucleotideSequencing. In nmdc-schema v11.17.0 these slots were removed and replaced with a provenance_metadata slot with range ProvenanceMetadata. The ProvenanceMetadata has add_date, mod_date, and other slots about the source of the data and the system that processed it. The updated translators fill in all the relevant slots. In addition to Biosample and NucleotideSequencing, the translators also populate the new provenance_metadata added to Study.

Here's an example of what one of these ProvenanceMetadata instances look like (serialized to YAML):

provenance_metadata:
  type: nmdc:ProvenanceMetadata
  add_date: '2023-10-17T09:00:00+00:00'
  git_url: https://github.com/microbiomedata/nmdc-runtime
  mod_date: '2023-10-17T09:00:00+00:00'
  version: 999.9.9
  source_system_of_record: NMDC_Submission_Portal
  submission_portal_identifier:
    - d32b5eb6-71e8-4c98-8a57-3e64d05718b4

This is the output of the submission translator. The output of the GOLD translator would have a different source_system_of_record and no submission_portal_identifier. The specific times and version in that example come from testing mock functions. In actual use, the current UTC datetime and nmdc-runtime version number would be used.

Since these changes rely on new nmdc-schema modeling, the dependency was updated and a migration notebook was added. I tested the migration notebook locally and observed these execution times:

dump from origin: 844ms
load into transformer: 962ms
transform collections: 33s
validate: 12s
dump from transformer: 530ms
load into origin: 1.4s

Related issue(s)

Fixes #1374
Fixes #1375

Related subsystem(s)

  • Runtime API (except the Minter)
  • Minter
  • Dagster
  • Project documentation (in the docs directory)
  • Translators (metadata ingest pipelines)
  • MongoDB migrations
  • Other

Testing

  • I tested these changes (explain below)
  • I did not test these changes

I tested these changes by

  • Updating existing translator tests and ensuring they pass with new expected values
  • Running the migration notebook locally

Documentation

  • I have not checked for relevant documentation yet (e.g. in the docs directory)
  • I have updated all relevant documentation so it will remain accurate
  • Other (explain below)

No user-facing documentation needed.

Maintainability

  • Every Python function I defined includes a docstring (test functions are exempt from this)
  • Every Python function parameter I introduced includes a type hint (e.g. study_id: str)
  • All "to do" or "fix me" Python comments I added begin with either # TODO or # FIXME
  • I used black to format all the Python files I created/modified
  • The PR title is in the imperative mood (e.g. "Do X") and not the declarative mood (e.g. "Does X" or "Did X")

sujaypatil96
sujaypatil96 previously approved these changes Mar 12, 2026

@sujaypatil96 sujaypatil96 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the GOLD translator

  • provenance_metadata slot asserted on Study, Biosample and NucleotideSequencing so check to make sure that it is being applied in each of the respective helper methods – _translate_study(), _translate_biosample(), _translate_nucleotide_sequencing()
  • Remove direct add_date and mod_date assertions from _translate_biosample()
  • source_system_of_record slot on ProvenanceMetadata object set to GOLD

Similar checks in the Submission Portal translator

  • provenance_metadata slot asserted on Study, Biosample and NucleotideSequencing so check to make sure that it is being applied in each of the respective helper methods – _translate_study(), _translate_biosample(), get_database() (has logic for creating nmdc:NucleotideSequencing objects)
  • No direct add_date and mod_date assertions in _translate_biosample() but remove from old nucleotide sequencing object creation logic
  • source_system_of_record and submission_portal_identifier slots on ProvenanceMetadata object set to NMDC_Submission_Portal and retrieved submission UUID

eecavanna
eecavanna previously approved these changes Mar 13, 2026

@eecavanna eecavanna left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not review changes in test_data/ directory (despite commenting on one, which just caught my eye while scrolling).

Thanks for taking care of this!

Co-authored-by: eecavanna <134325062+eecavanna@users.noreply.github.com>
@pkalita-lbl
pkalita-lbl dismissed stale reviews from eecavanna and sujaypatil96 via b6da20c March 13, 2026 15:21
@pkalita-lbl
pkalita-lbl merged commit 1c5f1de into main Mar 13, 2026
2 checks passed
@pkalita-lbl
pkalita-lbl deleted the issue-1374-translator-provenance branch March 13, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add provenance data to GOLD to mongo ETL Add provenance data to submission portal ETL

3 participants