diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-04-08 15:59:59 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-04-08 15:59:59 -0700 |
commit | 858147b071103c505bff643e35b503c623f20284 (patch) | |
tree | acfc5cdba1315cf99ae31aac0cf969623e81f1e5 /bin/parse_cord19_csv.py | |
parent | 1552f5dcd8b0abe89f53182c7a495a7b8dc008fc (diff) | |
download | fatcat-covid19-858147b071103c505bff643e35b503c623f20284.tar.gz fatcat-covid19-858147b071103c505bff643e35b503c623f20284.zip |
refactor parse_cord19_csv.py into tool
Diffstat (limited to 'bin/parse_cord19_csv.py')
-rwxr-xr-x | bin/parse_cord19_csv.py | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/bin/parse_cord19_csv.py b/bin/parse_cord19_csv.py deleted file mode 100755 index dbc6cc5..0000000 --- a/bin/parse_cord19_csv.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 - -""" -Trivial helper to transform the CORD-19 CSV file to JSON, and rename a couple -of the column keys. -""" - -import sys -import csv -import json - -CSVFILE = sys.argv[1] - -with open(CSVFILE, newline='') as csvfile: - reader = csv.DictReader(csvfile) - for row in reader: - row = dict(row) - row['mag_id'] = row.pop('Microsoft Academic Paper ID') - row['who_covidence_id'] = row.pop('WHO #Covidence').replace('#', '') - obj = dict(cord19_paper=row) - print(json.dumps(obj, sort_keys=True)) |