Hack to support Oxford DOIs in 956 fields
authorDan Scott <dscott@laurentian.ca>
Tue, 29 Aug 2017 17:12:15 +0000 (13:12 -0400)
committerDan Scott <dscott@laurentian.ca>
Tue, 29 Aug 2017 17:12:15 +0000 (13:12 -0400)
ScholarsPortal MARC records put Oxford DOIs in their 956 fields instead
of 856; let's use both of them and hope that no other records use a 956
that doesn't actually resolve.

Also, if the URL is for books.scholarsportal.info, identify
ScholarsPortal as the platform.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
tools/ebooks/prep_ebook_records.py

index 22a2d30..fc72b1f 100755 (executable)
@@ -290,7 +290,8 @@ def url_check(record, options):
 
     match = False
     match_id = 0
-    for url in record.get_fields('856'):
+    # Oxford MARC files from ScholarsPortal have DOIs in 956(!)
+    for url in record.get_fields('856','956'):
         for urlval in url.get_subfields('u'):
             # print "urlval", urlval
             for library in options['libraries']:
@@ -495,7 +496,8 @@ def process_fields(record, options):
         if 'clean' in options:
             field = clean_diacritics(field)
         # Process all of the 856 fields
-        if field.tag == '856':
+        # Oxford MARC files from ScholarsPortal have DOIs in 956(!)
+        if field.tag == '856' or field.tag == '956':
             new_fields = process_urls(field, options, publisher)
             if new_fields:
                 for new_856 in new_fields:
@@ -965,7 +967,11 @@ def process_urls(field, options, publisher):
                 continue
 
             data = options['settings'].get_settings(lib)
-            subs = get_subfields(field, data, options['platform'])
+
+            platform = options['platform']
+            if field['u'].find('books.scholarsportal') > -1:
+                platform = 'ScholarsPortal'
+            subs = get_subfields(field, data, platform)
             eight_five_six = pymarc.Field(tag = '856',
                 indicators = ['4', '0'],
                 subfields = subs