From f1dca22cd8494780d0339955cf0c1a5d22cdf32d Mon Sep 17 00:00:00 2001 From: Calum Macdonald Date: Tue, 30 Jan 2024 11:21:18 +0000 Subject: [PATCH] add additions for 1.1 for tissue samples --- hdr_schemata/models/GWDM/1.1/schema.json | 314 ++++++++++++++++++ hdr_schemata/models/GWDM/v1_1/Organisation.py | 13 +- hdr_schemata/models/GWDM/v1_1/SampleDonor.py | 24 ++ .../models/GWDM/v1_1/TissueSampleMetadata.py | 61 ++++ .../GWDM/v1_1/TissuesSampleCollection.py | 119 +++++++ hdr_schemata/models/GWDM/v1_1/__init__.py | 35 +- 6 files changed, 543 insertions(+), 23 deletions(-) create mode 100644 hdr_schemata/models/GWDM/v1_1/SampleDonor.py create mode 100644 hdr_schemata/models/GWDM/v1_1/TissueSampleMetadata.py create mode 100644 hdr_schemata/models/GWDM/v1_1/TissuesSampleCollection.py diff --git a/hdr_schemata/models/GWDM/1.1/schema.json b/hdr_schemata/models/GWDM/1.1/schema.json index 7b7e390..eae6ad7 100644 --- a/hdr_schemata/models/GWDM/1.1/schema.json +++ b/hdr_schemata/models/GWDM/1.1/schema.json @@ -1454,6 +1454,307 @@ ], "title": "TimeLag" }, + "TissueSampleDonor": { + "properties": { + "id": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ID of the sample donor", + "title": "Donor ID" + }, + "sex": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Sex of the sample donor", + "title": "Donor Sex" + }, + "dataCategories": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Data categories related to the sample donor", + "title": "Donor Data Categories" + } + }, + "title": "TissueSampleDonor", + "type": "object" + }, + "TissueSampleMetadata": { + "properties": { + "id": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ID of the tissue sample metadata", + "title": "Metadata ID" + }, + "sampleDonor": { + "allOf": [ + { + "$ref": "#/$defs/TissueSampleDonor" + } + ], + "default": null, + "description": "Information about the sample donor", + "title": "Sample Donor" + }, + "sampleType": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Type of the tissue sample", + "title": "Sample Type" + }, + "storageTemperature": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Storage temperature of the tissue sample", + "title": "Storage Temperature" + }, + "creationDate": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Date when the tissue sample metadata was created", + "title": "Creation Date" + }, + "AnatomicalSiteOntologyCode": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Ontology code for the anatomical site", + "title": "Anatomical Site Ontology Code" + }, + "AnatomicalSiteOntologyDescription": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Ontology description for the anatomical site", + "title": "Anatomical Site Ontology Description" + }, + "AnatomicalSiteFreeText": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Free text describing the anatomical site", + "title": "Anatomical Site Free Text" + }, + "sampleContentDiagnosis": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Diagnosis related to the sample content", + "title": "Sample Content Diagnosis" + }, + "useReCommaSeparatedValuesictions": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Restrictions on the use of the tissue sample", + "title": "Use Restrictions" + } + }, + "title": "TissueSampleMetadata", + "type": "object" + }, + "TissuesSampleCollection": { + "properties": { + "id": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "ID of the tissue sample collection", + "title": "ID" + }, + "dataCategories": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Data categories related to the tissue sample collection", + "title": "Data Categories" + }, + "materialType": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Material type of the tissue sample collection", + "title": "Material Type" + }, + "accessConditions": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Access conditions for the tissue sample collection", + "title": "Access Conditions" + }, + "collectionType": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Type of the tissue sample collection", + "title": "Collection Type" + }, + "disease": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Disease associated with the tissue sample collection", + "title": "Disease" + }, + "storageTemperature": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Storage temperature of the tissue sample collection", + "title": "Storage Temperature" + }, + "sampleAgeRange": { + "anyOf": [ + { + "$ref": "#/$defs/CommaSeparatedValues" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Age range of the tissue sample collection", + "title": "Sample Age Range" + }, + "tissueSampleMetadata": { + "anyOf": [ + { + "$ref": "#/$defs/TissueSampleMetadata" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Metadata related to the tissue sample", + "title": "Tissue Sample Metadata" + } + }, + "title": "TissuesSampleCollection", + "type": "object" + }, "TwoHundredFiftyFiveCharacters": { "maxLength": 255, "minLength": 2, @@ -1622,6 +1923,19 @@ "default": null, "description": "Descriptions of all tables and data elements that can be included in the dataset", "title": "Structural Metadata" + }, + "tissuesSampleCollection": { + "anyOf": [ + { + "$ref": "#/$defs/TissuesSampleCollection" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Metadata collection for Tissue Samples datasets", + "title": "Tissues Sample Collection" } }, "required": [ diff --git a/hdr_schemata/models/GWDM/v1_1/Organisation.py b/hdr_schemata/models/GWDM/v1_1/Organisation.py index f99f150..74452e0 100644 --- a/hdr_schemata/models/GWDM/v1_1/Organisation.py +++ b/hdr_schemata/models/GWDM/v1_1/Organisation.py @@ -4,24 +4,23 @@ class Organisation(BaseModel): - name: Optional[Name] = Field( ..., description="The organisation responsible for running or supporting the data access request process, as well as publishing and maintaining the metadata. In most this will be the same as the HDR UK Organisation (Hub or Alliance Member)/", example="SAIL", - title='Name' + title="Name", ) - #note: will need to do something about this in the future + # note: will need to do something about this in the future # should match a pattern? sha256? integer? - gatewayId: Optional[constr(min_length=2,max_length=50)] = Field( + gatewayId: Optional[constr(min_length=2, max_length=50)] = Field( None, description="The link to an ID somewhere in the gateway where more information on the publisher can be retrieved.", - title='Publisher gateway id' + title="Publisher gateway id", ) - rorId: Optional[constr(min_length=9,max_length=9)] = Field( + rorId: Optional[constr(min_length=9, max_length=9)] = Field( None, description="The Research Organization Registry (ROR) for the organisation, if applicable", - title="Research Organization Registry Identifier" + title="Research Organization Registry Identifier", ) diff --git a/hdr_schemata/models/GWDM/v1_1/SampleDonor.py b/hdr_schemata/models/GWDM/v1_1/SampleDonor.py new file mode 100644 index 0000000..1859cde --- /dev/null +++ b/hdr_schemata/models/GWDM/v1_1/SampleDonor.py @@ -0,0 +1,24 @@ +from typing import Optional, Union +from datetime import date, datetime +from pydantic import BaseModel, Field, constr +from hdr_schemata.definitions.HDRUK import CommaSeparatedValues + + +class SampleDonor(BaseModel): + id: Optional[constr(min_length=2, max_length=50)] = Field( + None, title="Donor ID", description="ID of the sample donor" + ) + + sex: Optional[str] = Field( + None, title="Donor Sex", description="Sex of the sample donor" + ) + + birthDate: Optional[Union[date, datetime]] = Field( + None, title="Donor birth date", description="Date of birth of the sample donor" + ) + + dataCategories: Optional[CommaSeparatedValues] = Field( + None, + title="Donor Data Categories", + description="Data categories related to the sample donor", + ) diff --git a/hdr_schemata/models/GWDM/v1_1/TissueSampleMetadata.py b/hdr_schemata/models/GWDM/v1_1/TissueSampleMetadata.py new file mode 100644 index 0000000..269c49b --- /dev/null +++ b/hdr_schemata/models/GWDM/v1_1/TissueSampleMetadata.py @@ -0,0 +1,61 @@ +from typing import Optional, Union, List +from pydantic import BaseModel, Field, constr +from datetime import date, datetime +from .SampleDonor import SampleDonor + +from hdr_schemata.definitions.HDRUK import CommaSeparatedValues + + +class TissueSampleMetadata(BaseModel): + id: Optional[constr(min_length=2, max_length=50)] = Field( + None, title="Metadata ID", description="ID of the tissue sample metadata" + ) + + sampleDonor: Optional[SampleDonor] = Field( + None, title="Sample Donor", description="Information about the sample donor" + ) + + sampleType: Optional[CommaSeparatedValues] = Field( + None, title="Sample Type", description="Type of the tissue sample" + ) + + storageTemperature: Optional[str] = Field( + None, + title="Storage Temperature", + description="Storage temperature of the tissue sample", + ) + + creationDate: Optional[Union[date, datetime]] = Field( + None, + title="Creation Date", + description="Date when the tissue sample metadata was created", + ) + + AnatomicalSiteOntologyCode: Optional[CommaSeparatedValues] = Field( + None, + title="Anatomical Site Ontology Code", + description="Ontology code for the anatomical site", + ) + AnatomicalSiteOntologyDescription: Optional[CommaSeparatedValues] = Field( + None, + title="Anatomical Site Ontology Description", + description="Ontology description for the anatomical site", + ) + + AnatomicalSiteFreeText: Optional[CommaSeparatedValues] = Field( + None, + title="Anatomical Site Free Text", + description="Free text describing the anatomical site", + ) + + sampleContentDiagnosis: Optional[CommaSeparatedValues] = Field( + None, + title="Sample Content Diagnosis", + description="Diagnosis related to the sample content", + ) + + useReCommaSeparatedValuesictions: Optional[CommaSeparatedValues] = Field( + None, + title="Use Restrictions", + description="Restrictions on the use of the tissue sample", + ) diff --git a/hdr_schemata/models/GWDM/v1_1/TissuesSampleCollection.py b/hdr_schemata/models/GWDM/v1_1/TissuesSampleCollection.py new file mode 100644 index 0000000..f61f15a --- /dev/null +++ b/hdr_schemata/models/GWDM/v1_1/TissuesSampleCollection.py @@ -0,0 +1,119 @@ +from typing import Optional +from pydantic import BaseModel, Field +from .TissueSampleMetadata import TissueSampleMetadata +from hdr_schemata.definitions.HDRUK import CommaSeparatedValues + + +class TissueSampleDonor(BaseModel): + id: Optional[CommaSeparatedValues] = Field( + None, title="Donor ID", description="ID of the sample donor" + ) + sex: Optional[CommaSeparatedValues] = Field( + None, title="Donor Sex", description="Sex of the sample donor" + ) + dataCategories: Optional[CommaSeparatedValues] = Field( + None, + title="Donor Data Categories", + description="Data categories related to the sample donor", + ) + + +class TissueSampleMetadata(BaseModel): + id: Optional[CommaSeparatedValues] = Field( + None, title="Metadata ID", description="ID of the tissue sample metadata" + ) + sampleDonor: TissueSampleDonor = Field( + None, title="Sample Donor", description="Information about the sample donor" + ) + sampleType: Optional[CommaSeparatedValues] = Field( + None, title="Sample Type", description="Type of the tissue sample" + ) + storageTemperature: Optional[CommaSeparatedValues] = Field( + None, + title="Storage Temperature", + description="Storage temperature of the tissue sample", + ) + creationDate: Optional[CommaSeparatedValues] = Field( + None, + title="Creation Date", + description="Date when the tissue sample metadata was created", + ) + AnatomicalSiteOntologyCode: Optional[CommaSeparatedValues] = Field( + None, + title="Anatomical Site Ontology Code", + description="Ontology code for the anatomical site", + ) + AnatomicalSiteOntologyDescription: Optional[CommaSeparatedValues] = Field( + None, + title="Anatomical Site Ontology Description", + description="Ontology description for the anatomical site", + ) + AnatomicalSiteFreeText: Optional[CommaSeparatedValues] = Field( + None, + title="Anatomical Site Free Text", + description="Free text describing the anatomical site", + ) + sampleContentDiagnosis: Optional[CommaSeparatedValues] = Field( + None, + title="Sample Content Diagnosis", + description="Diagnosis related to the sample content", + ) + useReCommaSeparatedValuesictions: Optional[CommaSeparatedValues] = Field( + None, + title="Use Restrictions", + description="Restrictions on the use of the tissue sample", + ) + + +class TissuesSampleCollection(BaseModel): + id: Optional[CommaSeparatedValues] = Field( + None, title="ID", description="ID of the tissue sample collection" + ) + + dataCategories: Optional[CommaSeparatedValues] = Field( + None, + title="Data Categories", + description="Data categories related to the tissue sample collection", + ) + + materialType: Optional[CommaSeparatedValues] = Field( + None, + title="Material Type", + description="Material type of the tissue sample collection", + ) + + accessConditions: Optional[CommaSeparatedValues] = Field( + None, + title="Access Conditions", + description="Access conditions for the tissue sample collection", + ) + + collectionType: Optional[CommaSeparatedValues] = Field( + None, + title="Collection Type", + description="Type of the tissue sample collection", + ) + + disease: Optional[CommaSeparatedValues] = Field( + None, + title="Disease", + description="Disease associated with the tissue sample collection", + ) + + storageTemperature: Optional[CommaSeparatedValues] = Field( + None, + title="Storage Temperature", + description="Storage temperature of the tissue sample collection", + ) + + sampleAgeRange: Optional[CommaSeparatedValues] = Field( + None, + title="Sample Age Range", + description="Age range of the tissue sample collection", + ) + + tissueSampleMetadata: Optional[TissueSampleMetadata] = Field( + None, + title="Tissue Sample Metadata", + description="Metadata related to the tissue sample", + ) diff --git a/hdr_schemata/models/GWDM/v1_1/__init__.py b/hdr_schemata/models/GWDM/v1_1/__init__.py index bfaf404..dbca75c 100644 --- a/hdr_schemata/models/GWDM/v1_1/__init__.py +++ b/hdr_schemata/models/GWDM/v1_1/__init__.py @@ -1,38 +1,41 @@ from hdr_schemata.models.GWDM import Gwdm10 -from .Coverage import Coverage +from .Coverage import Coverage from .Accessibility import Accessibility from .Required import Required from .Summary import Summary +from .TissuesSampleCollection import TissuesSampleCollection from typing import Optional from pydantic import Field, BaseModel, constr class Gwdm11(Gwdm10): - summary: Summary = Field( ..., - description='Summary of metadata describing key pieces of information.', - title='Summary', + description="Summary of metadata describing key pieces of information.", + title="Summary", ) - required: Required = Field( - ..., - description='required metadata needed for the GWDM', - title='Required' + ..., description="required metadata needed for the GWDM", title="Required" ) - - #overload Coverage with an updated version of it.. + + # overload Coverage with an updated version of it.. coverage: Optional[Coverage] = Field( None, - description='Observational, Spatial and Temporal coverage', - title='Coverage', + description="Observational, Spatial and Temporal coverage", + title="Coverage", ) - #modifying Accessibility --> modifying Usage + # modifying Accessibility --> modifying Usage accessibility: Accessibility = Field( None, - description='Accessibility information.', - title='Accessibility', + description="Accessibility information.", + title="Accessibility", + ) + + # add a new entry for tissue sample collections + tissuesSampleCollection: Optional[TissuesSampleCollection] = Field( + None, + description="Metadata collection for Tissue Samples datasets", + title="Tissues Sample Collection", ) -