pycomorb 0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,95 @@
1
+ # Reference for GCI:
2
+ # 1. Gagne JJ, Glynn RJ, Avorn J, Levin R, Schneeweiss S.
3
+ # A combined comorbidity score predicted mortality in elderly patients better than existing scores.
4
+ # J Clin Epidemiol. 2011 Jul;64(7):749-59.
5
+ # doi: 10.1016/j.jclinepi.2010.10.004. Epub 2011 Jan 5. PMID: 21208778; PMCID: PMC3100405.
6
+ #
7
+ # Reference for source ICD-9-CM Coding Algorithms:
8
+ # 2. Romano PS, Roos LL, Jollis JG.
9
+ # Adapting a clinical comorbidity index for use with ICD-9-CM administrative data: differing perspectives.
10
+ # J Clin Epidemiol. 1993 Oct;46(10):1075-9; discussion 1081-90.
11
+ # doi: 10.1016/0895-4356(93)90103-8. PMID: 8410092.
12
+ # 3. Quan H, Sundararajan V, Halfon P, Fong A, Burnand B, Luthi JC, Saunders LD, Beck CA, Feasby TE, Ghali WA.
13
+ # Coding algorithms for defining comorbidities in ICD-9-CM and ICD-10 administrative data.
14
+ # Med Care. 2005 Nov;43(11):1130-9.
15
+ # doi: 10.1097/01.mlr.0000182534.19832.83. PMID: 16224307.
16
+ #
17
+ # Reference for ICD-9 / ICD-10 mapping:
18
+ # 4. Sun JW, Rogers JR, Her Q, Welch EC, Panozzo CA, Toh S, Gagne JJ.
19
+ # Adaptation and Validation of the Combined Comorbidity Score for ICD-10-CM.
20
+ # Med Care. 2017 Dec;55(12):1046-1051.
21
+ # doi: 10.1097/MLR.0000000000000824. PMID: 29087983.
22
+
23
+ from pathlib import Path
24
+
25
+ import pandas as pd
26
+ import polars as pl
27
+
28
+ # Import the generalized function
29
+ from .CustomComorbidityIndex import CustomComorbidityIndex
30
+
31
+
32
+ def GagneComorbidityIndex(
33
+ df: pl.DataFrame,
34
+ id_col: str = "id",
35
+ code_col: str = "code",
36
+ icd_version: str = "icd9",
37
+ icd_version_col: str = None,
38
+ return_categories=False,
39
+ ):
40
+ """
41
+ Calculate the Gagne Comorbidity Index using ICD codes.
42
+
43
+ Args:
44
+ df (pl.DataFrame): DataFrame with at least columns [id_col, code_col].
45
+ id_col (str): Name of the column containing unique identifier. Default: "id".
46
+ code_col (str): Name of the column containing ICD codes. Default: "code".
47
+ icd_version (str): ICD version ('icd9', 'icd10', or 'icd9_10'). Default: "icd9".
48
+ icd_version_col (str, optional): Name of the column with ICD version for 'icd9_10'. Default: None.
49
+ return_categories (bool): If True, also return presence indicators for each Gagne category.
50
+
51
+ Returns:
52
+ - DataFrame with [id_col, "Gagne Score"].
53
+ - DataFrame with category indicators if return_categories is True, else None.
54
+ """
55
+
56
+ # Check if input is pandas DataFrame and convert to polars
57
+ is_pandas = pd and isinstance(df, pd.DataFrame)
58
+ if is_pandas:
59
+ df = pl.from_pandas(df)
60
+
61
+ assert (
62
+ id_col in df.columns
63
+ ), f"Column '{id_col}' (ID) must be present in input DataFrame."
64
+ assert (
65
+ code_col in df.columns
66
+ ), f"Column '{code_col}' (ICD code) must be present in input DataFrame."
67
+
68
+ definition_file = "GAGNE.csv"
69
+ definition_file_path = Path(__file__).parent / f"common/{definition_file}"
70
+ weight_col_name = "weights"
71
+ score_col_name = "Gagne Score"
72
+
73
+ # Define mutual exclusion rules for Gagne
74
+ mutual_exclusion_rules = [
75
+ ("Complicated diabetes", "Uncomplicated diabetes")
76
+ ]
77
+
78
+ # Call the generalized function
79
+ df_gagne = CustomComorbidityIndex(
80
+ df=df,
81
+ id_col=id_col,
82
+ code_col=code_col,
83
+ icd_version=icd_version,
84
+ icd_version_col=icd_version_col,
85
+ definition_data=definition_file_path,
86
+ weight_col_name=weight_col_name,
87
+ score_col_name=score_col_name,
88
+ mutual_exclusion_rules=mutual_exclusion_rules,
89
+ return_categories=return_categories,
90
+ )
91
+
92
+ if is_pandas:
93
+ return df_gagne.to_pandas()
94
+
95
+ return df_gagne
@@ -0,0 +1,182 @@
1
+ # Reference for HFRS:
2
+ # 1. Gilbert T, Neuburger J, Kraindler J, Keeble E, Smith P, Ariti C, Arora S,
3
+ # Street A, Parker S, Roberts HC, Bardsley M, Conroy S. Development and
4
+ # validation of a Hospital Frailty Risk Score focusing on older people in
5
+ # acute care settings using electronic hospital records: an observational
6
+ # study. Lancet. 2018 May 5;391(10132):1775-1782.
7
+ # doi: 10.1016/S0140-6736(18)30668-8. Epub 2018 Apr 26. PMID: 29706364;
8
+ # PMCID: PMC5946808.
9
+
10
+ from pathlib import Path
11
+
12
+ import pandas as pd
13
+ import polars as pl
14
+
15
+
16
+ def HospitalFrailtyRiskScore(
17
+ df: pl.DataFrame,
18
+ id_col: str = "id",
19
+ code_col: str = "code",
20
+ icd_version: str = "icd10",
21
+ return_categories=False,
22
+ ):
23
+ """
24
+ Calculate the Hospital Frailty Risk Score (HFRS) using ICD-10 codes.
25
+
26
+ Args:
27
+ df (pl.DataFrame): DataFrame with at least columns [id_col, code_col].
28
+ id_col (str): Name of the column containing unique identifier. Default: "id".
29
+ code_col (str): Name of the column containing ICD codes. Default: "code".
30
+ icd_version (str): ICD version ('icd10'). HFRS requires ICD-10. Default: "icd10".
31
+ return_categories (bool): If True, also return presence indicators for each HFRS category.
32
+
33
+ Returns:
34
+ - DataFrame with [id_col, "HFRS Score"].
35
+ - DataFrame with category indicators if return_categories is True, else None.
36
+ """
37
+
38
+ # Check if input is pandas DataFrame and convert to polars
39
+ is_pandas = pd and isinstance(df, pd.DataFrame)
40
+ if is_pandas:
41
+ df = pl.from_pandas(df)
42
+
43
+ # Input validation
44
+ assert icd_version == "icd10", "icd_version must be 'icd10' for HFRS."
45
+ assert (
46
+ code_col in df.columns
47
+ ), f"Column '{code_col}' (ICD code) must be present in input DataFrame."
48
+ assert (
49
+ id_col in df.columns
50
+ ), f"Column '{id_col}' (ID) must be present in input DataFrame."
51
+
52
+ # Drop rows from df with missing codes
53
+ df = df.filter(pl.col(code_col).is_not_null())
54
+
55
+ # Load definitions
56
+ definition_file = "HFRS.csv"
57
+ definition_file_path = Path(__file__).parent / f"common/{definition_file}"
58
+ definitions = pl.read_csv(definition_file_path, separator=",")
59
+
60
+ assert (
61
+ "category" in definitions.columns
62
+ ), "'category' column not found in definition file."
63
+ assert (
64
+ "weight" in definitions.columns
65
+ ), "'weight' column not found in definition file."
66
+
67
+ def process_single_icd(df, icd_col_name):
68
+ # Prepare mapping DataFrame: code_col, category
69
+ code_map_rows = []
70
+ for row in definitions.iter_rows(named=True):
71
+ if row["category"] is None or row.get(icd_col_name) is None:
72
+ continue
73
+ for code in row[icd_col_name].split("|"):
74
+ code_map_rows.append(
75
+ {"prefix": code.strip(), "category": row["category"]}
76
+ )
77
+ code_map = pl.DataFrame(code_map_rows)
78
+
79
+ # Create dataframe with presence indicators
80
+ categories = code_map.select("category").unique()
81
+ categories_list = categories.to_series().to_list()
82
+ categories_df = categories.with_columns(
83
+ pl.when(pl.col("category") == category)
84
+ .then(pl.lit(1))
85
+ .otherwise(pl.lit(0))
86
+ .alias(category)
87
+ for category in categories_list
88
+ )
89
+
90
+ # Get all unique ICD codes in the data
91
+ code_prefixes = code_map.select("prefix").to_series()
92
+ unique_codes = df.select(code_col).unique()
93
+ code_list = [
94
+ str(c) for c in unique_codes[code_col].to_list() if c is not None
95
+ ]
96
+ if code_list:
97
+ longest_code_len = max((len(c) for c in code_list), default=1)
98
+ else:
99
+ longest_code_len = 1
100
+
101
+ # Create a DataFrame with all possible prefixes, then find the best match
102
+ best_prefix = (
103
+ unique_codes.with_columns(
104
+ pl.col(code_col).str.slice(0, n).alias(f"prefix_{n}")
105
+ for n in range(1, longest_code_len + 1)
106
+ )
107
+ .with_columns(
108
+ pl.when(pl.col(f"prefix_{n}").is_in(code_prefixes))
109
+ .then(pl.col(f"prefix_{n}"))
110
+ .otherwise(None)
111
+ .alias(f"prefix_{n}")
112
+ for n in range(1, longest_code_len + 1)
113
+ )
114
+ .with_columns(
115
+ pl.coalesce(
116
+ *[
117
+ pl.col(f"prefix_{n}")
118
+ for n in range(longest_code_len, 0, -1)
119
+ ]
120
+ ).alias("best_prefix")
121
+ )
122
+ .select(code_col, "best_prefix")
123
+ .drop_nulls("best_prefix")
124
+ )
125
+
126
+ code_to_category = (
127
+ best_prefix.join(
128
+ code_map, left_on="best_prefix", right_on="prefix", how="left"
129
+ )
130
+ .select(code_col, "category")
131
+ .join(categories_df, on="category", how="left")
132
+ .select(code_col, *categories_list)
133
+ )
134
+
135
+ # Join diagnoses with code_to_category to get the best matching category for each diagnosis
136
+ df_presence_absence = (
137
+ df.join(code_to_category, on=code_col, how="left")
138
+ .group_by(id_col)
139
+ .agg(pl.max(cat).fill_null(0).alias(cat) for cat in categories_list)
140
+ )
141
+
142
+ # Add missing columns
143
+ for cat in categories_list:
144
+ if cat not in df_presence_absence.columns:
145
+ df_presence_absence = df_presence_absence.with_columns(
146
+ pl.lit(0).alias(cat)
147
+ )
148
+ df_presence_absence = df_presence_absence.select(
149
+ [id_col] + categories_list
150
+ )
151
+ return df_presence_absence, categories_list
152
+
153
+ # Only ICD-10 supported for HFRS
154
+ df_presence_absence, all_categories = process_single_icd(df, "icd10_codes")
155
+
156
+ # STEP 2: calculate HFRS score
157
+ category_weights = dict(zip(definitions["category"], definitions["weight"]))
158
+ category_weights = {
159
+ k: v
160
+ for k, v in category_weights.items()
161
+ if k is not None and v is not None
162
+ }
163
+
164
+ score_expr = (
165
+ pl.sum_horizontal(
166
+ pl.col(cat) * category_weights.get(cat, 0)
167
+ for cat in all_categories
168
+ if cat in df_presence_absence.columns and cat in category_weights
169
+ )
170
+ .round(1)
171
+ .alias("HFRS Score")
172
+ )
173
+
174
+ cols = [id_col] + all_categories if return_categories else [id_col]
175
+ hfrs_df = df_presence_absence.select(*cols, score_expr).cast(
176
+ {"HFRS Score": float}
177
+ )
178
+
179
+ if is_pandas:
180
+ return hfrs_df.to_pandas()
181
+
182
+ return hfrs_df
pycomorb/__init__.py ADDED
@@ -0,0 +1,114 @@
1
+ """Top-level package for comorbidipy."""
2
+
3
+ __author__ = """Finn Fassbender"""
4
+ __email__ = "finn.fassbender@charite.de"
5
+ __version__ = "0.4"
6
+
7
+ from .CharlsonComorbidityIndex import CharlsonComorbidityIndex
8
+ from .ElixhauserComorbidityIndex import ElixhauserComorbidityIndex
9
+ from .GagneComorbidityIndex import GagneComorbidityIndex
10
+ from .HospitalFrailtyRiskScore import HospitalFrailtyRiskScore
11
+
12
+
13
+ def comorbidity(
14
+ score: str,
15
+ df,
16
+ id_col="id",
17
+ code_col="code",
18
+ age_col="age",
19
+ icd_version="icd10",
20
+ icd_version_col=None,
21
+ implementation=None,
22
+ weights=None,
23
+ return_categories=False,
24
+ ):
25
+ """
26
+ Unified wrapper to calculate a comorbidity or frailty score.
27
+
28
+ Args:
29
+ score (str): Which score to calculate.
30
+ df (pl.DataFrame): DataFrame with at least columns [id_col, code_col] (and age_col for Charlson).
31
+ id_col (str): Name of the column containing unique identifier. Default: "id".
32
+ code_col (str): Name of the column containing ICD codes. Default: "code".
33
+ age_col (str): Name of the column containing patient ages (Charlson only). Default: "age".
34
+ icd_version (str): ICD version. Default: "icd10".
35
+ icd_version_col (str, optional): Name of the column with ICD version for 'icd9_10'. Default: None.
36
+ implementation (str, optional): Implementation variant (see individual index docs).
37
+ weights (str, optional): Weighting scheme (Elixhauser only).
38
+ return_categories (bool): Whether to return category indicators.
39
+
40
+ Returns:
41
+ - DataFrame with [id_col, score].
42
+ - DataFrame with category indicators if return_categories is True, else None.
43
+ """
44
+ score = score.lower()
45
+ if score in (
46
+ "cci",
47
+ "charlson",
48
+ "charlsoncomorbidityindex",
49
+ "charlson_comorbidity_index",
50
+ ):
51
+ if age_col not in df.columns:
52
+ raise ValueError(
53
+ f"Column '{age_col}' (age) must be present in input DataFrame for Charlson calculation."
54
+ )
55
+ return CharlsonComorbidityIndex(
56
+ df=df,
57
+ id_col=id_col,
58
+ code_col=code_col,
59
+ age_col=age_col,
60
+ icd_version=icd_version,
61
+ icd_version_col=icd_version_col,
62
+ implementation=implementation or "quan",
63
+ return_categories=return_categories,
64
+ )
65
+ elif score in (
66
+ "eci",
67
+ "elixhauser",
68
+ "elixhausercomorbidityindex",
69
+ "elixhauser_comorbidity_index",
70
+ ):
71
+ return ElixhauserComorbidityIndex(
72
+ df=df,
73
+ id_col=id_col,
74
+ code_col=code_col,
75
+ icd_version=icd_version,
76
+ icd_version_col=icd_version_col,
77
+ implementation=implementation or "quan",
78
+ weights=weights or "van_walraven",
79
+ return_categories=return_categories,
80
+ )
81
+ elif score in (
82
+ "gci",
83
+ "gagne",
84
+ "gagnecomorbidityindex",
85
+ "gagne_comorbidity_index",
86
+ "combined",
87
+ "combinedcomorbidityindex",
88
+ "combined_comorbidity_index",
89
+ ):
90
+ return GagneComorbidityIndex(
91
+ df=df,
92
+ id_col=id_col,
93
+ code_col=code_col,
94
+ icd_version=icd_version,
95
+ icd_version_col=icd_version_col,
96
+ return_categories=return_categories,
97
+ )
98
+ elif score in (
99
+ "hfrs",
100
+ "hospitalfrailtyriskscore",
101
+ "hospital_frailty_risk_score",
102
+ ):
103
+ return HospitalFrailtyRiskScore(
104
+ df=df,
105
+ id_col=id_col,
106
+ code_col=code_col,
107
+ icd_version=icd_version,
108
+ return_categories=return_categories,
109
+ )
110
+ else:
111
+ raise ValueError(
112
+ f"Unknown score: '{score}'. Must be one of: "
113
+ "'charlson', 'elixhauser', 'gagne', 'hfrs'."
114
+ )
@@ -0,0 +1,19 @@
1
+ index,category,icd9_codes,icd10_codes,weights
2
+ 0,Age,,YYYY|YYYY,1
3
+ 1,Myocardial infarction,,I21|I22|I252,1
4
+ 2,Congestive heart failure,,I50,1
5
+ 3,Peripheral vascular disease,,I71|I790|I739|R02|Z958|Z959,1
6
+ 4,Cerebrovascular disease,,I60|I61|I62|I63|I65|I66|G450|G451|G452|G458|G459|G46|I64|G454|I670|I671|I672|I674|I675|I676|I677|I678|I679|I681|I682|I688|I69,1
7
+ 5,Dementia,,F00|F01|F02|F051,1
8
+ 6,Chronic pulmonary disease,,J40|J41|J42|J44|J43|J45|J46|J47|J67|J44|J60|J61|J62|J63|J66|J64|J65,1
9
+ 7,Connective tissue disorder,,M32|M34|M332|M053|M058|M059|M060|M063|M069|M050|M052|M051|M353,1
10
+ 8,Peptic ulcer disease,,K25|K26|K27|K28,1
11
+ 9,Mild liver disease,,K702|K703|K73|K717|K740|K742|K746|K743|K744|K745,1
12
+ 10,Diabetes,,E109|E119|E139|E149|E101|E111|E131|E141|E105|E115|E135|E145,1
13
+ 11,Diabetes complications,,E102|E112|E132|E142|E103|E113|E133|E143|E104|E114|E134|E144,2
14
+ 12,Paraplegia,,G81|G041|G820|G821|G822,2
15
+ 13,Renal disease,,N03|N052|N053|N054|N055|N056|N072|N073|N074|N01|N18|N19|N25,2
16
+ 14,Cancer,,C0|C1|C2|C3|C40|C41|C43|C45|C46|C47|C48|C49|C5|C6|C70|C71|C72|C73|C74|C75|C76|C80|C81|C82|C83|C84|C85|C883|C887|C889|C900|C901|C91|C92|C93|C940|C941|C942|C943|C9451|C947|C95|C96,2
17
+ 15,Moderate or severe liver disease,,K729|K766|K767|K721,3
18
+ 16,Metastatic solid tumor,,C77|C78|C79|C80,6
19
+ 17,AIDS/HIV,,B20|B21|B22|B23|B24,6
@@ -0,0 +1,19 @@
1
+ index,category,icd9_codes,icd10_codes,weights
2
+ 0,Age,XXXX|XXXX,,1
3
+ 1,Myocardial infarction,410|412,,1
4
+ 2,Congestive heart failure,428,,1
5
+ 3,Peripheral vascular disease,4439|441|7854|V434,,1
6
+ 4,Cerebrovascular disease,430|431|432|433|434|435|436|437|438,,1
7
+ 5,Dementia,290,,1
8
+ 6,Chronic pulmonary disease,49|501|502|503|504|505,,1
9
+ 7,Rheumatic disease,7100|7101|7104|7140|7141|7142|71481|725,,1
10
+ 8,Peptic ulcer disease,531|532|533|534,,1
11
+ 9,Mild liver disease,5712|5714|5715|5716,,1
12
+ 10,Diabetes without chronic complication,2500|2501|2502|2503|2507,,1
13
+ 11,Diabetes with chronic complication,2504|2505|2506,,2
14
+ 12,Hemiplegia or paraplegia,3441|342,,2
15
+ 13,Renal disease,582|5830|5831|5832|5833|5834|5835|5836|5837|585|586|588,,2
16
+ 14,"Any malignancy, including lymphoma and leukemia",14|15|16|170|171|172|175|176|177|178|179|18|190|191|192|193|194|1950|1951|1952|1953|1954|1955|1956|1957|1958|2OO|201|202|203|204|205|206|207|208,,2
17
+ 15,Moderate or severe liver disease,5722|5723|5724|5725|5726|5727|5728,,3
18
+ 16,Metastatic solid tumor,196|197|198|1990|1991,,6
19
+ 17,AIDS/HIV,042|043|044,,6
@@ -0,0 +1,19 @@
1
+ index,category,icd9_codes,icd10_codes,weights
2
+ 0,Age,XXXX|XXXX,,1
3
+ 1,Myocardial infarction,410|412,,1
4
+ 2,Congestive heart failure,398|402|428,,1
5
+ 3,Peripheral vascular disease,440|441|442|443|444|445|446|447,,1
6
+ 4,Cerebrovascular disease,430|431|432|433|435,,1
7
+ 5,Dementia,290|291|294,,1
8
+ 6,Chronic pulmonary disease,491|492|493,,1
9
+ 7,Rheumatic disease,710|714|725,,1
10
+ 8,Peptic ulcer disease,531|532|533|534,,1
11
+ 9,Mild liver disease,571|573,,1
12
+ 10,Diabetes without chronic complication,250,,1
13
+ 11,Diabetes with chronic complication,250,,2
14
+ 12,Hemiplegia or paraplegia,342|434|436|437,,2
15
+ 13,Renal disease,403|404|580|581|582|583|584|585|586,,2
16
+ 14,"Any malignancy, including lymphoma and leukemia",14|15|16|17|18|190|191|192|193|194|195|2OO|202|203|204|205|206|207|208,,2
17
+ 15,Moderate or severe liver disease,070|570|572,,3
18
+ 16,Metastatic solid tumor,196|197|198|199,,6
19
+ 17,AIDS/HIV,,,6
@@ -0,0 +1,19 @@
1
+ index,category,icd9_codes,icd10_codes,weights
2
+ 0,Age,XXXX|XXXX,YYYY|YYYY,1
3
+ 1,Myocardial infarction,410|412,I21|I22|I252,1
4
+ 2,Congestive heart failure,428|4254|4259|39891|40201|40211|40291|40401|40403|40411|40413|40491|40493,I43|I50|I099|I110|I130|I132|I255|I420|I425|I426|I427|I428|I429|P290,1
5
+ 3,Peripheral vascular disease,440|441|0930|4373|4471|5571|5579|V434|4431|4432|4433|4434|4435|4436|4437|4438|4439,I70|I71|I731|I738|I739|I771|I790|I792|K551|K558|K559|Z958|Z959,1
6
+ 4,Cerebrovascular disease,430|431|432|433|434|435|436|437|438|36234,G45|G46|I60|I61|I62|I63|I64|I65|I66|I67|I68|I69|H340,1
7
+ 5,Dementia,290|2941|3312,F00|F01|F02|F03|G30|F051|G311,1
8
+ 6,Chronic pulmonary disease,490|491|492|493|494|495|496|500|501|502|503|504|505|4168|4169|5064|5081|5088,J40|J41|J42|J43|J44|J45|J46|J47|J60|J61|J62|J63|J64|J65|J66|J67|I278|I279|J684|J701|J703,1
9
+ 7,Rheumatic disease,725|4465|7100|7101|7102|7103|7104|7140|7141|7142|7148,M05|M06|M32|M33|M34|M315|M351|M353|M360,1
10
+ 8,Peptic ulcer disease,531|532|533|534,K25|K26|K27|K28,1
11
+ 9,Mild liver disease,570|571|0706|0709|5733|5734|5738|5739|V427|07022|07023|07032|07033|07044|07054,B18|K73|K74|K700|K701|K702|K703|K709|K713|K714|K715|K717|K760|K762|K763|K764|K768|K769|Z944,1
12
+ 10,Diabetes without chronic complication,2500|2501|2502|2503|2508|2509,E100|E101|E106|E108|E109|E110|E111|E116|E118|E119|E120|E121|E126|E128|E129|E130|E131|E136|E138|E139|E140|E141|E146|E148|E149,1
13
+ 11,Diabetes with chronic complication,2504|2505|2506|2507,E102|E103|E104|E105|E107|E112|E113|E114|E115|E117|E122|E123|E124|E125|E127|E132|E133|E134|E135|E137|E142|E143|E144|E145|E147,2
14
+ 12,Hemiplegia or paraplegia,342|343|3341|3440|3441|3442|3443|3444|3445|3446|3449,G81|G82|G041|G114|G801|G802|G830|G831|G832|G833|G834|G839,2
15
+ 13,Renal disease,582|585|586|V56|5880|V420|V451|5830|5831|5832|5833|5834|5835|5836|5837|40301|40311|40391|40402|40403|40412|40413|40492|40493,N18|N19|I120|I131|N032|N033|N034|N035|N036|N037|N052|N053|N054|N055|N056|N057|N250|Z490|Z491|Z492|Z940|Z992,2
16
+ 14,"Any malignancy, including lymphoma and leukemia, except malignant neoplasm of skin",14|15|16|170|171|172|174|175|176|177|178|179|18|190|191|192|193|194|1950|1951|1952|1953|1954|1955|1956|1957|1958|200|201|202|203|204|205|206|207|208|2386,C43|C88|C0|C1|C20|C21|C22|C23|C24|C25|C26|C30|C31|C32|C33|C34|C37|C38|C39|C40|C41|C45|C46|C47|C48|C49|C50|C51|C52|C53|C54|C55|C56|C57|C58|C60|C61|C62|C63|C64|C65|C66|C67|C68|C69|C70|C71|C72|C73|C74|C75|C76|C81|C82|C83|C84|C85|C90|C91|C92|C93|C94|C95|C96|C97,2
17
+ 15,Moderate or severe liver disease,4560|4561|4562|5722|5723|5724|5725|5726|5727|5728,I850|I859|I864|I982|K704|K711|K721|K729|K765|K766|K767,3
18
+ 16,Metastatic solid tumor,196|197|198|199,C77|C78|C79|C80,6
19
+ 17,AIDS/HIV,042|043|044,B20|B21|B22|B24,6
@@ -0,0 +1,19 @@
1
+ index,category,icd9_codes,icd10_codes,weights
2
+ 0,Age,XXXX|XXXX,,1
3
+ 1,Myocardial infarction,410|412,,1
4
+ 2,Congestive heart failure,40201|40211|40291|425|428|4293,,1
5
+ 3,Peripheral vascular disease,440|441|442|4431|4432|4433|4434|4435|4436|4437|4438|4439|4471|7854,,1
6
+ 4,Cerebrovascular disease,36234|430|431|432|433|434|435|436|4370|4371|4379|438|7814|7843|9970,,1
7
+ 5,Dementia,290|3310|3311|3312,,1
8
+ 6,Chronic pulmonary disease,4150|4168|4169|491|494|496,,1
9
+ 7,Rheumatic disease,710|714,,1
10
+ 8,Peptic ulcer disease,531|532|533|534,,1
11
+ 9,Mild liver disease,5712|5715|5716|5718|5719,,1
12
+ 10,Diabetes without chronic complication,2500|2501|2502|2503,,1
13
+ 11,Diabetes with chronic complication,2504|2505|2506|2507|2508|2509,,2
14
+ 12,Hemiplegia or paraplegia,342|344,,2
15
+ 13,Renal disease,585|586|V420|V451|V56,,2
16
+ 14,"Any malignancy, including lymphoma and leukemia",14|15|16|170|171|175|176|177|178|179|18|190|191|192|193|194|195|2OO|201|202|203|204|205|206|207|208|2730|2733|V1046,,2
17
+ 15,Moderate or severe liver disease,5722|5723|5724|4560|4561|4562,,3
18
+ 16,Metastatic solid tumor,196|197|198|199,,6
19
+ 17,AIDS/HIV,042|043|044,,6
@@ -0,0 +1,20 @@
1
+ index,category,icd9_codes,icd10_codes,weights
2
+ 0,Age,,YYYY|YYYY,1
3
+ 1,Myocardial infarction,,I21|I22|I252,1
4
+ 2,Congestive heart failure,,I110|I130|I132|I255|I420|I426|I427|I428|I429|I43|I50,1
5
+ 3,Peripheral vascular disease,,I70|I71|I731|I738|I771|I790|I792|K55,1
6
+ 4,Cerebrovascular disease,,G45|I60|I61|I62|I63|I64|I67|I69,1
7
+ 5,Dementia,,F00|F01|F02|F03|F051|G30|G311|G319,1
8
+ 6,Chronic obstructive pulmonary disease (COPD),,J43|J44,1
9
+ 7,Other chronic pulmonary disease,,J41|J42|J45|J46|J47|J60|J61|J62|J63|J64|J65|J66|J67|J68|J69|J70,1
10
+ 8,Rheumatic disease,,M05|M06|M123|M070|M071|M072|M073|M08|M13|M30|M313|M314|M315|M316|M32|M33|M34|M350|M351|M353|M45|M46,1
11
+ 9,(Peptic) Ulcer disease,,K25|K26|K27|K28,1
12
+ 10,Mild liver disease,,B15|B16|B17|B18|B19|K703|K73|K746|K703|K754,1
13
+ 11,Diabetes,,E100|E101|E110|E111|E120|E121|E130|E131|E140|E141,1
14
+ 12,Diabetes with end organ damage,,E102|E103|E104|E105|E107|E112|E113|E114|E115|E116|E117|E122|E123|E124|E125|E126|E127|E132|E133|E134|E135|E136|E137|E142|E143|E144|E145|E146|E147,2
15
+ 13,"Hemiplegia, tetraplegia",,G114|G80|G81|G82|G830|G831|G832|G833|G838,2
16
+ 14,Moderate or severe kidney disease,,N032|N033|N034|N035|N036|N037|N052|N053|N054|N055|N056|N057|N11|N18|N19|N250|I120|I131|Q611|Q612|Q613|Q614|Z49|Z940|Z992,2
17
+ 15,"Any malignancy, including lymphoma and leukemia",,C00|C01|C02|C03|C04|C05|C06|C07|C08|C09|C10|C11|C12|C13|C14|C15|C16|C17|C18|C19|C20|C21|C22|C23|C24|C25|C26|C30|C31|C32|C33|C34|C37|C38|C39|C40|C41|C43|C45|C46|C47|C48|C49|C50|C51|C52|C53|C54|C55|C56|C57|C58|C60|C61|C62|C63|C64|C65|C66|C67|C68|C69|C70|C71|C72|C73|C74|C75|C76|C81|C82|C83|C84|C85|C86|C88|C90|C91|C92|C93|C94|C95|C96|C97,2
18
+ 16,Moderate or severe liver disease,,R18|I850|I859|I982|I983,3
19
+ 17,Metastatic cancer,,C77|C78|C79|C80,6
20
+ 18,AIDS/HIV,,B20|B21|B22|B24|F024|O987|R75|Z114|Z219|Z711,6
@@ -0,0 +1,19 @@
1
+ index,category,icd9_codes,icd10_codes,weights
2
+ 0,Age,,YYYY|YYYY,1
3
+ 1,Acute myocardial infarction,,I21|I22|I23|I252|I258,5
4
+ 2,Congestive heart failure,,I50,13
5
+ 3,Peripheral vascular disease,,I71|I739|I790|R02|Z958|Z959,6
6
+ 4,Cerebral vascular accident,,G450|G451|G452|G454|G458|G459|G46|I60|I61|I62|I63|I64|I65|I66|I67|I68|I69,11
7
+ 5,Dementia,,F00|F01|F02|F03|F051,14
8
+ 6,Pulmonary disease,,J40|J41|J42|J43|J44|J45|J46|J47|J60|J61|J62|J63|J64|J65|J66|J67,4
9
+ 7,Connective tissue disorder,,M05|M060|M063|M069|M32|M332|M34|M353,4
10
+ 8,Peptic ulcer,,K25|K26|K27|K28,9
11
+ 9,Liver disease,,K702|K703|K717|K73|K74,8
12
+ 10,Diabetes,,E101|E105|E106|E108|E109|E111|E115|E116|E118|E119|E131|E135|E136|E138|E139|E141|E145|E146|E148|E149,3
13
+ 11,Diabetes complications,,E102|E103|E104|E107|E112|E113|E114|E117|E132|E133|E134|E137|E142|E143|E144|E147,-1
14
+ 12,Paraplegia,,G041|G81|G820|G821|G822,1
15
+ 13,Renal disease,,I12|I13|N01|N03|N052|N053|N054|N055|N056|N072|N073|N074|N18|N19|N25,10
16
+ 14,Cancer,,C0|C1|C2|C3|C4|C5|C6|C70|C71|C72|C73|C74|C75|C76|C81|C82|C83|C84|C85|C86|C88|C90|C91|C92|C93|C94|C95|C96|C97,8
17
+ 15,Severe liver disease,,K721|K729|K766|K767,18
18
+ 16,Metastatic cancer,,C77|C78|C79|C80,14
19
+ 17,AIDS/HIV,,B20|B21|B22|B23|B24|O987,2
@@ -0,0 +1,32 @@
1
+ index,category,icd9_codes
2
+ 0,Congestive heart failure,39891|40211|40291|40411|40413|40491|40493|428
3
+ 1,Cardiac arrhythmias,42610|42611|42613|4262|4263|4264|42650|42651|42652|42653|4266|4267|4268|4270|4272|42731|42760|4279|7850|V450|V533
4
+ 2,Valvular disease,0932|3940|3941|3942|3949|3950|3951|3952|3959|3960|3961|3962|3963|3968|3969|3970|3971|4240|4241|4242|4243|42490|42491|7463|7464|7465|7466|V422|V433
5
+ 3,Pulmonary circulation disorders,416|4179
6
+ 4,Peripheral vascular disorders,440|4412|4414|4417|4419|4431|4432|4433|4434|4435|4436|4437|4438|4439|4471|5571|5579|V434
7
+ 5,Hypertension uncomplicated,4011|4019
8
+ 6,Hypertension complicated,40210|40290|40410|40490|4051|4059
9
+ 7,Paralysis,3420|3421|3429|3430|3431|3432|3433|3434|3438|3439|3440|3441|3442|3443|3444|3445|3446|3448|3449
10
+ 8,Other neurological disorders,3319|3320|3334|3335|334|335|340|3411|3412|3413|3414|3415|3416|3417|3418|3419|3450|3451|3454|3455|3458|3459|3481|3483|7803|7843
11
+ 9,Chronic pulmonary disease,490|491|4920|4928|49300|49301|49302|49310|49311|49312|49320|49321|49322|49381|49382|49390|49391|494|495|496|500|501|502|503|504|505|5064
12
+ 10,Diabetes uncomplicated,2500|2501|2502|2503
13
+ 11,Diabetes complicated,2504|2505|2506|2507|2509
14
+ 12,Hypothyroidism,243|2440|2441|2442|2448|2449
15
+ 13,Renal failure,40311|40391|40412|40492|585|586|V420|V451|V560|V568
16
+ 14,Liver disease,07032|07033|07054|4560|4561|4562|5710|5712|5713|5714|5715|5716|5718|5719|5723|5728|V427
17
+ 15,Peptic ulcer disease excluding bleeding,53170|53190|53270|53290|53370|53390|53470|53490|V1271
18
+ 16,AIDS/HIV,042|043|044
19
+ 17,Lymphoma,200|201|2020|2021|2022|2023|2025|2026|2027|2028|2029|2030|2038|2386|2733|V1071|V1072|V1079
20
+ 18,Metastatic cancer,196|197|198|199
21
+ 19,Solid tumor without metastasis,140|141|142|143|144|145|146|147|148|149|150|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166|167|168|169|170|171|172|174|175|179|180|181|182|183|184|185|186|187|188|189|190|191|192|193|194|195|V10
22
+ 20,Rheumatoid arthritis/collagen vascular diseases,7010|710|714|720|725
23
+ 21,Coagulopathy,286|2871|2873|2874|2875
24
+ 22,Obesity,2780
25
+ 23,Weight loss,260|261|262|263
26
+ 24,Fluid and electrolyte disorders,276
27
+ 25,Blood loss anemia,2800
28
+ 26,Deficiency anemia,2801|2802|2803|2804|2805|2806|2807|2808|2809|2810|2811|2812|2813|2814|2818|2819|2859
29
+ 27,Alcohol abuse,2911|2912|2915|2916|2917|2918|2919|3039|3050|V113
30
+ 28,Drug abuse,2920|29282|29283|29284|29285|29286|29289|2929|3040|3052|3053|3054|3055|3056|3057|3058|3059
31
+ 29,Psychoses,295|296|297|298|2991
32
+ 30,Depression,3004|30112|3090|3091|311