Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

Commit

Permalink
Filter out items belonging to the graveyard APO when exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
mjgiarlo authored and jcoyne committed Jun 3, 2021
1 parent 256792f commit 9db561d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions bin/export-items
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

COLLECTION_DRUIDS_LIST = 'collection_druids.txt'
GRAVEYARD_APO = 'druid:kg712km1576'
UNIVERSITY_ARCHIVES_APO = 'druid:yf767bj4831'

require_relative '../config/environment'

Expand Down Expand Up @@ -45,11 +44,7 @@ module ActiveFedora
end

collection_druids = if File.exist?(COLLECTION_DRUIDS_LIST)
File
.read(COLLECTION_DRUIDS_LIST)
.split
.map { |bare_druid| "druid:#{bare_druid}" }
.reject { |druid| [GRAVEYARD_APO, UNIVERSITY_ARCHIVES_APO].include?(Hydrus::Collection.find(druid).admin_policy_object_id) }
File.read(COLLECTION_DRUIDS_LIST).split.map { |bare_druid| "druid:#{bare_druid}" }
else
[]
end
Expand Down Expand Up @@ -126,6 +121,10 @@ list.each do |item|
count += 1
warn count
begin
if item.apo_pid == GRAVEYARD_APO
warn "Skipping #{item.pid} because it belongs to the Graveyard APO"
next
end
attributes = serialize(item)
puts attributes.compact.to_json
rescue => e
Expand Down

0 comments on commit 9db561d

Please sign in to comment.