Skip to content

Commit

Permalink
NiFi: cohort script update.
Browse files Browse the repository at this point in the history
  • Loading branch information
vladd-bit committed Jul 5, 2024
1 parent f4fb7c9 commit 908d2ff
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions nifi/user-scripts/cogstack_cohort_generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def _process_patient_records(patient_records: list):
dob = int(dob)
except ValueError:
dob = str(dob).replace("\"", "").replace("'", "")

try:
dod = int(dod)
except ValueError:
Expand Down Expand Up @@ -301,11 +301,17 @@ def multiprocess_annotation_records(doc2ptt: dict, input_annotations: dict):
with open(f_path, mode="r+") as f:
contents = json.loads(f.read())
_doc2ptt, _ptt2dod, _ptt2age, _ptt2dob, _ptt2eth, _ptt2sex = multiprocess_patient_records(contents)
dict2json_truncate_add_to_file(_ptt2sex, os.path.join(OUTPUT_FOLDER_PATH, "ptt2sex.json"))
dict2json_truncate_add_to_file(_ptt2eth, os.path.join(OUTPUT_FOLDER_PATH, "ptt2eth.json"))
dict2json_truncate_add_to_file(_ptt2dob, os.path.join(OUTPUT_FOLDER_PATH, "ptt2dob.json"))
dict2json_truncate_add_to_file(_ptt2dod, os.path.join(OUTPUT_FOLDER_PATH, "ptt2dod.json"))
dict2json_truncate_add_to_file(_ptt2age, os.path.join(OUTPUT_FOLDER_PATH, "ptt2age.json"))

if _ptt2sex != {}:
dict2json_truncate_add_to_file(_ptt2sex, os.path.join(OUTPUT_FOLDER_PATH, "ptt2sex.json"))
if _ptt2eth != {}:
dict2json_truncate_add_to_file(_ptt2eth, os.path.join(OUTPUT_FOLDER_PATH, "ptt2eth.json"))
if _ptt2dob != {}:
dict2json_truncate_add_to_file(_ptt2dob, os.path.join(OUTPUT_FOLDER_PATH, "ptt2dob.json"))
if _ptt2dod != {}:
dict2json_truncate_add_to_file(_ptt2dod, os.path.join(OUTPUT_FOLDER_PATH, "ptt2dod.json"))
if _ptt2age != {}:
dict2json_truncate_add_to_file(_ptt2age, os.path.join(OUTPUT_FOLDER_PATH, "ptt2age.json"))

global_doc2ptt.update(_doc2ptt)

Expand Down

0 comments on commit 908d2ff

Please sign in to comment.