diff --git a/dinapy/schemas/collectingeventschema.py b/dinapy/schemas/collectingeventschema.py index f9c2f67..0f7b920 100644 --- a/dinapy/schemas/collectingeventschema.py +++ b/dinapy/schemas/collectingeventschema.py @@ -20,12 +20,12 @@ class Meta: class Collectors(BaseSchema): class Meta: - type_ = 'collectors' + type_ = 'person' class Attachment(BaseSchema): class Meta: - type_ = 'attachment' + type_ = 'metadata' class CollectingEventSchema(Schema): '''Schema for a Collecting Event used for serializing and deserializing JSON.''' @@ -70,10 +70,10 @@ class CollectingEventSchema(Schema): managedAttributes = SkipUndefinedField(fields.Dict,attribute="attributes.managedAttributes") remarks = SkipUndefinedField(fields.Str,allow_none=True, attribute="attributes.remarks") - collectionMethod = create_relationship("collecting-event","collectionMethod") - protocol = create_relationship("collecting-event","protocol") - collectors = create_relationship("collecting-event","collectors") - attachment = create_relationship("collecting-event","attachment") + collectionMethod = create_relationship("collecting-event","collection-method","collectionMethod") + protocol = create_relationship("collecting-event","protocol","protocol") + collectors = create_relationship("collecting-event","person","collectors") + attachment = create_relationship("collecting-event","metadata","attachment") meta = fields.DocumentMeta() diff --git a/dinapy/schemas/materialsampleschema.py b/dinapy/schemas/materialsampleschema.py index 9c301b2..a6abc74 100644 --- a/dinapy/schemas/materialsampleschema.py +++ b/dinapy/schemas/materialsampleschema.py @@ -110,17 +110,17 @@ def object_deserialization(self, data, **kwargs): return MaterialSampleDTO(**data) collection = create_relationship("material-sample","collection") - collectingEvent = create_relationship("material-sample","collectingEvent") - preparationType = create_relationship("material-sample","preparationType") - preparationMethod = create_relationship("material-sample","preparationMethod") - parentMaterialSample = create_relationship("material-sample","parentMaterialSample") - preparedBy = create_relationship("material-sample","preparedBy") + collectingEvent = create_relationship("material-sample","collecting-event","collectingEvent") + preparationType = create_relationship("material-sample","preparation-type","preparationType") + preparationMethod = create_relationship("material-sample","preparation-method","preparationMethod") + parentMaterialSample = create_relationship("material-sample","material-sample","parentMaterialSample") + preparedBy = create_relationship("material-sample","person","preparedBy") attachment = create_relationship("material-sample","metadata","attachment") - preparationProtocol = create_relationship("material-sample","preparationProtocol") + preparationProtocol = create_relationship("material-sample","protocol","preparationProtocol") projects = create_relationship("material-sample","project","projects") - assemblages = create_relationship("material-sample","assemblages") + assemblages = create_relationship("material-sample","assemblage","assemblages") organism = create_relationship("material-sample","organism") - storageUnit = create_relationship("material-sample","storageUnit") + storageUnit = create_relationship("material-sample","storage-unit","storageUnit") meta = fields.DocumentMeta() diff --git a/dinapy/schemas/metadata_schema.py b/dinapy/schemas/metadata_schema.py index 09d394a..288d13e 100644 --- a/dinapy/schemas/metadata_schema.py +++ b/dinapy/schemas/metadata_schema.py @@ -108,11 +108,11 @@ class MetadataSchema(Schema): ) # Relationships - acMetadataCreator = create_relationship("metadata","person", "acMetadataCreator") + acMetadataCreator = create_relationship("metadata","person","acMetadataCreator") - derivatives = create_relationship("metadata","derivatives") + derivatives = create_relationship("metadata","derivative","derivatives") - dcCreator = create_relationship("metadata","person", "dcCreator") + dcCreator = create_relationship("metadata","person","dcCreator") @post_load def set_none_to_undefined(self, data, **kwargs): diff --git a/dinapy/schemas/molecular_analysis_result_schema.py b/dinapy/schemas/molecular_analysis_result_schema.py index 63761f8..184c3f9 100644 --- a/dinapy/schemas/molecular_analysis_result_schema.py +++ b/dinapy/schemas/molecular_analysis_result_schema.py @@ -9,7 +9,7 @@ class Attachment(BaseSchema): class Meta: - type_ = 'attachment' + type_ = 'metadata' class MolecularAnalysisResultSchema(Schema): id = fields.Str(load_only=True) @@ -17,7 +17,7 @@ class MolecularAnalysisResultSchema(Schema): createdBy = SkipUndefinedField(fields.Str, load_only=True, attribute="attributes.createdBy") createdOn = SkipUndefinedField(fields.Str, load_only=True, attribute="attributes.createdOn") - attachment = create_relationship("molecular-analysis-result","attachment") + attachment = create_relationship("molecular-analysis-result","metadata","attachment") @post_load def set_none_to_undefined(self, data, **kwargs): diff --git a/dinapy/schemas/project_schema.py b/dinapy/schemas/project_schema.py index 9759e8e..b5452a7 100644 --- a/dinapy/schemas/project_schema.py +++ b/dinapy/schemas/project_schema.py @@ -9,7 +9,7 @@ class Attachment(BaseSchema): class Meta: - type_ = 'attachment' + type_ = 'metadata' class ProjectSchema(Schema): id = fields.Str(load_only=True) @@ -23,7 +23,7 @@ class ProjectSchema(Schema): multilingualDescription = SkipUndefinedField(fields.Dict,allow_none=True,attribute="attributes.multilingualDescription") extensionValues = SkipUndefinedField(fields.Dict,allow_none=True,attribute="attributes.extensionValues") - attachment = create_relationship("project","attachment") + attachment = create_relationship("project","metadata","attachment") meta = fields.DocumentMeta() diff --git a/dinapy/schemas/storageunitusageschema.py b/dinapy/schemas/storageunitusageschema.py index c527ea6..72b7781 100644 --- a/dinapy/schemas/storageunitusageschema.py +++ b/dinapy/schemas/storageunitusageschema.py @@ -25,8 +25,8 @@ class StorageUnitUsage(Schema): createdOn = SkipUndefinedField(fields.DateTime, load_only=True,attribute="attributes.createdOn") createdBy = SkipUndefinedField(fields.Str, load_only=True,attribute="attributes.createdBy") - storageUnit = create_relationship("storage-unit-usage","storageUnit") - storageUnitType = create_relationship("storage-unit-usage","storageUnitType") + storageUnit = create_relationship("storage-unit-usage","storage-unit","storageUnit") + storageUnitType = create_relationship("storage-unit-usage","storage-unit-type","storageUnitType") @post_load def set_none_to_undefined(self, data, **kwargs): diff --git a/tests/material_sample_schema_test.py b/tests/material_sample_schema_test.py index ebff7ae..ae0a642 100644 --- a/tests/material_sample_schema_test.py +++ b/tests/material_sample_schema_test.py @@ -228,8 +228,8 @@ "related": "/api/v1/material-sample/182ed68e-7536-4ad4-868c-399c8e5d70f3/parentMaterialSample" }, "data": { - "id": "01902d3a-0ec1-7a57-8284-f4ba3aff1664", - "type": "parent-material-sample" + "id": "01902d3a-0ec1-7a57-8284-f4ba3aff1664", + "type": "material-sample" }, }, "collectingEvent": {