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

make most things optional #234

Merged
merged 1 commit into from
Sep 9, 2020
Merged
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
15 changes: 8 additions & 7 deletions dandi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ class AssetsSummary(DandiBaseModel):
numberOfBytes: int = Field(readonly=True, sameas="schema:contentSize")
numberOfFiles: int = Field(readonly=True) # universe
numberOfSubjects: int = Field(readonly=True) # NWB + BIDS
numberOfSamples: int = Field(None, readonly=True) # more of NWB
numberOfCells: int = Field(None, readonly=True)
numberOfSamples: Optional[int] = Field(None, readonly=True) # more of NWB
numberOfCells: Optional[int] = Field(None, readonly=True)

dataStandard: List[StandardsType] = Field(
readonly=True
Expand All @@ -332,7 +332,7 @@ class AssetsSummary(DandiBaseModel):
) # TODO: types of things, BIDS etc...
# Web UI: could be an icon with number, which if hovered on show a list?
measurementTechnique: List[MeasurementTechniqueType] = Field(readonly=True)
variableMeasured: List[PropertyValue] = Field(None, readonly=True)
variableMeasured: Optional[List[PropertyValue]] = Field(None, readonly=True)

_ldmeta = {
"rdfs:subClassOf": ["schema:CreativeWork", "prov:Entity"],
Expand Down Expand Up @@ -361,10 +361,11 @@ class BioSample(DandiBaseModel):
"""Description about the sample that was studied"""

identifier: Identifier = Field(nskey="schema")
assayType: List[AssayType] = Field(
description="OBI based identifier for the assay(s) used", nskey="dandi"
assayType: Optional[List[AssayType]] = Field(
None, description="OBI based identifier for the assay(s) used", nskey="dandi"
)
anatomy: List[Anatomy] = Field(
anatomy: Optional[List[Anatomy]] = Field(
None,
description="UBERON based identifier for the location of the sample",
nskey="dandi",
)
Expand Down Expand Up @@ -602,7 +603,7 @@ class AssetMeta(CommonModel):
None, readonly=True, nskey="schema"
)

wasDerivedFrom: List[BioSample] = Field(None, nskey="prov")
wasDerivedFrom: Optional[List[BioSample]] = Field(None, nskey="prov")

# on publish or set by server
contentUrl: Optional[List[AnyUrl]] = Field(None, readonly=True, nskey="schema")
Expand Down