Add 506 note handling per Windsor proposal
authorDan Scott <dan@coffeecode.net>
Wed, 22 Jun 2011 14:01:31 +0000 (10:01 -0400)
committerDan Scott <dscott@laurentian.ca>
Tue, 7 May 2013 18:36:09 +0000 (14:36 -0400)
The 506 note is for access restrictions; we will generate one 506 field
per instutition, with a customized $a message, the consortial license
identified in the $b, and the publisher in $e, along with the library
symbol in $5 to enable the catalogue to control the display of the
message in an appropriate scope.

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

index ff72922..f86e977 100644 (file)
@@ -25,21 +25,24 @@ class Institution():
             "code": "OSTMA", \
             "ebrary_code": "algomauca", \
             "proxy": "http://libproxy.auc.ca/login?url=", \
-            "link_text": "Available online" \
+            "link_text": "Available online", \
+            "access_note": "Access restricted to users with a valid Algoma University ID" \
         }
         
         self.laurentian = { \
             "code": "OSUL", \
             "ebrary_code": "jndlu", \
             "proxy": "https://librweb.laurentian.ca/login?url=", \
-            "link_text": "Available online / disponible en ligne" \
+            "link_text": "Available online / disponible en ligne", \
+            "access_note": "Access restricted to users with a valid Laurentian University ID" \
         }
 
         self.windsor = { \
             "code": "OWA", \
             "ebrary_code": "oculwindsor", \
             "proxy": "http://ezproxy.uwindsor.ca/login?url=", \
-            "link_text": "To view Windsor's electronic resource click here." \
+            "link_text": "To view Windsor's electronic resource click here.", \
+            "access_note": "Access restricted to users with a valid University of Windsor ID" \
         }
 
     def get_settings(self, lib):
@@ -63,12 +66,13 @@ to these resources.
 
 The script customizes the following aspects of each record:
 
+  * Adds a 506 access restriction note per institution
   * Adds one 856 per institution specified at the command line:
       * $u (URL) - prepends the institutional proxy and, for eBrary records,
         changes the insitutional code
       * $y (link text) - sets preferred text of the link to the resource
       * $z (public note) - sets public note for the resource
-
+      * $9 - sets the institutional code for located URIs in Evergreen
   * Adds a 710 field to identify the publisher using the value specified
     at the command line
   * Adds a 590 internal note field using the value specified at the command
@@ -79,7 +83,11 @@ Required arguments:
 
     -o / --output : The name of the output MARC file.
 
-    -p / --publisher : The name of the publisher to be inserted in a 710 field.
+    -c / --consortium : The name of the consortial license to be inserted in
+                        each 506$b access restriction note.
+
+    -p / --publisher : The name of the publisher to be inserted in a 710 field
+                       and each 506$e access restriction note.
 
     -A / --algoma: Add an 856 for Algoma University
 
@@ -110,6 +118,8 @@ def consolidate_options(opts):
             _options['--input'] = val
         elif key == '-o':
             _options['--output'] = val
+        elif key == '-c':
+            _options['--consortium'] = val
         elif key == '-p':
             _options['--publisher'] = val
         elif key == '-n':
@@ -143,6 +153,10 @@ def check_options(options):
         print "* Missing -o / --output argument!"
         _help = True
 
+    if '--consortium' not in options:
+        print "* Missing -c / --consortium argument!"
+        _help = True
+
     if '--publisher' not in options:
         print "* Missing -p / --publisher argument!"
         _help = True
@@ -172,6 +186,7 @@ def check_options(options):
 
     clean_opts = dict()
     clean_opts['publisher'] = options['--publisher']
+    clean_opts['consortium'] = options['--consortium']
 
     if '--sample' in options:
         clean_opts['sample'] = options['--sample']
@@ -266,6 +281,7 @@ def process_fields(record, options):
             new_record.add_field(field)
 
     add_publisher(record, new_record, options)
+    add_restriction(new_record, options)
 
     if 'note' in options:
         note = pymarc.Field(tag = '590',
@@ -315,6 +331,30 @@ def add_publisher(record, new_record, options):
         )
         new_record.add_field(seven_ten)
 
+def add_restriction(new_record, options):
+    """
+    Adds a 506 access restriction note per institution
+
+    The 506 field includes the following subfields:
+      * $a - Standard text to display
+      * $b - Jurisdiction (identifies the consortial license)
+      * $e - Authorization (online publisher that enforces authorization) 
+      * $5 - Institutional code to which this note applies
+    """
+
+    for library in options['libraries']:
+        libopts = options['settings'].get_settings(library)
+        # Add the access restriction note
+        note = pymarc.Field(tag = '506',
+            indicators = ['1', ' '],
+            subfields = [
+                'a', libopts['access_note'],
+                'b', options['consortium'],
+                'e', options['publisher'],
+                '5', libopts['code']
+            ]
+        )
+        new_record.add_field(note)
 
 def add_cat_source(record, options):
     """Add or extend the 040 field to identify the cataloguing source"""