Ensure uniform annotation structures when records are stored #197
3 changed files with 16 additions and 3 deletions
|
|
@ -1,3 +1,10 @@
|
|||
# 5.5.1 (2026-03-10)
|
||||
|
||||
## Improvements
|
||||
|
||||
- Ensure uniform annotation structures when records are stored.
|
||||
|
||||
|
||||
# 5.5.0 (2026-02-19)
|
||||
|
||||
## New features
|
||||
|
|
|
|||
|
|
@ -98,13 +98,19 @@ class _ModelStore:
|
|||
submitter: str,
|
||||
) -> None:
|
||||
"""Add submitter IRI to the record annotations, use CURIE if possible"""
|
||||
if 'annotations' not in json_object:
|
||||
json_object['annotations'] = {}
|
||||
json_object['annotations'] = self.homogenize_annotations(json_object)
|
||||
submitter_curie_or_iri = self.get_curie(self.tags['id'])
|
||||
time_curie_or_iri = self.get_curie(self.tags['time'])
|
||||
json_object['annotations'][submitter_curie_or_iri] = submitter
|
||||
json_object['annotations'][time_curie_or_iri] = datetime.now().isoformat()
|
||||
|
||||
@staticmethod
|
||||
def homogenize_annotations(json_object) -> dict:
|
||||
return {
|
||||
k: v['annotation_value'] if isinstance(v, dict) else v
|
||||
for k, v in json_object.get('annotations', {}).items()
|
||||
}
|
||||
|
||||
def get_curie(
|
||||
self,
|
||||
curie_or_iri: str,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ dependencies = [
|
|||
"fastapi[standard]",
|
||||
"fastapi-pagination",
|
||||
"fsspec",
|
||||
"linkml",
|
||||
"linkml>=1.10.0",
|
||||
"pydantic",
|
||||
"PyYAML",
|
||||
"rdflib",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue