Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure only items with a druid are linked in dc_source_sm #1516

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/traject/config/geo_aardvark_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,13 @@ def log_skip(context)
to_field 'pcdm_memberOf_sm', cocina_structural('isMemberOf'), gsub('druid:', 'stanford-')

# https://opengeometadata.org/ogm-aardvark/#source
# - links items that were georeferenced to their original version
# - links items that were georeferenced to their original version, if it is in SDR
# - extracts the druid from the purl URL and uses it to construct an EarthWorks URL
to_field 'dct_source_sm', cocina_descriptive('relatedResource'), select_type('has other format'),
select(->(res) { res['displayLabel'] == 'Scanned map' }),
transform(->(res) { res.fetch('identifier', []).dig(0, 'value') }),
transform(->(purl) { "stanford-#{purl.split('/').last}" if purl })
transform(->(res) { res.fetch('identifier', []).dig(0, 'value')&.split('/')&.last }),
select(->(id) { id.match?(/[a-z]{2}\d{3}[a-z]{2}\d{4}/) if id }),
marlo-longley marked this conversation as resolved.
Show resolved Hide resolved
transform(->(druid) { "stanford-#{druid.split('/').last}" if druid })

# https://opengeometadata.org/ogm-aardvark/#rights_1
to_field 'dct_rights_sm', cocina_access('useAndReproductionStatement')
Expand Down
Loading