Skip to content

Commit

Permalink
Add additional unique_id options for Kade (#170)
Browse files Browse the repository at this point in the history
* Add id_str as generic unique id field option

* Add additional metadata keys
  • Loading branch information
mwalmsley authored May 22, 2024
1 parent 18920e7 commit 6ae2f7e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/services/import/reduction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,19 @@ def unique_id
subject_metadata = payload.dig('subject', 'metadata')
return unless subject_metadata

# cosmic dawn metadata - may be marked as hidden (!id) or private (#id) metadata
# this is the standard gz metadata for all future uploads
unique_id = subject_metadata['!filename']
return unique_id if unique_id

# this catches various common (non-standard and to be avoided in future) variations
unique_id = subject_metadata['!Filename'] || subject_metadata['#filename'] || subject_metadata['#Filename'] || subject_metadata['filename'] || subject_metadata['Filename']
return unique_id if unique_id

# old cosmic dawn metadata - may be marked as hidden (!id) or private (#id) metadata
unique_id = subject_metadata['id'] || subject_metadata['!id'] || subject_metadata['#id']
return unique_id if unique_id

# decals metadata
# old decals metadata
unique_id = subject_metadata['#name']
return unique_id if unique_id

Expand Down

0 comments on commit 6ae2f7e

Please sign in to comment.