diff options
Diffstat (limited to 'scripts/parse_cord19_csv.py')
-rwxr-xr-x | scripts/parse_cord19_csv.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/parse_cord19_csv.py b/scripts/parse_cord19_csv.py new file mode 100755 index 0000000..536e5d3 --- /dev/null +++ b/scripts/parse_cord19_csv.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +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('#', '') + print(json.dumps(row, sort_keys=True)) |