From f6978f72fe753ebf65a5d927a4baca4bbc666560 Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Thu, 10 Dec 2020 14:45:40 -0500 Subject: [PATCH 1/6] cleaning up biosample and participant --- dandi/models.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/dandi/models.py b/dandi/models.py index af9bed3d5..7a0e71cbc 100644 --- a/dandi/models.py +++ b/dandi/models.py @@ -396,9 +396,29 @@ class BioSample(DandiBaseModel): ) anatomy: Optional[List[Anatomy]] = Field( None, - description="UBERON based identifier for the location of the sample", + description="UBERON based identifier for what organ the sample belongs " + "to. Use the most specific descriptor.", nskey="dandi", ) + + wasDerivedFrom: Optional[List["BioSample"]] = Field(None, nskey="prov") + + _ldmeta = { + "rdfs:subClassOf": ["schema:Thing", "prov:Entity"], + "rdfs:label": "Information about the biosample.", + "nskey": "dandi", + } + + +BioSample.update_forward_refs() + + +class Participant(DandiBaseModel): + """Description about the sample that was studied""" + + identifier: Identifier = Field(nskey="schema") + source_id: Optional[Identifier] = Field(None, nskey="dandi") + strain: Optional[StrainType] = Field( None, description="Identifier for the strain of the sample", nskey="dandi" ) @@ -435,7 +455,7 @@ class BioSample(DandiBaseModel): _ldmeta = { "rdfs:subClassOf": ["schema:Thing", "prov:Entity"], - "rdfs:label": "Information about the biosample.", + "rdfs:label": "Information about the participant.", "nskey": "dandi", } @@ -632,6 +652,9 @@ class AssetMeta(CommonModel): ) wasDerivedFrom: Optional[List[BioSample]] = Field(None, nskey="prov") + wasAttributedTo: List[Participant] = Field( + None, description="Participant(s) to which this file belongs to", nskey="prov" + ) # on publish or set by server contentUrl: Optional[List[AnyUrl]] = Field(None, readOnly=True, nskey="schema") From fa92dde82b7e1c5bb4e86709794c16a5fb567ef7 Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Thu, 10 Dec 2020 20:28:15 -0500 Subject: [PATCH 2/6] fix: tests --- dandi/metadata.py | 15 +++++++++- dandi/tests/test_metadata.py | 56 +++++++++++++++++++++++++++++------- 2 files changed, 59 insertions(+), 12 deletions(-) diff --git a/dandi/metadata.py b/dandi/metadata.py index 8d0ce7762..9aa097120 100644 --- a/dandi/metadata.py +++ b/dandi/metadata.py @@ -228,6 +228,8 @@ def extract_anatomy(metadata): def extract_model(modelcls, metadata, **kwargs): m = modelcls.unvalidated() for field in m.__fields__.keys(): + if modelcls == models.BioSample and field == "wasDerivedFrom": + continue value = kwargs.get(field, extract_field(field, metadata)) if value is not Ellipsis: setattr(m, field, value) @@ -237,7 +239,17 @@ def extract_model(modelcls, metadata, **kwargs): def extract_wasDerivedFrom(metadata): return [ - extract_model(models.BioSample, metadata, identifier=metadata.get("subject_id")) + extract_model( + models.BioSample, metadata, identifier=metadata.get("tissue_sample_id") + ) + ] + + +def extract_wasAttributedTo(metadata): + return [ + extract_model( + models.Participant, metadata, identifier=metadata.get("subject_id") + ) ] @@ -253,6 +265,7 @@ def extract_digest(metadata): FIELD_EXTRACTORS = { "wasDerivedFrom": extract_wasDerivedFrom, + "wasAttributedTo": extract_wasAttributedTo, "age": extract_age, "sex": extract_sex, "assayType": extract_assay_type, diff --git a/dandi/tests/test_metadata.py b/dandi/tests/test_metadata.py index c59983acd..64fa342ef 100644 --- a/dandi/tests/test_metadata.py +++ b/dandi/tests/test_metadata.py @@ -14,6 +14,8 @@ SpeciesType, AnyUrl, DandiMeta, + Participant, + BioSample, ) @@ -105,12 +107,20 @@ def test_metadata2asset(): contributor=None, about=None, studyTarget=None, + license=None, protocol=None, ethicsApproval=None, - license=None, keywords=["test", "sample", "example", "test-case"], acknowledgement=None, - access=[AccessRequirements(status=AccessType.Open)], + access=[ + AccessRequirements( + status=AccessType.Open, + email=None, + contactPoint=None, + description=None, + embargoedUntil=None, + ) + ], url=None, repository="https://dandiarchive.org/", relatedResource=None, @@ -128,13 +138,25 @@ def test_metadata2asset(): variableMeasured=None, wasDerivedFrom=[ BioSample( + identifier="tissue03", assayType=None, anatomy=None, wasDerivedFrom=None + ) + ], + wasAttributedTo=[ + Participant( identifier="a1b2c3", - assayType=None, - anatomy=None, + source_id=None, strain=None, cellLine=None, vendor=None, - age=PropertyValue(value="P170DT12212S", unitText="Years from birth"), + age=PropertyValue( + maxValue=None, + minValue=None, + unitCode=None, + unitText="Years from birth", + value="P170DT12212S", + valueReference=None, + propertyID=None, + ), sex=SexType( identifier=AnyUrl( "http://purl.obolibrary.org/obo/PATO_0000384", @@ -146,6 +168,7 @@ def test_metadata2asset(): ), name="Male", ), + genotype="Typical", species=SpeciesType( identifier=AnyUrl( "http://purl.obolibrary.org/obo/NCBITaxon_9606", @@ -158,7 +181,6 @@ def test_metadata2asset(): name="Human", ), disorder=None, - genotype="Typical", ) ], contentUrl=None, @@ -201,12 +223,20 @@ def test_metadata2asset_simple1(): contributor=None, about=None, studyTarget=None, + license=None, protocol=None, ethicsApproval=None, - license=None, keywords=["keyword1", "keyword 2"], acknowledgement=None, - access=[AccessRequirements(status=AccessType.Open)], + access=[ + AccessRequirements( + status=AccessType.Open, + email=None, + contactPoint=None, + description=None, + embargoedUntil=None, + ) + ], url=None, repository="https://dandiarchive.org/", relatedResource=None, @@ -224,17 +254,21 @@ def test_metadata2asset_simple1(): variableMeasured=None, wasDerivedFrom=[ BioSample.unvalidated( + identifier=None, assayType=None, anatomy=None, wasDerivedFrom=None + ) + ], + wasAttributedTo=[ + Participant.unvalidated( identifier=None, - assayType=None, - anatomy=None, + source_id=None, strain=None, cellLine=None, vendor=None, age=None, sex=None, + genotype=None, species=None, disorder=None, - genotype=None, ) ], contentUrl=None, From 6115f7ec5b5b150398d7cdedba14ee44ea523ac4 Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Thu, 10 Dec 2020 20:30:42 -0500 Subject: [PATCH 3/6] remove redundant import --- dandi/tests/test_metadata.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dandi/tests/test_metadata.py b/dandi/tests/test_metadata.py index 64fa342ef..e34624ff5 100644 --- a/dandi/tests/test_metadata.py +++ b/dandi/tests/test_metadata.py @@ -15,7 +15,6 @@ AnyUrl, DandiMeta, Participant, - BioSample, ) From 71e21a00104d5bcaa68b54a858d3d2762cfe148a Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Thu, 10 Dec 2020 20:45:15 -0500 Subject: [PATCH 4/6] fix: validation test --- dandi/tests/test_validate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dandi/tests/test_validate.py b/dandi/tests/test_validate.py index f18209a37..1236b622a 100644 --- a/dandi/tests/test_validate.py +++ b/dandi/tests/test_validate.py @@ -7,8 +7,10 @@ def test_validate_simple1(monkeypatch, simple1_nwb): errors = validate_file(simple1_nwb) assert len(errors) == 1 assert errors[0] == ( - "1 validation error for AssetMeta\n" + "2 validation errors for AssetMeta\n" "wasDerivedFrom -> 0 -> identifier\n" + " none is not an allowed value (type=type_error.none.not_allowed)\n" + "wasAttributedTo -> 0 -> identifier\n" " none is not an allowed value (type=type_error.none.not_allowed)" ) From 9befe54588701427dc0158746cdb0fd25a029d64 Mon Sep 17 00:00:00 2001 From: Satrajit Ghosh Date: Fri, 11 Dec 2020 16:34:35 -0500 Subject: [PATCH 5/6] fix: dandiset metadata --- dandi/metadata.py | 29 +- dandi/models.py | 25 +- dandi/tests/test_metadata.py | 756 ++++++++++++++++++++++++----------- 3 files changed, 572 insertions(+), 238 deletions(-) diff --git a/dandi/metadata.py b/dandi/metadata.py index 9aa097120..deead8079 100644 --- a/dandi/metadata.py +++ b/dandi/metadata.py @@ -361,7 +361,7 @@ def toContributor(value): roles.append("".join([val.capitalize() for val in tmp])) else: roles.append(tmp.pop()) - contrib["roleName"] = roles + contrib["roleName"] = [getattr(models.RoleType, role) for role in roles] del item["roles"] if "awardNumber" in item: contrib["awardNumber"] = item["awardNumber"] @@ -375,9 +375,17 @@ def toContributor(value): contrib["identifier"] = models.PropertyValue() del item["orcid"] if "affiliations" in item: - item["affiliation"] = item["affiliations"] + item["affiliation"] = [ + models.Organization.unvalidated(**{"name": affiliate}) + for affiliate in item["affiliations"] + ] + del item["affiliations"] contrib.update(**{f"{k}": v for k, v in item.items()}) + if "awardNumber" in contrib: + contrib = models.Organization.unvalidated(**contrib) + else: + contrib = models.Person.unvalidated(**contrib) out.append(contrib) return out @@ -417,14 +425,18 @@ def convertv1(data): out = [] for item in value: if isinstance(item, dict): - out.append({k: v for k, v in item.items()}) + out.append( + models.Resource.unvalidated( + **{k: v for k, v in item.items()} + ) + ) else: present = False for val in out: if item in val.values(): present = True if not present: - out.append({"url": item}) + out.append(models.Resource.unvalidated(**{"url": item})) value = out if oldkey in [ "number_of_subjects", @@ -436,7 +448,14 @@ def convertv1(data): if isinstance(value, list): for val in value: if extrakey: - val[extrakey] = extra + if extrakey == "relation": + val.relation = getattr(models.RelationType, extra) + elif extrakey == "roleName": + val.roleName = [ + getattr(models.RoleType, role) for role in extra + ] + else: + val[extrakey] = extra if isinstance(value, dict): if extrakey: value[extrakey] = extra diff --git a/dandi/models.py b/dandi/models.py index 7a0e71cbc..c08bc3926 100644 --- a/dandi/models.py +++ b/dandi/models.py @@ -226,17 +226,17 @@ class ContactPoint(DandiBaseModel): class Contributor(DandiBaseModel): - identifier: Identifier = Field( + identifier: Optional[Identifier] = Field( None, title="A Common Identifier", description="Use a common identifier such as ORCID for people or ROR for institutions", nskey="schema", ) - name: str = Field(None, nskey="schema") - email: EmailStr = Field(None, nskey="schema") - url: AnyUrl = Field(None, nskey="schema") - roleName: List[RoleType] = Field( - title="Role", description="Role of the contributor", nskey="schema" + name: Optional[str] = Field(None, nskey="schema") + email: Optional[EmailStr] = Field(None, nskey="schema") + url: Optional[AnyUrl] = Field(None, nskey="schema") + roleName: Optional[List[RoleType]] = Field( + None, title="Role", description="Role of the contributor", nskey="schema" ) includeInCitation: bool = Field( True, @@ -245,7 +245,7 @@ class Contributor(DandiBaseModel): "when generating a citation for the item", nskey="dandi", ) - awardNumber: Identifier = Field( + awardNumber: Optional[Identifier] = Field( None, title="Identifier for an award", description="Identifier associated with a sponsored or gidt award", @@ -254,8 +254,15 @@ class Contributor(DandiBaseModel): class Organization(Contributor): - contactPoint: List[ContactPoint] = Field( - description="Contact for the organization", nskey="schema" + includeInCitation: bool = Field( + False, + title="Include Contributor in Citation", + description="A flag to indicate whether a contributor should be included " + "when generating a citation for the item", + nskey="dandi", + ) + contactPoint: Optional[List[ContactPoint]] = Field( + None, description="Contact for the organization", nskey="schema" ) _ldmeta = { "rdfs:subClassOf": ["schema:Organization", "prov:Organization"], diff --git a/dandi/tests/test_metadata.py b/dandi/tests/test_metadata.py index e34624ff5..5c0d81554 100644 --- a/dandi/tests/test_metadata.py +++ b/dandi/tests/test_metadata.py @@ -15,6 +15,11 @@ AnyUrl, DandiMeta, Participant, + Resource, + RoleType, + RelationType, + Person, + Organization, ) @@ -574,255 +579,561 @@ def test_dandimeta_migration(): ) == DandiMeta.unvalidated( access=[ AccessRequirements( - status=AccessType.Open, email="nand.chandravadia@cshs.org" + status=AccessType.Open, + email="nand.chandravadia@cshs.org", + contactPoint=None, + description=None, + embargoedUntil=None, ) ], relatedResource=[ - { - "identifier": "DOI:10.17605/OSF.IO/HV7JA", - "name": ( - "A NWB-based Dataset and Processing Pipeline of Human" - " Single-Neuron Activity During a Declarative Memory Task" - ), - "repository": "Open Science Framework", - "url": "https://osf.io/hv7ja/", - "relation": "IsDerivedFrom", - }, - { - "identifier": "DOI:10.1038/s41597-020-0415-9", - "relation": "IsDescribedBy", - "url": "https://www.nature.com/articles/s41597-020-0415-9", - }, + Resource( + identifier="DOI:10.17605/OSF.IO/HV7JA", + name="A NWB-based Dataset and Processing Pipeline of Human Single-Neuron Activity During a Declarative Memory Task", + repository="Open Science Framework", + url="https://osf.io/hv7ja/", + relation=RelationType.IsDerivedFrom, + ), + Resource( + identifier="DOI:10.1038/s41597-020-0415-9", + relation=RelationType.IsDescribedBy, + url="https://www.nature.com/articles/s41597-020-0415-9", + name=None, + repository=None, + ), ], about=[{"identifier": "MTL", "name": "Medial Temporal Lobe"}], contributor=[ - { - "roleName": [ - "Author", - "ContactPerson", - "DataCurator", - "DataManager", - "FormalAnalysis", - "Investigation", - "Maintainer", - "Methodology", - "ProjectLeader", - "ProjectManager", - "ProjectMember", - "Researcher", - "Software", - "Validation", - "Visualization", + Person( + roleName=[ + RoleType.Author, + RoleType.ContactPerson, + RoleType.DataCurator, + RoleType.DataManager, + RoleType.FormalAnalysis, + RoleType.Investigation, + RoleType.Maintainer, + RoleType.Methodology, + RoleType.ProjectLeader, + RoleType.ProjectManager, + RoleType.ProjectMember, + RoleType.Researcher, + RoleType.Software, + RoleType.Validation, + RoleType.Visualization, ], - "identifier": PropertyValue( - value="0000-0003-0161-4007", propertyID="ORCID" + identifier=PropertyValue( + maxValue=None, + minValue=None, + unitCode=None, + unitText=None, + value="0000-0003-0161-4007", + valueReference=None, + propertyID="ORCID", ), - "email": "nand.chandravadia@cshs.org", - "name": "Chandravadia, Nand", - "affiliation": [ - "Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA" + email="nand.chandravadia@cshs.org", + name="Chandravadia, Nand", + affiliation=[ + Organization( + name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ) ], - }, - { - "roleName": [ - "Author", - "Methodology", - "ProjectMember", - "Software", - "Validation", + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[ + RoleType.Author, + RoleType.Methodology, + RoleType.ProjectMember, + RoleType.Software, + RoleType.Validation, ], - "identifier": PropertyValue(), - "email": "liang134@mail.chapman.edu", - "name": "Liang, Dehua", - "affiliation": [ - "Institute for Interdisciplinary Brain and Behavioral" - " Sciences, Crean College of Health and Behavioral" - " Sciences, Schmid College of Science and Technology," - " Chapman University, Orange, CA, USA" + identifier=PropertyValue( + maxValue=None, + minValue=None, + unitCode=None, + unitText=None, + value=None, + valueReference=None, + propertyID=None, + ), + email="liang134@mail.chapman.edu", + name="Liang, Dehua", + affiliation=[ + Organization( + name="Institute for Interdisciplinary Brain and Behavioral Sciences, Crean College of Health and Behavioral Sciences, Schmid College of Science and Technology, Chapman University, Orange, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ) + ], + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[ + RoleType.Author, + RoleType.DataCollector, + RoleType.ProjectMember, + RoleType.Validation, ], - }, - { - "roleName": ["Author", "DataCollector", "ProjectMember", "Validation"], - "identifier": PropertyValue( - value="0000-0002-4319-7689", propertyID="ORCID" + identifier=PropertyValue( + maxValue=None, + minValue=None, + unitCode=None, + unitText=None, + value="0000-0002-4319-7689", + valueReference=None, + propertyID="ORCID", ), - "email": "Andrea.Schjetan@uhnresearch.ca", - "name": "Schjetnan, Andrea Gomez Palacio", - "affiliation": [ - "Krembil Brain Institute, Toronto Western Hospital, Toronto, Canada" + email="Andrea.Schjetan@uhnresearch.ca", + name="Schjetnan, Andrea Gomez Palacio", + affiliation=[ + Organization( + name="Krembil Brain Institute, Toronto Western Hospital, Toronto, Canada", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ) + ], + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[ + RoleType.Author, + RoleType.DataCurator, + RoleType.ProjectMember, + RoleType.Validation, ], - }, - { - "roleName": ["Author", "DataCurator", "ProjectMember", "Validation"], - "identifier": PropertyValue( - value="0000-0002-9207-7069", propertyID="ORCID" + identifier=PropertyValue( + maxValue=None, + minValue=None, + unitCode=None, + unitText=None, + value="0000-0002-9207-7069", + valueReference=None, + propertyID="ORCID", ), - "email": "april.carlson@tufts.edu", - "name": "Carlson, April", - "affiliation": [ - "Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA" + email="april.carlson@tufts.edu", + name="Carlson, April", + affiliation=[ + Organization( + name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ) + ], + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[ + RoleType.Author, + RoleType.DataCollector, + RoleType.ProjectMember, + RoleType.Validation, + ], + email="mailyscm.faraut@gmail.com", + name="Faraut, Mailys", + affiliation=[ + Organization( + name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ) ], - }, - { - "roleName": ["Author", "DataCollector", "ProjectMember", "Validation"], - "email": "mailyscm.faraut@gmail.com", - "name": "Faraut, Mailys", - "affiliation": [ - "Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA" + identifier=None, + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[RoleType.Author, RoleType.ProjectMember, RoleType.Validation], + email="Jeffrey.Chung@cshs.org", + name="Chung, Jeffrey M.", + affiliation=[ + Organization( + name="Department of Neurology, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ) ], - }, - { - "roleName": ["Author", "ProjectMember", "Validation"], - "email": "Jeffrey.Chung@cshs.org", - "name": "Chung, Jeffrey M.", - "affiliation": [ - "Department of Neurology, Cedars-Sinai Medical Center, Los Angeles, CA, USA" + identifier=None, + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[RoleType.Author, RoleType.ProjectMember, RoleType.Validation], + email="Chrystal.Reed@csmc.edu", + name="Reed, Chrystal M.", + affiliation=[ + Organization( + name="Department of Neurology, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ) ], - }, - { - "roleName": ["Author", "ProjectMember", "Validation"], - "email": "Chrystal.Reed@csmc.edu", - "name": "Reed, Chrystal M.", - "affiliation": [ - "Department of Neurology, Cedars-Sinai Medical Center, Los Angeles, CA, USA" + identifier=None, + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[ + RoleType.Author, + RoleType.Software, + RoleType.ProjectMember, + RoleType.Validation, ], - }, - { - "roleName": ["Author", "Software", "ProjectMember", "Validation"], - "email": "ben.dichter@gmail.com", - "name": "Dichter, Ben", - "affiliation": [ - "Biological Systems & Engineering Division, Lawrence" - " Berkeley National Laboratory, Berkeley, CA, USA", - "Department of Neurosurgery, Stanford University, Stanford, CA, USA", + email="ben.dichter@gmail.com", + name="Dichter, Ben", + affiliation=[ + Organization( + name="Biological Systems & Engineering Division, Lawrence Berkeley National Laboratory, Berkeley, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), + Organization( + name="Department of Neurosurgery, Stanford University, Stanford, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), ], - }, - { - "roleName": [ - "Author", - "Conceptualization", - "ProjectMember", - "Validation", + identifier=None, + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[ + RoleType.Author, + RoleType.Conceptualization, + RoleType.ProjectMember, + RoleType.Validation, ], - "email": "maoz.uri@gmail.com", - "name": "Maoz, Uri", - "affiliation": [ - "Institute for Interdisciplinary Brain and Behavioral" - " Sciences, Crean College of Health and Behavioral" - " Sciences, Schmid College of Science and Technology," - " Chapman University, Orange, CA, USA", - "Division of Biology and Biological Engineering, California" - " Institute of Technology, Pasadena, CA, USA", + email="maoz.uri@gmail.com", + name="Maoz, Uri", + affiliation=[ + Organization( + name="Institute for Interdisciplinary Brain and Behavioral Sciences, Crean College of Health and Behavioral Sciences, Schmid College of Science and Technology, Chapman University, Orange, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), + Organization( + name="Division of Biology and Biological Engineering, California Institute of Technology, Pasadena, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), ], - }, - { - "roleName": ["Author", "ProjectMember", "Validation"], - "email": "suneil.kalia@uhn.ca", - "name": "Kalia, Suneil K.", - "affiliation": [ - "Division of Neurosurgery, Department of Surgery," - " University of Toronto, Toronto, Canada", - "Krembil Brain Institute, Toronto Western Hospital, Toronto, Canada", + identifier=None, + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[RoleType.Author, RoleType.ProjectMember, RoleType.Validation], + email="suneil.kalia@uhn.ca", + name="Kalia, Suneil K.", + affiliation=[ + Organization( + name="Division of Neurosurgery, Department of Surgery, University of Toronto, Toronto, Canada", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), + Organization( + name="Krembil Brain Institute, Toronto Western Hospital, Toronto, Canada", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), ], - }, - { - "roleName": ["Author", "ProjectMember", "Validation"], - "email": "Taufik.Valiante@uhn.ca", - "name": "Valiante, Taufik A.", - "affiliation": [ - "Krembil Brain Institute, Toronto Western Hospital, Toronto, Canada", - "Division of Neurosurgery, Department of Surgery," - " University of Toronto, Toronto, Canada", + identifier=None, + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[RoleType.Author, RoleType.ProjectMember, RoleType.Validation], + email="Taufik.Valiante@uhn.ca", + name="Valiante, Taufik A.", + affiliation=[ + Organization( + name="Krembil Brain Institute, Toronto Western Hospital, Toronto, Canada", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), + Organization( + name="Division of Neurosurgery, Department of Surgery, University of Toronto, Toronto, Canada", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), ], - }, - { - "roleName": ["Author", "ProjectMember", "Validation"], - "email": "Adam.Mamelak@cshs.org", - "name": "Mamelak, Adam N.", - "affiliation": [ - "Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA" + identifier=None, + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[RoleType.Author, RoleType.ProjectMember, RoleType.Validation], + email="Adam.Mamelak@cshs.org", + name="Mamelak, Adam N.", + affiliation=[ + Organization( + name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ) ], - }, - { - "roleName": [ - "Author", - "Conceptualization", - "FundingAcquisition", - "ProjectMember", - "Resources", - "Software", - "Supervision", - "Validation", + identifier=None, + url=None, + includeInCitation=True, + awardNumber=None, + ), + Person( + roleName=[ + RoleType.Author, + RoleType.Conceptualization, + RoleType.FundingAcquisition, + RoleType.ProjectMember, + RoleType.Resources, + RoleType.Software, + RoleType.Supervision, + RoleType.Validation, ], - "identifier": PropertyValue( - value="0000-0002-9207-7069", propertyID="ORCID" + identifier=PropertyValue( + maxValue=None, + minValue=None, + unitCode=None, + unitText=None, + value="0000-0002-9207-7069", + valueReference=None, + propertyID="ORCID", ), - "email": "Ueli.Rutishauser@cshs.org", - "name": "Rutishauser, Ueli", - "affiliation": [ - "Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", - "Department of Neurology, Cedars-Sinai Medical Center, Los Angeles, CA, USA", - "Division of Biology and Biological Engineering, California" - " Institute of Technology, Pasadena, CA, USA", - "Computational and Neural Systems Program, California" - " Institute of Technology, Pasadena, CA, USA", - "Center for Neural Science and Medicine, Department of" - " Biomedical Science, Cedars-Sinai Medical Center," - " Los Angeles, CA, USA", + email="Ueli.Rutishauser@cshs.org", + name="Rutishauser, Ueli", + affiliation=[ + Organization( + name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), + Organization( + name="Department of Neurology, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), + Organization( + name="Division of Biology and Biological Engineering, California Institute of Technology, Pasadena, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), + Organization( + name="Computational and Neural Systems Program, California Institute of Technology, Pasadena, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), + Organization( + name="Center for Neural Science and Medicine, Department of Biomedical Science, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + identifier=None, + email=None, + url=None, + roleName=None, + includeInCitation=False, + awardNumber=None, + contactPoint=None, + ), ], - }, - { - "awardNumber": "U01NS103792", - "name": "Stroke, National Institute of Neurological Disorders and", - "roleName": ["Sponsor"], - }, - { - "awardNumber": "1554105", - "name": "Foundation, National Science", - "roleName": ["Sponsor"], - }, - { - "awardNumber": "R01MH110831", - "name": "Health, National Institute of Mental", - "roleName": ["Sponsor"], - }, - {"name": "Neuroscience, McKnight Endowment for", "roleName": ["Sponsor"]}, - { - "name": ( - "Foundation, NARSAD Young Investigator grant from the" - " Brain & Behavior Research" - ), - "roleName": ["Sponsor"], - }, - {"name": "Foundation, Kavli", "roleName": ["Sponsor"]}, - { - "awardNumber": "U19NS104590", - "name": "initiative, BRAIN", - "roleName": ["Sponsor"], - }, + url=None, + includeInCitation=True, + awardNumber=None, + ), + Organization( + awardNumber="U01NS103792", + name="Stroke, National Institute of Neurological Disorders and", + identifier=None, + email=None, + url=None, + roleName=[RoleType.Sponsor], + includeInCitation=False, + contactPoint=None, + ), + Organization( + awardNumber="1554105", + name="Foundation, National Science", + identifier=None, + email=None, + url=None, + roleName=[RoleType.Sponsor], + includeInCitation=False, + contactPoint=None, + ), + Organization( + awardNumber="R01MH110831", + name="Health, National Institute of Mental", + identifier=None, + email=None, + url=None, + roleName=[RoleType.Sponsor], + includeInCitation=False, + contactPoint=None, + ), + Person( + name="Neuroscience, McKnight Endowment for", + identifier=None, + email=None, + url=None, + roleName=[RoleType.Sponsor], + includeInCitation=True, + awardNumber=None, + affiliation=None, + ), + Person( + name="Foundation, NARSAD Young Investigator grant from the Brain & Behavior Research", + identifier=None, + email=None, + url=None, + roleName=[RoleType.Sponsor], + includeInCitation=True, + awardNumber=None, + affiliation=None, + ), + Person( + name="Foundation, Kavli", + identifier=None, + email=None, + url=None, + roleName=[RoleType.Sponsor], + includeInCitation=True, + awardNumber=None, + affiliation=None, + ), + Organization( + awardNumber="U19NS104590", + name="initiative, BRAIN", + identifier=None, + email=None, + url=None, + roleName=[RoleType.Sponsor], + includeInCitation=False, + contactPoint=None, + ), ], - description=( - "A challenge for data sharing in systems neuroscience is the" - " multitude of different data formats used. Neurodata Without" - " Borders: Neurophysiology 2.0 (NWB:N) has emerged as a" - " standardized data format for the storage of cellular-level data" - " together with meta-data, stimulus information, and behavior." - " A key next step to facilitate NWB:N adoption is to provide easy" - " to use processing pipelines to import/export data from/to NWB:N." - " Here, we present a NWB-formatted dataset of 1863 single neurons" - " recorded from the medial temporal lobes of 59 human subjects" - " undergoing intracranial monitoring while they performed a" - " recognition memory task. We provide code to analyze and" - " export/import stimuli, behavior, and electrophysiological" - " recordings to/from NWB in both MATLAB and Python. The data files" - " are NWB:N compliant, which affords interoperability between" - " programming languages and operating systems. This combined data" - " and code release is a case study for how to utilize NWB:N for" - " human single-neuron recordings and enables easy re-use of this" - " hard-to-obtain data for both teaching and research on the" - " mechanisms of human memory." + description="A challenge for data sharing in systems neuroscience is the multitude of different data formats used. Neurodata Without Borders: Neurophysiology 2.0 (NWB:N) has emerged as a standardized data format for the storage of cellular-level data together with meta-data, stimulus information, and behavior. A key next step to facilitate NWB:N adoption is to provide easy to use processing pipelines to import/export data from/to NWB:N. Here, we present a NWB-formatted dataset of 1863 single neurons recorded from the medial temporal lobes of 59 human subjects undergoing intracranial monitoring while they performed a recognition memory task. We provide code to analyze and export/import stimuli, behavior, and electrophysiological recordings to/from NWB in both MATLAB and Python. The data files are NWB:N compliant, which affords interoperability between programming languages and operating systems. This combined data and code release is a case study for how to utilize NWB:N for human single-neuron recordings and enables easy re-use of this hard-to-obtain data for both teaching and research on the mechanisms of human memory.", + identifier=PropertyValue( + maxValue=None, + minValue=None, + unitCode=None, + unitText=None, + value="000004", + valueReference=None, + propertyID="DANDI", ), - identifier=PropertyValue(value="000004", propertyID="DANDI"), keywords=[ "cognitive neuroscience", "data standardization", @@ -835,10 +1146,7 @@ def test_dandimeta_migration(): "single-neurons", ], license="CC-BY-4.0", - name=( - "A NWB-based dataset and processing pipeline of human" - " single-neuron activity during a declarative memory task" - ), + name="A NWB-based dataset and processing pipeline of human single-neuron activity during a declarative memory task", schemaVersion="1.0.0-rc1", studyTarget=None, protocol=None, From 5e15370f984be2aac5f76428e1961637ee0d00a7 Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Wed, 16 Dec 2020 12:52:18 -0500 Subject: [PATCH 6/6] Break long lines --- dandi/tests/test_metadata.py | 133 +++++++++++++++++++++++++++++------ 1 file changed, 112 insertions(+), 21 deletions(-) diff --git a/dandi/tests/test_metadata.py b/dandi/tests/test_metadata.py index 5c0d81554..0b1f658f0 100644 --- a/dandi/tests/test_metadata.py +++ b/dandi/tests/test_metadata.py @@ -589,7 +589,10 @@ def test_dandimeta_migration(): relatedResource=[ Resource( identifier="DOI:10.17605/OSF.IO/HV7JA", - name="A NWB-based Dataset and Processing Pipeline of Human Single-Neuron Activity During a Declarative Memory Task", + name=( + "A NWB-based Dataset and Processing Pipeline of Human" + " Single-Neuron Activity During a Declarative Memory Task" + ), repository="Open Science Framework", url="https://osf.io/hv7ja/", relation=RelationType.IsDerivedFrom, @@ -635,7 +638,10 @@ def test_dandimeta_migration(): name="Chandravadia, Nand", affiliation=[ Organization( - name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + name=( + "Department of Neurosurgery, Cedars-Sinai Medical" + " Center, Los Angeles, CA, USA" + ), identifier=None, email=None, url=None, @@ -670,7 +676,13 @@ def test_dandimeta_migration(): name="Liang, Dehua", affiliation=[ Organization( - name="Institute for Interdisciplinary Brain and Behavioral Sciences, Crean College of Health and Behavioral Sciences, Schmid College of Science and Technology, Chapman University, Orange, CA, USA", + name=( + "Institute for Interdisciplinary Brain and" + " Behavioral Sciences, Crean College of Health and" + " Behavioral Sciences, Schmid College of Science" + " and Technology, Chapman University, Orange, CA," + " USA" + ), identifier=None, email=None, url=None, @@ -738,7 +750,10 @@ def test_dandimeta_migration(): name="Carlson, April", affiliation=[ Organization( - name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + name=( + "Department of Neurosurgery, Cedars-Sinai Medical" + " Center, Los Angeles, CA, USA" + ), identifier=None, email=None, url=None, @@ -763,7 +778,10 @@ def test_dandimeta_migration(): name="Faraut, Mailys", affiliation=[ Organization( - name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + name=( + "Department of Neurosurgery, Cedars-Sinai Medical" + " Center, Los Angeles, CA, USA" + ), identifier=None, email=None, url=None, @@ -784,7 +802,10 @@ def test_dandimeta_migration(): name="Chung, Jeffrey M.", affiliation=[ Organization( - name="Department of Neurology, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + name=( + "Department of Neurology, Cedars-Sinai Medical" + " Center, Los Angeles, CA, USA" + ), identifier=None, email=None, url=None, @@ -805,7 +826,10 @@ def test_dandimeta_migration(): name="Reed, Chrystal M.", affiliation=[ Organization( - name="Department of Neurology, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + name=( + "Department of Neurology, Cedars-Sinai Medical" + " Center, Los Angeles, CA, USA" + ), identifier=None, email=None, url=None, @@ -831,7 +855,11 @@ def test_dandimeta_migration(): name="Dichter, Ben", affiliation=[ Organization( - name="Biological Systems & Engineering Division, Lawrence Berkeley National Laboratory, Berkeley, CA, USA", + name=( + "Biological Systems & Engineering Division," + " Lawrence Berkeley National Laboratory, Berkeley," + " CA, USA" + ), identifier=None, email=None, url=None, @@ -867,7 +895,13 @@ def test_dandimeta_migration(): name="Maoz, Uri", affiliation=[ Organization( - name="Institute for Interdisciplinary Brain and Behavioral Sciences, Crean College of Health and Behavioral Sciences, Schmid College of Science and Technology, Chapman University, Orange, CA, USA", + name=( + "Institute for Interdisciplinary Brain and" + " Behavioral Sciences, Crean College of Health and" + " Behavioral Sciences, Schmid College of Science" + " and Technology, Chapman University, Orange, CA," + " USA" + ), identifier=None, email=None, url=None, @@ -877,7 +911,11 @@ def test_dandimeta_migration(): contactPoint=None, ), Organization( - name="Division of Biology and Biological Engineering, California Institute of Technology, Pasadena, CA, USA", + name=( + "Division of Biology and Biological Engineering," + " California Institute of Technology, Pasadena, CA," + " USA" + ), identifier=None, email=None, url=None, @@ -898,7 +936,10 @@ def test_dandimeta_migration(): name="Kalia, Suneil K.", affiliation=[ Organization( - name="Division of Neurosurgery, Department of Surgery, University of Toronto, Toronto, Canada", + name=( + "Division of Neurosurgery, Department of Surgery," + " University of Toronto, Toronto, Canada" + ), identifier=None, email=None, url=None, @@ -939,7 +980,10 @@ def test_dandimeta_migration(): contactPoint=None, ), Organization( - name="Division of Neurosurgery, Department of Surgery, University of Toronto, Toronto, Canada", + name=( + "Division of Neurosurgery, Department of Surgery," + " University of Toronto, Toronto, Canada" + ), identifier=None, email=None, url=None, @@ -960,7 +1004,10 @@ def test_dandimeta_migration(): name="Mamelak, Adam N.", affiliation=[ Organization( - name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + name=( + "Department of Neurosurgery, Cedars-Sinai Medical" + " Center, Los Angeles, CA, USA" + ), identifier=None, email=None, url=None, @@ -999,7 +1046,10 @@ def test_dandimeta_migration(): name="Rutishauser, Ueli", affiliation=[ Organization( - name="Department of Neurosurgery, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + name=( + "Department of Neurosurgery, Cedars-Sinai Medical" + " Center, Los Angeles, CA, USA" + ), identifier=None, email=None, url=None, @@ -1009,7 +1059,10 @@ def test_dandimeta_migration(): contactPoint=None, ), Organization( - name="Department of Neurology, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + name=( + "Department of Neurology, Cedars-Sinai Medical" + " Center, Los Angeles, CA, USA" + ), identifier=None, email=None, url=None, @@ -1019,7 +1072,11 @@ def test_dandimeta_migration(): contactPoint=None, ), Organization( - name="Division of Biology and Biological Engineering, California Institute of Technology, Pasadena, CA, USA", + name=( + "Division of Biology and Biological Engineering," + " California Institute of Technology, Pasadena, CA," + " USA" + ), identifier=None, email=None, url=None, @@ -1029,7 +1086,11 @@ def test_dandimeta_migration(): contactPoint=None, ), Organization( - name="Computational and Neural Systems Program, California Institute of Technology, Pasadena, CA, USA", + name=( + "Computational and Neural Systems Program," + " California Institute of Technology, Pasadena, CA," + " USA" + ), identifier=None, email=None, url=None, @@ -1039,7 +1100,11 @@ def test_dandimeta_migration(): contactPoint=None, ), Organization( - name="Center for Neural Science and Medicine, Department of Biomedical Science, Cedars-Sinai Medical Center, Los Angeles, CA, USA", + name=( + "Center for Neural Science and Medicine, Department" + " of Biomedical Science, Cedars-Sinai Medical" + " Center, Los Angeles, CA, USA" + ), identifier=None, email=None, url=None, @@ -1094,7 +1159,10 @@ def test_dandimeta_migration(): affiliation=None, ), Person( - name="Foundation, NARSAD Young Investigator grant from the Brain & Behavior Research", + name=( + "Foundation, NARSAD Young Investigator grant from the Brain" + " & Behavior Research" + ), identifier=None, email=None, url=None, @@ -1124,7 +1192,27 @@ def test_dandimeta_migration(): contactPoint=None, ), ], - description="A challenge for data sharing in systems neuroscience is the multitude of different data formats used. Neurodata Without Borders: Neurophysiology 2.0 (NWB:N) has emerged as a standardized data format for the storage of cellular-level data together with meta-data, stimulus information, and behavior. A key next step to facilitate NWB:N adoption is to provide easy to use processing pipelines to import/export data from/to NWB:N. Here, we present a NWB-formatted dataset of 1863 single neurons recorded from the medial temporal lobes of 59 human subjects undergoing intracranial monitoring while they performed a recognition memory task. We provide code to analyze and export/import stimuli, behavior, and electrophysiological recordings to/from NWB in both MATLAB and Python. The data files are NWB:N compliant, which affords interoperability between programming languages and operating systems. This combined data and code release is a case study for how to utilize NWB:N for human single-neuron recordings and enables easy re-use of this hard-to-obtain data for both teaching and research on the mechanisms of human memory.", + description=( + "A challenge for data sharing in systems neuroscience is the" + " multitude of different data formats used. Neurodata Without" + " Borders: Neurophysiology 2.0 (NWB:N) has emerged as a" + " standardized data format for the storage of cellular-level data" + " together with meta-data, stimulus information, and behavior. A" + " key next step to facilitate NWB:N adoption is to provide easy to" + " use processing pipelines to import/export data from/to NWB:N." + " Here, we present a NWB-formatted dataset of 1863 single neurons" + " recorded from the medial temporal lobes of 59 human subjects" + " undergoing intracranial monitoring while they performed a" + " recognition memory task. We provide code to analyze and" + " export/import stimuli, behavior, and electrophysiological" + " recordings to/from NWB in both MATLAB and Python. The data files" + " are NWB:N compliant, which affords interoperability between" + " programming languages and operating systems. This combined data" + " and code release is a case study for how to utilize NWB:N for" + " human single-neuron recordings and enables easy re-use of this" + " hard-to-obtain data for both teaching and research on the" + " mechanisms of human memory." + ), identifier=PropertyValue( maxValue=None, minValue=None, @@ -1146,7 +1234,10 @@ def test_dandimeta_migration(): "single-neurons", ], license="CC-BY-4.0", - name="A NWB-based dataset and processing pipeline of human single-neuron activity during a declarative memory task", + name=( + "A NWB-based dataset and processing pipeline of human single-neuron" + " activity during a declarative memory task" + ), schemaVersion="1.0.0-rc1", studyTarget=None, protocol=None,