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)
|
# 5.5.0 (2026-02-19)
|
||||||
|
|
||||||
## New features
|
## New features
|
||||||
|
|
|
||||||
|
|
@ -98,13 +98,19 @@ class _ModelStore:
|
||||||
submitter: str,
|
submitter: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Add submitter IRI to the record annotations, use CURIE if possible"""
|
"""Add submitter IRI to the record annotations, use CURIE if possible"""
|
||||||
if 'annotations' not in json_object:
|
json_object['annotations'] = self.homogenize_annotations(json_object)
|
||||||
json_object['annotations'] = {}
|
|
||||||
submitter_curie_or_iri = self.get_curie(self.tags['id'])
|
submitter_curie_or_iri = self.get_curie(self.tags['id'])
|
||||||
time_curie_or_iri = self.get_curie(self.tags['time'])
|
time_curie_or_iri = self.get_curie(self.tags['time'])
|
||||||
json_object['annotations'][submitter_curie_or_iri] = submitter
|
json_object['annotations'][submitter_curie_or_iri] = submitter
|
||||||
json_object['annotations'][time_curie_or_iri] = datetime.now().isoformat()
|
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(
|
def get_curie(
|
||||||
self,
|
self,
|
||||||
curie_or_iri: str,
|
curie_or_iri: str,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ dependencies = [
|
||||||
"fastapi[standard]",
|
"fastapi[standard]",
|
||||||
"fastapi-pagination",
|
"fastapi-pagination",
|
||||||
"fsspec",
|
"fsspec",
|
||||||
"linkml",
|
"linkml>=1.10.0",
|
||||||
"pydantic",
|
"pydantic",
|
||||||
"PyYAML",
|
"PyYAML",
|
||||||
"rdflib",
|
"rdflib",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue