srs_metadata_cleaning.py
def write_curated_metadata(curated_metadata_records, filename_1):
    """
    Cleans metadata records read into the program from input CSV.

    Source for help constructing this function:
    Jon Fincher, "Reading and Writing CSV Files in Python,"
    Real Python, accessed October 13, 2020,
    https://realpython.com/python-csv/

    Parameters
    ----------
    curated_metadata_records: list of lists
        The list of curated metadata records to be written
        to the desired CSV file.

    filename_1: string
        The desired CSV file to which to write the
        curated metadata records.

    Returns
    ----------
    filename_1: CSV
        A spreadsheet file with the curated metadata records.

    """

    with open(filename_1, 'w', encoding = 'utf-8') as csv_file:

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

        writer = csv.DictWriter(csv_file, fieldnames = fieldnames)

        writer.writeheader()

        for record in curated_metadata_records:

            writer.writerow({"uri": record[0], "full_title": record[1], "main_title": record[2], "subtitle": record[3],
            "marc_main_title": record[4], "marc_subtitle": record[5], "title_prefix": record[6],
            "edition": record[7], "copyright_ocr": record[8]})

        return filename_1

    Cleans metadata records read into the program from input CSV.

    Source for help constructing this function:
    Jon Fincher, "Reading and Writing CSV Files in Python,"
    Real Python, accessed October 13, 2020,
    https://realpython.com/python-csv/

    Parameters
    ----------
    curated_metadata_records: list of lists
        The list of curated metadata records to be written
        to the desired CSV file.

    filename_1: string
        The desired CSV file to which to write the
        curated metadata records.

    Returns
    ----------
    filename_1: CSV
        A spreadsheet file with the curated metadata records.

    
Cleans metadata records read into the program from input CSV.
Cleans metadata records read into the program from input CSV .
def write_curated_metadata(curated_metadata_records, filename_1):
    with open(filename_1, 'w', encoding = 'utf-8') as csv_file:
        fieldnames = ["uri", "full_title", "main_title", "subtitle",
        "marc_main_title", "marc_subtitle", "title_prefix", "edition", "copyright_ocr",]
        writer = csv.DictWriter(csv_file, fieldnames = fieldnames)
        writer.writeheader()
        for record in curated_metadata_records:
            writer.writerow({"uri": record[0], "full_title": record[1], "main_title": record[2], "subtitle": record[3],
            "marc_main_title": record[4], "marc_subtitle": record[5], "title_prefix": record[6],
            "edition": record[7], "copyright_ocr": record[8]})
        return filename_1
def write_curated_metadata ( curated_metadata_records , filename_1 ) : with open ( filename_1 , 'w' , encoding = 'utf-8' ) as csv_file : fieldnames = [ "uri" , "full_title" , "main_title" , "subtitle" , "marc_main_title" , "marc_subtitle" , "title_prefix" , "edition" , "copyright_ocr" , ] writer = csv . DictWriter ( csv_file , fieldnames = fieldnames ) writer . writeheader ( ) for record in curated_metadata_records : writer . writerow ( { "uri" : record [ 0 ] , "full_title" : record [ 1 ] , "main_title" : record [ 2 ] , "subtitle" : record [ 3 ] , "marc_main_title" : record [ 4 ] , "marc_subtitle" : record [ 5 ] , "title_prefix" : record [ 6 ] , "edition" : record [ 7 ] , "copyright_ocr" : record [ 8 ] } ) return filename_1
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.

    Source for help constructing this function:
    Jon Fincher, "Reading and Writing CSV Files in Python,"
    Real Python, accessed October 13, 2020,
    https://realpython.com/python-csv/

    Parameters
    ----------
    curated_metadata_records: list of lists
        The list of curated metadata records to be written
        to the desired CSV file.

    filename_1: string
        The desired CSV file to which to write the
        curated metadata records.

    Returns
    ----------
    filename_1: CSV
        A spreadsheet file with the curated metadata records.

    """
curated_metadata_records
The list of curated metadata records to be written
to the desired CSV file.
The list of curated metadata records to be written to the desired CSV file .
filename_1
A spreadsheet file with the curated metadata records.
A spreadsheet file with the curated metadata records .
Returns

None
----------

None