Skip to content

Instantly share code, notes, and snippets.

@rosiecakes
Last active January 9, 2017 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosiecakes/f1d064fb26cb1e6298e72e78ad8d5474 to your computer and use it in GitHub Desktop.
Save rosiecakes/f1d064fb26cb1e6298e72e78ad8d5474 to your computer and use it in GitHub Desktop.
leftover ecw reminder stuff
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