cofdb_submit/main.py
def mint_paper_id(doi, year):
    """Check if the paper is already in cof-papers.csv (same DOI) and print that value,
    otherwise assign the new paper ID.
    """

    papers_df = get_papers_df()

    if doi in papers_df['DOI'].values:
        return str(papers_df[papers_df['DOI'] == doi]['CURATED-COFs paper ID'].values[0]) + " (already present)"

    id_year = sorted(papers_df[papers_df['CURATED-COFs paper ID'].str.contains("p"+year[2:])]['CURATED-COFs paper ID'])
    if len(id_year)==0:
        counter = 0
    else:
        last_id_year = id_year[-1]
        last_counter_year = int(last_id_year[3:5])
        counter = last_counter_year + 1

    return "p{:s}{:02d}".format(year[2:], counter)
Check if the paper is already in cof-papers.csv (same DOI) and print that value,
    otherwise assign the new paper ID.
    
Check if the paper is already in cof-papers.csv (same DOI) and print that value,
otherwise assign the new paper ID.
Check if the paper is already in cof - papers . csv ( same DOI ) and print that value otherwise assign the new paper ID .
def mint_paper_id(doi, year):
    papers_df = get_papers_df()
    if doi in papers_df['DOI'].values:
        return str(papers_df[papers_df['DOI'] == doi]['CURATED-COFs paper ID'].values[0]) + " (already present)"
    id_year = sorted(papers_df[papers_df['CURATED-COFs paper ID'].str.contains("p"+year[2:])]['CURATED-COFs paper ID'])
    if len(id_year)==0:
        counter = 0
    else:
        last_id_year = id_year[-1]
        last_counter_year = int(last_id_year[3:5])
        counter = last_counter_year + 1
    return "p{:s}{:02d}".format(year[2:], counter)
def mint_paper_id ( doi , year ) : papers_df = get_papers_df ( ) if doi in papers_df [ 'DOI' ] . values : return str ( papers_df [ papers_df [ 'DOI' ] == doi ] [ 'CURATED-COFs paper ID' ] . values [ 0 ] ) + " (already present)" id_year = sorted ( papers_df [ papers_df [ 'CURATED-COFs paper ID' ] . str . contains ( "p" + year [ 2 : ] ) ] [ 'CURATED-COFs paper ID' ] ) if len ( id_year ) == 0 : counter = 0 else : last_id_year = id_year [ - 1 ] last_counter_year = int ( last_id_year [ 3 : 5 ] ) counter = last_counter_year + 1 return "p{:s}{:02d}" . format ( year [ 2 : ] , counter )
Check if the paper is already in cof-papers.csv (same DOI) and print that value,
otherwise assign the new paper ID.
Check if the paper is already in cof - papers . csv ( same DOI ) and print that value otherwise assign the new paper ID .
"""Check if the paper is already in cof-papers.csv (same DOI) and print that value,
    otherwise assign the new paper ID.
    """
doi
year