srs_metadata_cleaning.py
def curating_metadata(list_of_row_lists):
    """
    Cleans metadata records read into the program
    from input CSV.

    Parameters
    ----------
    list_of_row_lists: list
        A list of the metadata records returned
        from the original CSV.


    Returns
    ----------
    curated_metadata_records: list of lists
        A list of curated metadata data records
        ready to write to a new CSV file.
    """

    curated_metadata_records = []

    for row in list_of_row_lists:
        full_title = row[1]
        full_title = full_title.strip()

        if full_title.startswith("A ") == True:
            title_prefix = "A"
        elif full_title.startswith("An ") == True:
            title_prefix = "An"
        elif full_title.startswith("The ") == True:
            title_prefix = "The"
        else:
            title_prefix = ""


        if ":" in full_title:
            split_full_title_list = full_title.split(":")
            if len(split_full_title_list) == 2:
                main_title = split_full_title_list[0]
                subtitle = split_full_title_list[1].strip()

            else:
                main_title = split_full_title_list[0]
                subtitle = ":".join(split_full_title_list[1:])


        else:
            main_title = full_title
            subtitle = ""


        uri = row[0]
        marc_main_title = row[2]
        marc_subtitle = row[3]
        edition = row[4]
        copyright_ocr = row[5]

        metadata_record = [uri, full_title, main_title, subtitle, marc_main_title, marc_subtitle, title_prefix, edition, copyright_ocr]

        curated_metadata_records.append(metadata_record)

    return curated_metadata_records

    Cleans metadata records read into the program
    from input CSV.

    Parameters
    ----------
    list_of_row_lists: list
        A list of the metadata records returned
        from the original CSV.


    Returns
    ----------
    curated_metadata_records: list of lists
        A list of curated metadata data records
        ready to write to a new CSV file.
    
Cleans metadata records read into the program
from input CSV.
Cleans metadata records read into the program from input CSV .
def curating_metadata(list_of_row_lists):
    curated_metadata_records = []
    for row in list_of_row_lists:
        full_title = row[1]
        full_title = full_title.strip()
        if full_title.startswith("A ") == True:
            title_prefix = "A"
        elif full_title.startswith("An ") == True:
            title_prefix = "An"
        elif full_title.startswith("The ") == True:
            title_prefix = "The"
        else:
            title_prefix = ""
        if ":" in full_title:
            split_full_title_list = full_title.split(":")
            if len(split_full_title_list) == 2:
                main_title = split_full_title_list[0]
                subtitle = split_full_title_list[1].strip()
            else:
                main_title = split_full_title_list[0]
                subtitle = ":".join(split_full_title_list[1:])
        else:
            main_title = full_title
            subtitle = ""
        uri = row[0]
        marc_main_title = row[2]
        marc_subtitle = row[3]
        edition = row[4]
        copyright_ocr = row[5]
        metadata_record = [uri, full_title, main_title, subtitle, marc_main_title, marc_subtitle, title_prefix, edition, copyright_ocr]
        curated_metadata_records.append(metadata_record)
    return curated_metadata_records
def curating_metadata ( list_of_row_lists ) : curated_metadata_records = [ ] for row in list_of_row_lists : full_title = row [ 1 ] full_title = full_title . strip ( ) if full_title . startswith ( "A " ) == True : title_prefix = "A" elif full_title . startswith ( "An " ) == True : title_prefix = "An" elif full_title . startswith ( "The " ) == True : title_prefix = "The" else : title_prefix = "" if ":" in full_title : split_full_title_list = full_title . split ( ":" ) if len ( split_full_title_list ) == 2 : main_title = split_full_title_list [ 0 ] subtitle = split_full_title_list [ 1 ] . strip ( ) else : main_title = split_full_title_list [ 0 ] subtitle = ":" . join ( split_full_title_list [ 1 : ] ) else : main_title = full_title subtitle = "" uri = row [ 0 ] marc_main_title = row [ 2 ] marc_subtitle = row [ 3 ] edition = row [ 4 ] copyright_ocr = row [ 5 ] metadata_record = [ uri , full_title , main_title , subtitle , marc_main_title , marc_subtitle , title_prefix , edition , copyright_ocr ] curated_metadata_records . append ( metadata_record ) return curated_metadata_records
Cleans metadata records read into the program
from input CSV.
Cleans metadata records read into the program from input CSV .
"""
    Cleans metadata records read into the program
    from input CSV.

    Parameters
    ----------
    list_of_row_lists: list
        A list of the metadata records returned
        from the original CSV.


    Returns
    ----------
    curated_metadata_records: list of lists
        A list of curated metadata data records
        ready to write to a new CSV file.
    """
list_of_row_lists
A list of the metadata records returned
from the original CSV.
A list of the metadata records returned from the original CSV .
Returns

None
----------

None
curated_metadata_records
A list of curated metadata data records
ready to write to a new CSV file.
A list of curated metadata data records ready to write to a new CSV file .