import codecs from pymarc import Field from utils import MyRecord as Record from collections import defaultdict from string import whitespace from utils import flatten_list, flatten_dict, merge_subfields, update_progress, \ load_from_json_file, export_dir, split_subfields, format_date, get_full_dict, data_dir, log_dir from processors import process_STAMP, process_UP pos = get_full_dict('T.ACQPOS.json') # except 'QTYEX'?, 'CHKNO'?, orders_1 = get_full_dict('T.ACQITEMS.json') orders_2 = get_full_dict('T.ACQITEMS2.json') items = {} for (k, v) in orders_1.items(): new = v.copy() for (i, j) in orders_2[k].items(): new[i] = j items[k] = new # if 'ONO' in new: # items[new['ONO']] = new # else: # break a = [e[1] for e in items.items()] b = [] for e in a: if not e in b: b.append(e) items = b mapping = defaultdict(lambda: None)
from string import whitespace from utils import ( flatten_list, flatten_dict, merge_subfields, update_progress, load_from_json_file, export_dir, split_subfields, format_date, get_full_dict, data_dir, log_dir, ) ALL = get_full_dict("T.CATCIRC.json") actions = { "WCAT.RENEW.CIRC": "RENEW", ".CAT-OVER-MARK": "OVERDUE", "WCAT.OVER.CIRC": "OVERDUE", "WCAT.OUT.CIRC": "OUT", "T.CAT-OUT-CIRC": "OUT", ".UNOCLAIMDEL": "CLAIM", "WCAT.IN.CIRC": "IN", ".REGLIBUSE-CIRC": "LIBUSE", } def process_AUDIT(x): res = []
from pymarc import Field from utils import MyRecord as Record from collections import defaultdict from string import whitespace from datetime import datetime from utils import flatten_list, flatten_dict, merge_subfields, update_progress, \ load_from_json_file, export_dir, split_subfields, format_date, get_full_dict, data_dir from processors import process_STAMP, process_UP ALL = get_full_dict('T.APPUSERS.json') # IAEA_USERS = get_full_dict('T.IAEAUSERS.json') def process_ALIAS(x): if len(x) == 8: return [{'tag': '133', 'ind1': ' ', 'ind2': ' ', 'subs': {'b' : x}}] # barcode in badge else: return [{'tag': '400', 'ind1': ' ', 'ind2': ' ', 'subs': {'b' : ', '.join(x.strip(whitespace+'|').split('\n |'))}}] def process_ADDED(x): if 'at' in x: v = format_date(x, '%Y %m %d at %H:%M:%S') else: v = format_date(x, '%d %b %Y') return [{'tag': '100', 'ind1': ' ', 'ind2': ' ', 'subs': {'a': v}}] def process_EXPIR(x): template = '%Y-%m-%d %H:%M:%S' # if '-' in x: # template = '%Y-%m-%d %H:%M:%S' if '/' in x:
# -*- coding: utf-8 -*- import sys import os import json import codecs from mapping import formatting_config, sp_mapping from mapping import mapping as reg_mapping from pymarc import Field from utils import MyRecord as Record from utils import flatten, update_progress, get_full_dict, export_dir, merge_subfields, log_dir, is_staff_paper from record_indexing import location_rules, collection_rules, format_rules ALL = get_full_dict() def index_record(rec): collections= [] locations = [] formats = [] for (label, rule) in location_rules.items(): if rule(rec): locations.append(label) for (label, rule) in collection_rules.items(): if rule(rec): collections.append(label) for (label, rule) in format_rules.items(): if rule(rec): formats.append(label) return (collections, locations, formats)
import codecs import calendar from pymarc import Field from utils import MyRecord as Record from collections import defaultdict from string import whitespace from utils import flatten_list, flatten_dict, merge_subfields, update_progress, \ load_from_json_file, export_dir, split_subfields, format_date, get_full_dict, data_dir, log_dir from processors import process_STAMP, process_UP, languages from record_indexing import format_rules bibs = get_full_dict().items() # [e for e in get_full_dict().items() if format_rules['Journal'](e[1])] def match_serial(r): if 'ISSN' in r: issn = r['ISSN'] for (bib_recno, bib) in bibs: if 'NUM' in bib and 'issn' in bib['NUM'].lower() and issn in bib['NUM']: return bib_recno if 'TI' in r: found = [] for (bib_recno, bib) in bibs.items(): if 'TI' in bib and r['TI'].lower().strip() in bib['TI'].lower().strip() and bib['TI'].lower().strip() in r['TI'].lower().strip(): return bib_recno if 'TI' in bib and (r['TI'].lower().strip() in bib['TI'].lower().strip() or bib['TI'].lower().strip() in r['TI'].lower().strip()): found.append((bib_recno, bib)) if len(found) == 1: return found[0][0] raise def process_ROUTE(x): l = split_subfields(x)