-
-
Save rosiecakes/f1d064fb26cb1e6298e72e78ad8d5474 to your computer and use it in GitHub Desktop.
leftover ecw reminder stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
res_depts = [] | |
res_depts = {d.split(' ')[0] for d in resdf['reason'] if d.split(' ')[0] not in res_depts} | |
# bad practice but fun | |
def split_results_per_dept(df): | |
"""Take all results, and create a dataframe for each dept | |
with that departments rows. Add to dictionary | |
""" | |
dept_DFS = {} | |
for dept in res_depts: | |
if not df[df['reason'].str.contains(dept)].empty: | |
exec('df_{} = new_df'.format(dept)) | |
exec('dept_DFS["df_{}"] = df_{}'.format(dept, dept)) | |
_split_intake_tx_discharge('dept_DFS["df_{}"]'.format(dept)) | |
else: | |
print('No departments found in results') | |
try: | |
find_dept_reminder_rules(dept_DFS) | |
except: | |
pass | |
def _split_intake_tx_discharge(df): | |
"""Splits dataframe into intake, treatment plan, and discharge""" | |
dataframes = {} | |
dataframes['intakes'] = df[df['reason'].str.contains('intake')] | |
dataframes['txplans'] = df[df['reason'].str.contains('treatment|tx')] | |
dataframes['dischgs'] = df[df['reason'].str.contains('discharge')] | |
return dataframes | |
def find_dept_reminder_rules(dept_DFS): | |
"""Loop through dataframes to decide what to do""" | |
for dept in dept_df_names: | |
if dept in dept_dfs: | |
run_23_75_reminder(dept_dfs[dept]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment