Skip to content

Commit

Permalink
[Duke] adjustment to determining the 'id' for records
Browse files Browse the repository at this point in the history
  • Loading branch information
derrekc committed Apr 30, 2024
1 parent 21bac2c commit 012f0ff
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUBY_VERSION=2.7
ARG RUBY_VERSION=3.1
FROM ruby:${RUBY_VERSION} AS base

RUN apt-get update && apt-get -y upgrade && apt-get -y install git jq
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.14
0.5.19.3
19 changes: 19 additions & 0 deletions lib/data/duke/traject_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
to_field 'id', extract_marc(settings['specs'][:id], first: true) do |rec, acc|
acc.collect! do |s|
id = s.to_s.strip

# This is where we need to parse the old-style Aleph ID from the
# new style (Alma) MME id
mms_splits = id.scan(/^(DUKE)?(\d{2})(\d{9})(\d{7})/)

# If the split result is empty, this represents a new Alma-born record
# Otherwise, get the old Aleph id from the split string
id = mms_splits.empty? ? id[2..] : mms_splits[0][2]

#if mms_splits.empty?
## NOTE - this is an ALMA-born record, so merely
## remove the leading '99' and use the rest of the string
# id = id[2..]
#else
# id = mms_splits[0][2]
#end

## TODO -- we need to account for Alma-born records

id.match(/DUKE.*/) ? id : "DUKE#{id}"
end
Logging.mdc['record_id'] = acc.first
Expand Down
3 changes: 3 additions & 0 deletions lib/marc_to_argot/macros/duke/items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,12 @@ def self.set_status(rec, item)
item_id = item['item_id'].to_s
location_code = item['location_code'].to_s
type = item['type'].to_s
call_no = item['call_no'].to_s

if !due_date.empty? && process_state != 'IT'
status = 'Checked Out'
elsif !due_date.empty? && call_no.empty?
status = 'On Order'
elsif status_code == '00'
status = 'Not Available'
elsif status_code == 'P3'
Expand Down

0 comments on commit 012f0ff

Please sign in to comment.