<jupyter_start><jupyter_text>Outpatient<jupyter_code>cd C:\\Users\\Joyqiao\\Documents\\CMU\\RA\\HIGHMARK Trajectory claim\\HIghmark Project\\data\\cleaned_data
 pd.read_csv('cleaned_1.csv').columns
proc_cost = pd.DataFrame()
for i in range(17):
    clean = pd.read_csv('cleaned_{}.csv'.format(str(i)))
    g = clean.groupby(['TMA_Acct','claim_type','proc_code','proc_code_format'])['eacl_prv_alcrg_at'].sum().reset_index()
    proc_cost = pd.concat([proc_cost,g],axis = 0)<jupyter_output>C:\Users\Joyqiao\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:3063: DtypeWarning: Columns (10,12,13,14,15,16,17,18,19,20,21,23,25,37,39,41,42,43,44,45,46,47,48,49,52,53) have mixed types.Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)
C:\Users\Joyqiao\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:3063: DtypeWarning: Columns (10,12,13,14,15,16,17,18,19,20,21,23,25,36,37,38,39,40,41,42,43,44,45,46,47,48,49,52,53) have mixed types.Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)
C:\Users\Joyqiao\anaconda3\lib\site-packages\IPython\core\interactiveshell.py:3063: DtypeWarning: Columns (10,12,13,14,15,16,17,18,19,20,21,23,25,37,38,39,40,41,42,43,44,45,46,47,48,49,52,53) have mixed types.Specify dtype option on import or set low_memory=False.
  interactivity=interactivity, compiler=compiler, result=result)
C:\Users\Joyq[...]<jupyter_text>Iterate by cluster<jupyter_code>cd C:\\Users\\Joyqiao\\Documents\\CMU\\RA\\HIGHMARK Trajectory claim\\HIghmark Project\\data
hcpc_doc = pd.read_excel('HCPC2021_JAN_TRANS_ANWEB.xlsx',sheet_name = 0)
def top_proc_cost(claim_type,cluster):
    cluster_selected = proc_cost.loc[proc_cost['TMA_Acct'].isin(tma_cluster_dict[cluster]),:]
    claim_type_selected = cluster_selected.loc[cluster_selected['claim_type'] == claim_type,:]
    top_cost_proc = claim_type_selected.groupby(['proc_code','proc_code_format'])['eacl_prv_alcrg_at'].sum().reset_index()
    top_cost_proc.sort_values(by ='eacl_prv_alcrg_at',ascending = False,inplace = True)
    merged_top_cost_proc = top_cost_proc.merge(hcpc_doc,how = 'left',left_on = 'proc_code',right_on = 'HCPC')
    return merged_top_cost_proc<jupyter_output><empty_output><jupyter_text>CLUSTER 5 OUTPATIENT<jupyter_code>proc_cost.claim_type.unique()
top_cost_proc = top_proc_cost('O',5)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('O',4)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('O',3)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('O',2)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('O',1)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('P',5)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('P',4)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('P',3)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('P',2)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('P',1)
top_cost_proc.head(10)
top_cost_proc = top_proc_cost('DR',1)
top_cost_proc.head(10)
#out of all the patients, what is the most common diagnosis(in terms of unique patient )
common_diagnosis_patient = pd.DataFrame()
for i in range(17):
    clean = pd.read_csv('cleaned_{}.csv'.format(str(i)))
    g = clean.groupby(['TMA_Acct','claim_type','pri_diag_cd','prim_diag_qfr_cd'])['eacl_prv_alcrg_at'].sum().reset_index()
    proc_cost = pd.concat([proc_cost,g],axis = 0)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15531177829099307, 'fraction_numerical': 0.06553117782909931, 'mean_word_length': 8.415760869565217, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '338222', 'license': 'MIT', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1401, 'n_words': 162, 'path': 'Claim/cluster_result_analysis/top_costly_procedures.ipynb', 'repo_name': 'piapiaQ/Highmark', 'size': '3464'}