From aebd38b277ec5f78e19d5bbe4aec60f44f4d965f Mon Sep 17 00:00:00 2001 From: dbkeator Date: Tue, 27 Aug 2024 14:05:25 -0700 Subject: [PATCH] fixed bug if no -json_map nor -csv_map was supplied, errored out whereas it should just continue and ask user to annotate --- src/nidm/experiment/tools/csv2nidm.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/nidm/experiment/tools/csv2nidm.py b/src/nidm/experiment/tools/csv2nidm.py index abe0f2a..955a618 100644 --- a/src/nidm/experiment/tools/csv2nidm.py +++ b/src/nidm/experiment/tools/csv2nidm.py @@ -8,7 +8,6 @@ from argparse import ArgumentParser from io import StringIO -import json import logging import os from os.path import basename, dirname, join @@ -306,18 +305,16 @@ def main(): json_map = redcap_datadictionary_to_json(args.redcap, basename(args.csv_file)) elif args.json_map: json_map = args.json_map - else: + elif args.csv_map: if ".csv" in args.csv_map: # convert csv_map to a json version json_map = csv_dd_to_json_dd(args.csv_map) - # load existing json file - with open("/Users/dbkeator/Downloads/test_json.json", "w") as f: - json.dump(json_map, f) else: print("ERROR: -csv_map parameter must be a CSV file with .csv extension...") sys.exit(-1) - + else: + json_map = None # open CSV file and load into # DBK added to accommodate TSV files with tab separator 3/15/21 if args.csv_file.endswith(".csv"): @@ -485,7 +482,7 @@ def main(): # f.write(project.serializeTurtle()) id_field = detect_idfield(column_to_terms) - + # if we couldn't find a subject ID field in column_to_terms, ask user if id_field is None: # ask user for id field