aboutsummaryrefslogtreecommitdiffstats
path: root/covid19_tool.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-04-03 15:13:43 -0700
committerBryan Newbold <bnewbold@archive.org>2020-04-03 15:13:43 -0700
commit328892b0e571395fbbf8a22ca8a4216c6cf71074 (patch)
tree77a7b3565d1c876eb2035192c9bc125d573caab8 /covid19_tool.py
parent7bf8ae73b8b5dfca4d17f353cdbec669e69bbbec (diff)
downloadfatcat-covid19-328892b0e571395fbbf8a22ca8a4216c6cf71074.tar.gz
fatcat-covid19-328892b0e571395fbbf8a22ca8a4216c6cf71074.zip
refactor enrich into fatcat_covid19
Diffstat (limited to 'covid19_tool.py')
-rwxr-xr-xcovid19_tool.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/covid19_tool.py b/covid19_tool.py
index 1cf8dce..e984c28 100755
--- a/covid19_tool.py
+++ b/covid19_tool.py
@@ -70,14 +70,26 @@ def main():
type=argparse.FileType('r'),
default=sys.stdout)
+ sub_enrich_fatcat = subparsers.add_parser('enrich-fatcat',
+ help="lookup fatcat releases from JSON metadata")
+ sub_enrich_fatcat.add_argument('json_file',
+ help="input JSON rows file (eg, CORD-19 parsed JSON)",
+ type=argparse.FileType('r'))
+ sub_enrich_fatcat.add_argument('--json-output',
+ help="file to write to",
+ type=argparse.FileType('r'),
+ default=sys.stdout)
+
args = parser.parse_args()
if args.action == 'webface':
app.run(debug=args.debug, host=args.host, port=args.port)
- if args.action == 'derivatives':
+ elif args.action == 'derivatives':
enrich_derivatives_file(args.json_file, args.json_output,
args.base_dir)
- if args.action == 'transform-es':
+ elif args.action == 'transform-es':
+ transform_es_file(args.json_file, args.json_output)
+ elif args.action == 'enrich-fatcat':
transform_es_file(args.json_file, args.json_output)
else:
print("tell me what to do!")