Skip to content

Commit

Permalink
Add temporalCoverage to JSON-LD output
Browse files Browse the repository at this point in the history
  • Loading branch information
marksparkza committed Nov 9, 2023
1 parent 9e019f7 commit bd9c468
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions odp/catalog/mims.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ def _create_jsonld_metadata(
f'{mims_catalog.url}/'
f'{published_record.doi if published_record.doi else published_record.id}'
)
temporal_cov = next(
(d.get('date') for d in datacite_metadata.get('dates', ())
if d.get('dateType') == 'Valid'),
None
)

jsonld_metadata = {
"@context": "https://schema.org/",
Expand All @@ -110,6 +115,7 @@ def _create_jsonld_metadata(
"keywords": self.create_keyword_index_data(published_record),
"license": license,
"url": url,
"temporalCoverage": temporal_cov,
}

# Create a GeoShape box from DataCite geoLocationBox, because currently
Expand Down
3 changes: 2 additions & 1 deletion test/api/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ def test_redirect_to(
'@type': 'GeoShape',
'box': '-34.4 17.9 -34.0 18.3',
}
}
},
'temporalCoverage': '2019-11-01T00:00:00+02:00/2019-12-01T00:00:00+02:00',
},
}

Expand Down

0 comments on commit bd9c468

Please sign in to comment.