Skip to content

feat: Metadata.from_metadata - #1852

Merged
dbirman merged 20 commits into
devfrom
1845-docs-page-for-metadata-inheritance
Aug 1, 2026
Merged

feat: Metadata.from_metadata#1852
dbirman merged 20 commits into
devfrom
1845-docs-page-for-metadata-inheritance

Conversation

@dbirman

@dbirman dbirman commented Jun 4, 2026

Copy link
Copy Markdown
Member

This PR adds a new function Metadata.from_metadata that simplifies the process of generating derived asset metadata. It implements four rules (see the docs page) that control how metadata is inherited.

Added some new functionality:

  • Data description names now default to the DataRegex.ANALYZED pattern when from_metadata is called with multiple Metadata objects
  • Clarified what process name we expect
  • Made the docs a bit more clear about how inheritance works

@dbirman
dbirman requested review from saskiad and tmchartrand June 15, 2026 00:47

@tmchartrand tmchartrand left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll look through in a bit more detail later, but one high-level thought:
I think we should clarify that we still want to inherit subject metadata if there are additional input assets without subject metadata (ie aggregated reference data, templates or the like) in addition to the single-subject assets (and same for sessions).

Does that make sense @saskiad @dbirman ?

@dbirman

dbirman commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

I'll look through in a bit more detail later, but one high-level thought: I think we should clarify that we still want to inherit subject metadata if there are additional input assets without subject metadata (ie aggregated reference data, templates or the like) in addition to the single-subject assets (and same for sessions).

Does that make sense @saskiad @dbirman ?

For example, if someone uses the CCF to do registration that doesn't mean their derived asset is "multi-subject"? I agree we can add that clarification.

@tmchartrand

Copy link
Copy Markdown
Member

Cool I'm pretty sure the code handles this correctly as-is, but we should update docstrings and docs pages and maybe have explicit tests.

@dbirman
dbirman requested a review from tmchartrand July 9, 2026 20:55

@tmchartrand tmchartrand left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks mostly good but I think we at least need to resolve some open questions about the inheritance of names and other fields of data_description.

Comment thread src/aind_data_schema/core/metadata.py Outdated
Comment thread src/aind_data_schema/core/metadata.py Outdated
Comment thread src/aind_data_schema/core/metadata.py Outdated

@saskiad saskiad 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.

I'm confused on the process_name when there is no processing.

@dbirman

dbirman commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

Note to self: we need to handle multi-subject/session asset naming in this PR (might require a change to aind-data-schema-models for the name regex

@dbirman

dbirman commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

Also another note from Josh: we need to clarify that you call write_standard_files() here and then the indexer handles populating the name/location field in the metadata parent.

@dbirman
dbirman requested review from saskiad and tmchartrand July 22, 2026 00:17
Comment thread docs/source/inheritance.md Outdated
@dbirman
dbirman requested a review from saskiad July 22, 2026 19:45
@dbirman
dbirman merged commit 08a6ec7 into dev Aug 1, 2026
6 checks passed
@dbirman
dbirman deleted the 1845-docs-page-for-metadata-inheritance branch August 1, 2026 02:45
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.

Docs page for metadata inheritance

3 participants