Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def serialize_dataset_to_doi(dataset: DatasetStorePointer) -> Dict[str, Any]:
return {
"data": {
"type": "dois",
"attributes": {
"doi": dataset.doi,
"prefix": settings.DATACITE['DOI_PREFIX'],
"suffix": dataset.doi_suffix,
"event": "publish",
"creators": dataset.creators if dataset.creators else [],
"titles": [
{
"title": dataset.name
}
],
"publisher": "asencis",
"container": {},
"publicationYear": dataset.publication_date.year,
"subjects": [],
"contributors": dataset.contributors if dataset.contributors else [],
"types": {
"resourceTypeGeneral": dataset.type,
},
"relatedIdentifiers": [],
"sizes": [
dataset.file_entity.size
],
"formats": [
dataset.format
],
"descriptions": [
{
"description": dataset.abstract,
"descriptionType": "Abstract"
},
{
"description": dataset.technical_information,
"descriptionType": "TechnicalInfo"
},
{
"description": dataset.supplementary_information,
"descriptionType": "Other"
}
],
"geoLocations": [],
"fundingReferences": [],
"url": 'https://asencis.com/datasets/{}'.format(dataset.uuid),
"schemaVersion": "http://datacite.org/schema/kernel-4",
"isActive": True,
"state": "findable",
"reason": None
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment