Skip to content

Commit 2015d77

Browse files
authored
Merge pull request #138 from Sage-Bionetworks/update-table
[GEN-1424] Make sure 'None' gets read in as a string
2 parents 2ee2d4a + 33f13d8 commit 2015d77

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

scripts/table_updates/update_data_table.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,18 @@ def main():
289289
with open(project_config) as config_file:
290290
cohort_info = json.load(config_file)
291291
logger.info("Read cohort information successful.")
292-
config_file.close()
293292

294293
# get master table
294+
# This is the internal tables with non redacted
295295
table_id, condition = list(TABLE_INFO[table_type])
296296
master_table = download_synapse_table(syn, table_id, condition)
297+
# This contains external tables with redacted
297298
TABLE_INFO["redacted"] = ('syn21446696',"table_type='data' and double_curated is false")
298-
299-
# download data files
300-
# TODO: find the cohort that has new data
299+
300+
# download data files
301+
# TODO: find the cohort that has new data
302+
# This is a mapping to all the intake data. e.g: ProstateBPCIntake_data
303+
# found here: https://www.synapse.org/Synapse:syn23286928
301304
cohort_info_selected = cohort_info[table_type]
302305
cohort_data_list = []
303306
for cohort in cohort_info_selected:

scripts/table_updates/utilities.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def get_data(syn, label_data_id, cohort):
6969
Returns:
7070
Dataframe: label data
7171
"""
72-
label_data = pandas.read_csv(syn.get(label_data_id).path,low_memory=False)
72+
na_values = [" ", "#N/A", "#N/A N/A", "#NA", "-1.#IND", "-1.#QNAN", "-NaN", "-nan", "1.#IND", "1.#QNAN", "<NA>", "N/A", "NA", "NULL", "NaN", "n/a", "nan", "null"]
73+
label_data = pandas.read_csv(syn.get(label_data_id).path, low_memory=False, na_values=na_values, keep_default_na=False)
7374
label_data['cohort'] = cohort
7475
return(label_data)
7576

0 commit comments

Comments
 (0)