Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for detection and addition of ome/ngff "standard" into assets summary #252

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions dandischema/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,18 @@
stats["tissuesample"].append(sample)

stats["dataStandard"] = stats.get("dataStandard", [])

def maybe_add_standard(standard: str) -> None:
if standard not in stats["dataStandard"]:
stats["dataStandard"].append(standard)

if "nwb" in assetmeta["encodingFormat"]:
if models.nwb_standard not in stats["dataStandard"]:
stats["dataStandard"].append(models.nwb_standard)
maybe_add_standard(models.nwb_standard)
# TODO: RF assumption that any .json implies BIDS
if set(Path(assetmeta["path"]).suffixes).intersection((".json", ".nii")):
if models.bids_standard not in stats["dataStandard"]:
stats["dataStandard"].append(models.bids_standard)
maybe_add_standard(models.bids_standard)

Check warning on line 390 in dandischema/metadata.py

View check run for this annotation

Codecov / codecov/patch

dandischema/metadata.py#L390

Added line #L390 was not covered by tests
if Path(assetmeta["path"]).suffixes == [".ome", ".zarr"]:
maybe_add_standard(models.ome_ngff_standard)

Check warning on line 392 in dandischema/metadata.py

View check run for this annotation

Codecov / codecov/patch

dandischema/metadata.py#L392

Added line #L392 was not covered by tests


# TODO?: move/bind such helpers as .from_metadata or alike within
Expand Down
5 changes: 5 additions & 0 deletions dandischema/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,11 @@ class StandardsType(BaseType):
identifier="RRID:SCR_016124",
).model_dump(mode="json", exclude_none=True)

ome_ngff_standard = StandardsType(
name="OME-NGFF Standard",
identifier="DOI:10.25504/FAIRsharing.9af712",
).model_dump(mode="json", exclude_none=True)


class ContactPoint(DandiBaseModel):
email: Optional[EmailStr] = Field(
Expand Down
Loading