示例#1
0
def move_939_fatadb(record):
    """For FATADB records, remove 963 field and move 939 to 963"""
    for old_fld in record.get_fields("963"):
        remove_field_safe(record, old_fld)
    for fld in record.get_fields("939"):
        new_tag = "963"
        move_field_safe(record, fld, new_tag)
示例#2
0
def move_6xx(record):
    """Move various 6xx fields, which used to be in change_CLU()"""
    # Functionally the same as move_9xx, but isolating since last-minute change
    field_mapping = {
        "692": "696",
        "693": "697",
        "699": "695",
    }
    for old_tag in field_mapping.keys():
        new_tag = field_mapping[old_tag]
        for fld in record.get_fields(old_tag):
            move_field_safe(record, fld, new_tag)
示例#3
0
def move_9xx(record):
    """Move various 9xx fields"""
    field_mapping = {
        "901": "966",
        "910": "951",
        "916": "964",
        "935": "992",
        "936": "986",
        "948": "962"
    }
    for old_tag in field_mapping.keys():
        new_tag = field_mapping[old_tag]
        for fld in record.get_fields(old_tag):
            move_field_safe(record, fld, new_tag)
示例#4
0
def change_CLU(record):
    """Change field when original field's $5 starts with CLU"""
    field_mapping = {
        "500": "590",
        "501": "590",
        "506": "596",
        "540": "597",
        "541": "594",
        "561": "591",
        "563": "593",
        "655": "694",
        "692": "696",
        "693": "697",
        "699": "695",
        "700": "970",
        "710": "971",
        "730": "973",
        "740": "974",
    }
    for old_tag in field_mapping.keys():
        new_tag = field_mapping[old_tag]
        for fld in record.get_fields(old_tag):
            if fld["5"] is not None and fld["5"].startswith("CLU"):
                move_field_safe(record, fld, new_tag)
示例#5
0
def test_move_field_safe(record):
    for fld in record.get_fields('500'):
        move_field_safe(record, fld, '995')