Add derived dataset provenance to the ro-crate - #3
Conversation
| # Notes- | ||
| # - count_versions() is essentially untested, for lack of an example | ||
| # - croissant cite_as uses the DOI, and that only gets set for primary datasets. Do we | ||
| # want to reference the primary dataset's DOI as the derived dataset's cite_as? |
There was a problem hiding this comment.
no. processed datasets get their own DOIs at publication time.
There was a problem hiding this comment.
I haven't found those DOIs in the entity-api data?
There was a problem hiding this comment.
Apologies, I'm wrong here, yes -we'd want to link back to the primary datasets for their DOIs. Asking around to see the reasoning for this
There was a problem hiding this comment.
On the croissant side, the place this is going is in the "citeAs" reference. If someone hits the DOI URL for the parent dataset, with the current structure of the Portal the relevant info for the derive dataset will also appear. This seems semantically iffy but not actually incorrect. If I naively substitute the DOI of the parent on the rocrate side, it will be tagged as the base identifier and as "sameAs" the derived dataset. That seems incorrect to me. So I propose to swap it in on the Croissant side, where it will avoid a warning, but to leave things as they are on the rocrate side.
| return hubmap_org | ||
|
|
||
|
|
||
| def build_primary_prov(ds_entity: WrappedEntity, crate: ROCrate) -> ContextEntity: |
There was a problem hiding this comment.
perhaps there is something we can pull out of the protocols.io information? Not sure that there is much else that we can throw in here otherwise.
There was a problem hiding this comment.
Yes, it can be built from protocols.io and the ancestors data. It's not ideal, because one has to treat things like running a sample through a microtome as a software operation because of the limitations of current workflow standards, but we could indeed built it. It just took me so long to get the derived dataset provenance to pass validation that I ran out of time!
There was a problem hiding this comment.
Maybe there's value to this down the line, but definitely not necessary for MVP. Seems more of a research-y topic.
|
|
||
| def build_derived_prov(ds_entity: WrappedEntity, crate: ROCrate) -> ContextEntity: | ||
| prov_chain = ds_entity.walk_ancestors(lambda d: d["entity_type"] == "Dataset") | ||
| assert len(prov_chain) == 1 |
There was a problem hiding this comment.
this might break for snare-seq data since it has multiple parent datasets
There was a problem hiding this comment.
I tried to be careful to keep things correct for multi-parent data, but I have not yet tested it against a published dataset of that type.
There was a problem hiding this comment.
Update: the croissant side does break for snare-seq data.
|
Still pending:
|
This version of build_crate_from_dataset.py produces a fairly complete rocrate and croissant pair for derived datasets. For primary datasets, the croissant.json is fairly complete but the provenance in the rocrate is very incomplete. Also, for primary datasets with thousands of files, both json files will be unwieldy.
Call the routine as:
This will produce a file
HMxxx.xxxx.xxx_crate.zipin the given output directory. Supported options include:To validate the result, cd to that directory and do:
The first command validates the ro-crate json; the second validates the croissant.
Some limitations of this version: