Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed bug if no -json_map nor -csv_map was supplied, errored out wher… #405

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/nidm/experiment/tools/csv2nidm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"):
Expand Down Expand Up @@ -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
Expand Down
Loading