Skip to content

Commit

Permalink
tst: some updates based on model
Browse files Browse the repository at this point in the history
  • Loading branch information
satra committed Dec 1, 2020
1 parent bbee349 commit 7be857f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
8 changes: 8 additions & 0 deletions dandi/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ def extract_sex(metadata):
return ...


def extract_species(metadata):
if metadata.get("species") is not None:
return models.SpeciesType(identifier="species", name=metadata["species"])
else:
return ...


def extract_assay_type(metadata):
if "assayType" in metadata:
return [models.AssayType(identifier="assayType", name=metadata["assayType"])]
Expand Down Expand Up @@ -207,6 +214,7 @@ def extract_digest(metadata):
"assayType": extract_assay_type,
"anatomy": extract_anatomy,
"digest": extract_digest,
"species": extract_species,
}


Expand Down
13 changes: 7 additions & 6 deletions dandi/tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
DigestType,
PropertyValue,
SexType,
SpeciesType,
)


Expand Down Expand Up @@ -118,7 +119,6 @@ def test_metadata2asset():
value="783ad2afe455839e5ab2fa659861f58a423fd17f", cryptoType=DigestType.sha1
),
path=None,
isPartOf=None,
dataType=None,
sameAs=None,
modality=None,
Expand All @@ -134,8 +134,9 @@ def test_metadata2asset():
vendor=None,
age=PropertyValue(value="P170DT12212S", unitText="Years from birth"),
sex=SexType(identifier="sex", name="M"),
taxonomy=None,
disease=None,
species=SpeciesType(identifier="species", name="Examen exemplar"),
disorder=None,
genotype="Typical",
)
],
contentUrl=None,
Expand Down Expand Up @@ -194,7 +195,6 @@ def test_metadata2asset_simple1():
value="783ad2afe455839e5ab2fa659861f58a423fd17f", cryptoType=DigestType.sha1
),
path=None,
isPartOf=None,
dataType=None,
sameAs=None,
modality=None,
Expand All @@ -210,8 +210,9 @@ def test_metadata2asset_simple1():
vendor=None,
age=None,
sex=None,
taxonomy=None,
disease=None,
species=None,
disorder=None,
genotype=None,
)
],
contentUrl=None,
Expand Down

0 comments on commit 7be857f

Please sign in to comment.