Skip to content

Commit

Permalink
Merge pull request #364 from dandi/gh-362
Browse files Browse the repository at this point in the history
Adjust license metadata conversion
  • Loading branch information
yarikoptic committed Feb 5, 2021
2 parents 500d1a9 + 0427ccf commit fc56dfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions dandi/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,9 @@ def convertv1(data):
)
]
if oldkey == "license":
newvalues = []
for val in value:
newvalues.append(getattr(models.LicenseType, val.split(":")[-1]))
value = newvalues
value = [
getattr(models.LicenseType, value.replace("-", "").replace(".", ""))
]
if oldkey == "identifier":
value = f"DANDI:{value}"
if len(mapping[oldkey]) == 2:
Expand Down Expand Up @@ -475,7 +474,7 @@ def convertv1(data):
if oldkey == "sex":
vm["value"] = value
else:
if "maximum" in value:
if "maximum" in value and isinstance(value["maximum"], str):
if "days" in value["maximum"]:
value["units"] = "days"
if "Gestational" in value["maximum"]:
Expand All @@ -486,7 +485,7 @@ def convertv1(data):
value["units"] = value["maximum"][-1]
if "None" not in value["maximum"]:
value["maximum"] = float(value["maximum"].split()[0])
if "minimum" in value:
if "minimum" in value and isinstance(value["minimum"], str):
if "days" in value["minimum"]:
value["units"] = "days"
if "Gestational" in value["minimum"]:
Expand Down
2 changes: 1 addition & 1 deletion dandi/tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def test_dandimeta_migration(schema_dir):
"single-neurons",
],
"language": "English",
"license": ["dandi:CCBY40"],
"license": "CC-BY-4.0",
"name": (
"A NWB-based dataset and processing pipeline of human"
" single-neuron activity during a declarative memory task"
Expand Down

0 comments on commit fc56dfb

Please sign in to comment.