Update dataset_utils.py
Browse files- dataset_utils.py +6 -1
dataset_utils.py
CHANGED
|
@@ -85,6 +85,11 @@ def concat_data(data,interval,feat_cond,feat_proc,feat_out,feat_chart,feat_meds,
|
|
| 85 |
charts = data['Chart']
|
| 86 |
cond= data['Cond']['fids']
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
#demographic
|
| 89 |
demo=pd.DataFrame(columns=['Age','gender','ethnicity','label','insurance'])
|
| 90 |
new_row = {'Age': data['age'], 'gender': data['gender'], 'ethnicity': data['ethnicity'], 'label': data['label'], 'insurance': data['insurance']}
|
|
@@ -260,7 +265,7 @@ def generate_text(data,icd,items,feat_cond,feat_chart,feat_meds, feat_proc, feat
|
|
| 260 |
conds = data.get('Cond', {}).get('fids', [])
|
| 261 |
conds=[icd[icd['icd_code'] == code]['long_title'].to_string(index=False) for code in conds if not icd[icd['icd_code'] == code].empty]
|
| 262 |
cond_text = '; '.join(conds)
|
| 263 |
-
cond_text = f"The patient {ethn} {gender}, {age} years old, covered by {ins} was diagnosed with {cond_text}. " if cond_text else ''
|
| 264 |
else:
|
| 265 |
cond_text = ''
|
| 266 |
|
|
|
|
| 85 |
charts = data['Chart']
|
| 86 |
cond= data['Cond']['fids']
|
| 87 |
|
| 88 |
+
proc_df=pd.DataFrame()
|
| 89 |
+
out_df=pd.DataFrame()
|
| 90 |
+
cond_df=pd.DataFrame()
|
| 91 |
+
chart_df=pd.DataFrame()
|
| 92 |
+
meds_df=pd.DataFrame()
|
| 93 |
#demographic
|
| 94 |
demo=pd.DataFrame(columns=['Age','gender','ethnicity','label','insurance'])
|
| 95 |
new_row = {'Age': data['age'], 'gender': data['gender'], 'ethnicity': data['ethnicity'], 'label': data['label'], 'insurance': data['insurance']}
|
|
|
|
| 265 |
conds = data.get('Cond', {}).get('fids', [])
|
| 266 |
conds=[icd[icd['icd_code'] == code]['long_title'].to_string(index=False) for code in conds if not icd[icd['icd_code'] == code].empty]
|
| 267 |
cond_text = '; '.join(conds)
|
| 268 |
+
cond_text = f"The patient ({ethn} {gender}, {age} years old, covered by {ins}) was diagnosed with {cond_text}. " if cond_text else ''
|
| 269 |
else:
|
| 270 |
cond_text = ''
|
| 271 |
|