diff --git a/ingest/cmd/build_curl_command.py b/ingest/cmd/build_curl_command.py index 7d46b0872..e81bb83e0 100644 --- a/ingest/cmd/build_curl_command.py +++ b/ingest/cmd/build_curl_command.py @@ -2,18 +2,18 @@ To build curl commands from copy pasted forms from the biobank website """ +import sys FORM_TEXT = """
- - - - - - -
+ + + + + + + """ @@ -61,5 +61,14 @@ def fields_to_curl(name, action, id, s, t, i, v): def txt_to_curl(name, txt): return fields_to_curl(name, **get_fields(txt)) +# check to see if an argument was provided (single argument with path to form text in a file) +if len(sys.argv) > 1: + try: + with open (sys.argv[1], "r") as form_text_file: + FORM_TEXT = form_text_file.read() + except: + print(f'This program expects the input argument, if provided, to be a path') + print(f'to a file containing the form data from the ukbiobank website.') + exit(1) print(txt_to_curl(NAME, FORM_TEXT))