| """ | |
| Comorbidities processing utilities | |
| """ | |
| import pandas as pd | |
| def diagnosis_mapping_lists(excel_file, sheet_name, diagnosis_names): | |
| """ | |
| Create mapping between diagnoses and comorbidities | |
| -------- | |
| :param excel_file: str filename for diagnosis mapping | |
| :param sheet_name: str sheet name for diagnosis mapping | |
| :param diagnosis_names: str list of diagnoses | |
| :return: dictionary of diagnosis names and values | |
| """ | |
| df_diag = pd.read_excel(excel_file, sheet_name, skiprows=range(0, 1)) | |
| df_lists = df_diag.T.values.tolist() | |
| diag_lists = [[s.strip() for s in x if pd.notna(s)] for x in df_lists] | |
| return dict(zip(diagnosis_names, diag_lists)) | |