Created
January 15, 2019 16:32
-
-
Save tom-montgomery/0af2bd7d3f584039101ca39b9c69a78f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if update is False: | |
# figure out next doi suffix to use if new | |
department_dois = doi_assets.loc[doi_assets['department'] == metadata['department'].item()] | |
if len(department_dois) != 0: | |
# add 1 to highest suffix value and use zfill to pad w/zeros to 6 chars | |
doi_suffix = str((department_dois['doi_suffix'].max()+1)).zfill(6) | |
else: | |
# new doi for dept, start at 000001 | |
doi_suffix = str(1).zfill(6) | |
# zfill dept prefix to 3 chars | |
doi = '10.26000/{}.{}'.format(str(dept_prefix.index[0]).zfill(3), doi_suffix) | |
else: | |
# find existing doi for update | |
doi = doi_assets.loc[doi_assets['socrata_4x4'] == socrata_4x4]['doi'].item() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment