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

Commited changes to make the code more efficient and reduce complexity. #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions Final_Code/Medication.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ def save_obj(obj, name):
feverDrugs = ['paracetamol', 'acetaminophen', 'ibuprofen', 'tylenol', 'advil', 'aspirin', 'motrin', 'naproxen', 'aleve', 'bayer', 'aspirin', 'ibu']
for i in range(len(df)):

if dt.get(df.iloc[i]['patientunitstayid'], [0,0])[0]==0:
if dt.get(df.iloc[i]['patientunitstayid'])=="None":

drugs = df.iloc[i]['drugname'].split()
drugs = [drug.lower() for drug in drugs]
if sum([int(feverDrug==drug) for feverDrug in feverDrugs for drug in drugs])>0:
dt[df.iloc[i]['patientunitstayid']] = [1, df.iloc[i]['drugstartoffset']]
drug = (df.iloc[i]['drugname'].split()[0]).lower()

if drug in feverDrugs:
dt[df.iloc[i]['patientunitstayid']] = [df.iloc[i]['drugstartoffset']]

print('Done')