Skip to content

Commit e212fdb

Browse files
committed
fix: consistent shtrove record identifiers
when sending cedar records to shtrove as supplementary records about an item, use that item's osfid in the record_identifier instead of a database id, so the records are more clearly associated in shtrove admin
1 parent 8e29e38 commit e212fdb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

api/share/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def share_update_cedar_metadata_record(self, referent_id, cedar_record_pk):
118118
shtrove_ingest_url(),
119119
params={
120120
'focus_iri': referent.get_semantic_iri(),
121-
'record_identifier': _shtrove_cedar_record_identifier(cedar_record._id, cedar_record.template.cedar_id),
121+
'record_identifier': _shtrove_cedar_record_identifier(referent._id, cedar_record.template.cedar_id),
122122
'is_supplementary': True,
123123
},
124124
headers={
@@ -142,7 +142,7 @@ def share_delete_cedar_metadata_record(
142142
response = requests.delete(
143143
shtrove_ingest_url(),
144144
params={
145-
'record_identifier': _shtrove_cedar_record_identifier(cedar_record___id, cedar_template_cedar_id),
145+
'record_identifier': _shtrove_cedar_record_identifier(cedar_referent___id, cedar_template_cedar_id),
146146
},
147147
headers=_shtrove_auth_headers(referent),
148148
)
@@ -300,8 +300,8 @@ def _shtrove_record_identifier(osf_item, osfmap_partition: OsfmapPartition):
300300
)
301301

302302

303-
def _shtrove_cedar_record_identifier(cedar_record___id, template_cedar_id) -> str:
304-
return f'{cedar_record___id}/CedarMetadataRecord:{template_cedar_id}'
303+
def _shtrove_cedar_record_identifier(referent_osfid, template_cedar_id) -> str:
304+
return f'{referent_osfid}/CedarMetadataRecord:{template_cedar_id}'
305305

306306

307307
def _shtrove_auth_headers(osf_item):

0 commit comments

Comments
 (0)