Skip to content

Commit

Permalink
Add RIS citation stub to published output
Browse files Browse the repository at this point in the history
  • Loading branch information
marksparkza committed Dec 4, 2023
1 parent 50043c9 commit 28c94a2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions migrate/systemdata/schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ SchemaOrg.Dataset:
type: metadata
uri: https://odp.saeon.ac.za/schema/metadata/schema.org/dataset

RIS.Citation:
type: metadata
uri: https://odp.saeon.ac.za/schema/metadata/ris/citation

Tag.Collection.Infrastructure:
type: tag
uri: https://odp.saeon.ac.za/schema/tag/collection/infrastructure
Expand Down
24 changes: 21 additions & 3 deletions odp/catalog/saeon.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def create_published_record(self, record_model: RecordModel) -> PublishedRecordM
timestamp=record_model.timestamp,
)

@staticmethod
def _create_published_metadata(record_model: RecordModel) -> list[PublishedMetadataModel]:
def _create_published_metadata(self, record_model: RecordModel) -> list[PublishedMetadataModel]:
"""Create the published metadata outputs for a record."""
published_metadata = [
PublishedMetadataModel(
Expand All @@ -40,7 +39,10 @@ def _create_published_metadata(record_model: RecordModel) -> list[PublishedMetad
)
]

if record_model.schema_id == ODPMetadataSchema.SAEON_ISO19115:
if record_model.schema_id == ODPMetadataSchema.SAEON_DATACITE4:
datacite_metadata = record_model.metadata

elif record_model.schema_id == ODPMetadataSchema.SAEON_ISO19115:
iso19115_schemaobj = Session.get(Schema, (ODPMetadataSchema.SAEON_ISO19115, SchemaType.metadata))
datacite_schemaobj = Session.get(Schema, (ODPMetadataSchema.SAEON_DATACITE4, SchemaType.metadata))

Expand All @@ -61,8 +63,24 @@ def _create_published_metadata(record_model: RecordModel) -> list[PublishedMetad
)
]

# add an RIS citation record
ris_schema = Session.get(Schema, (ODPMetadataSchema.RIS_CITATION, SchemaType.metadata))
published_metadata += [
PublishedMetadataModel(
schema_id=ris_schema.id,
schema_uri=ris_schema.uri,
metadata={'ris': self._create_ris_citation(datacite_metadata)}
)
]

return published_metadata

@staticmethod
def _create_ris_citation(datacite_metadata: dict) -> str:
"""Create an RIS citation from the DataCite metadata for a record."""
return '''
'''

@staticmethod
def _create_published_tags(record_model: RecordModel) -> list[PublishedTagInstanceModel]:
"""Create the published tags for a record."""
Expand Down

0 comments on commit 28c94a2

Please sign in to comment.