Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/HealthRex/CDSS
Browse files Browse the repository at this point in the history
  • Loading branch information
jonc101 committed Aug 2, 2024
2 parents 23c5888 + 4543f56 commit 0d51eff
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
36 changes: 36 additions & 0 deletions scripts/cost_variability_2024/scripts/pipeline/combine_tab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import pandas as pd
import numpy as np
import os

def res_fold(to_res, out):
return [i for i in os.listdir(to_res) if i.startswith(f'res_{out}')][0]

class comb_tab:
def __init__(self, to_res, comb):
self.comb = comb
self.to_res = to_res
self.folder = {'hi': f'{to_res}/{res_fold(to_res, 'hi')}/{self.comb}', 'lo': f'{to_res}/{res_fold(to_res, 'lo')}/{self.comb}'}
self.file_names_hi = os.listdir(self.folder['hi'])
self.file_names_lo = os.listdir(self.folder['lo'])

def combine(self):
dfs = []
for file_name in self.file_names_hi:
for out in ['hi', 'lo']:
drg_no = ''.join([char for char in file_name if char.isdigit()])
df = pd.read_csv(os.path.join(self.folder[out], file_name))
df['drg_no'] = drg_no
df['outlier'] = out
dfs.append(df)
self.df = pd.concat(dfs).sort_values(by='odds_ratio', ascending=False)

def export(self):
if not os.path.exists('scripts/pipeline/res/res_comb'):
os.makedirs(f'{self.to_res}/res_comb')
self.df.to_csv(f'{self.to_res}/res_comb/res_{self.comb}.csv', index=False)

comp_list = ['comp_medorderset', 'comp_proc', 'comp_diag', 'comp_procorderset', 'comp_med']
for comp in comp_list:
comb = comb_tab('scripts/pipeline/res', comp)
comb.combine()
comb.export()
64 changes: 64 additions & 0 deletions scripts/cost_variability_2024/scripts/pipeline/export.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: comb_tab
channels:
- conda-forge
- defaults
dependencies:
- appnope=0.1.4=pyhd8ed1ab_0
- asttokens=2.4.1=pyhd8ed1ab_0
- bzip2=1.0.8=h80987f9_6
- ca-certificates=2024.7.4=hf0a4a13_0
- comm=0.2.2=pyhd8ed1ab_0
- debugpy=1.6.7=py312h313beb8_0
- decorator=5.1.1=pyhd8ed1ab_0
- exceptiongroup=1.2.2=pyhd8ed1ab_0
- executing=2.0.1=pyhd8ed1ab_0
- expat=2.6.2=h313beb8_0
- importlib-metadata=8.2.0=pyha770c72_0
- importlib_metadata=8.2.0=hd8ed1ab_0
- ipykernel=6.29.5=pyh57ce528_0
- ipython=8.26.0=pyh707e725_0
- jedi=0.19.1=pyhd8ed1ab_0
- jupyter_client=8.6.2=pyhd8ed1ab_0
- jupyter_core=5.7.2=py312hca03da5_0
- libcxx=14.0.6=h848a8c0_0
- libffi=3.4.4=hca03da5_1
- libsodium=1.0.18=h27ca646_1
- matplotlib-inline=0.1.7=pyhd8ed1ab_0
- ncurses=6.4=h313beb8_0
- nest-asyncio=1.6.0=pyhd8ed1ab_0
- openssl=3.3.1=hfb2fe0b_2
- packaging=24.1=pyhd8ed1ab_0
- parso=0.8.4=pyhd8ed1ab_0
- pexpect=4.9.0=pyhd8ed1ab_0
- pickleshare=0.7.5=py_1003
- pip=24.0=py312hca03da5_0
- platformdirs=4.2.2=pyhd8ed1ab_0
- prompt-toolkit=3.0.47=pyha770c72_0
- psutil=5.9.0=py312h80987f9_0
- ptyprocess=0.7.0=pyhd3deb0d_0
- pure_eval=0.2.3=pyhd8ed1ab_0
- pygments=2.18.0=pyhd8ed1ab_0
- python=3.12.4=h99e199e_1
- python-dateutil=2.9.0=pyhd8ed1ab_0
- pyzmq=25.1.2=py312h313beb8_0
- readline=8.2=h1a28f6b_0
- setuptools=69.5.1=py312hca03da5_0
- six=1.16.0=pyh6c4a22f_0
- sqlite=3.45.3=h80987f9_0
- stack_data=0.6.2=pyhd8ed1ab_0
- tk=8.6.14=h6ba3021_0
- tornado=6.4.1=py312h80987f9_0
- traitlets=5.14.3=pyhd8ed1ab_0
- typing_extensions=4.12.2=pyha770c72_0
- wcwidth=0.2.13=pyhd8ed1ab_0
- wheel=0.43.0=py312hca03da5_0
- xz=5.4.6=h80987f9_1
- zeromq=4.3.5=h313beb8_0
- zipp=3.19.2=pyhd8ed1ab_0
- zlib=1.2.13=h18a0788_1
- pip:
- numpy==2.0.1
- pandas==2.2.2
- pytz==2024.1
- tzdata==2024.1
prefix: /opt/anaconda3/envs/comb_tab

0 comments on commit 0d51eff

Please sign in to comment.