pycomorb 0.4__tar.gz → 0.4.2__tar.gz
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.
- {pycomorb-0.4/src/pycomorb.egg-info → pycomorb-0.4.2}/PKG-INFO +2 -2
- {pycomorb-0.4 → pycomorb-0.4.2}/README.md +1 -1
- {pycomorb-0.4 → pycomorb-0.4.2}/pyproject.toml +1 -1
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/CustomComorbidityIndex.py +3 -26
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/GagneComorbidityIndex.py +4 -3
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/__init__.py +2 -1
- {pycomorb-0.4 → pycomorb-0.4.2/src/pycomorb.egg-info}/PKG-INFO +2 -2
- {pycomorb-0.4 → pycomorb-0.4.2}/LICENSE +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/setup.cfg +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/CharlsonComorbidityIndex.py +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/ElixhauserComorbidityIndex.py +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/HospitalFrailtyRiskScore.py +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/CHARLSON_AUSTRALIA.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/CHARLSON_DEYO.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/CHARLSON_DHOORE.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/CHARLSON_QUAN.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/CHARLSON_ROMANO.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/CHARLSON_SWEDEN.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/CHARLSON_UK_SHMI_v1.55.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/ELIXHAUSER.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/ELIXHAUSER_AHRQ_ICD10.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/ELIXHAUSER_AHRQ_ICD9.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/ELIXHAUSER_QUAN.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/ELIXHAUSER_WEIGHTS.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/GAGNE.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb/common/HFRS.csv +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb.egg-info/SOURCES.txt +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb.egg-info/dependency_links.txt +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb.egg-info/requires.txt +0 -0
- {pycomorb-0.4 → pycomorb-0.4.2}/src/pycomorb.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pycomorb
|
|
3
|
-
Version: 0.4
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Comorbidity and frailty score calculation utilities (Charlson, Elixhauser, Gagne, HFRS) using polars
|
|
5
5
|
Author-email: Finn Fassbender <finn.fassbender@charite.de>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -32,7 +32,7 @@ It is inspired by the R package [`comorbidity`](https://github.com/ellessenne/co
|
|
|
32
32
|
|
|
33
33
|
## Supported Variants
|
|
34
34
|
|
|
35
|
-
See [common/README.md](src/pycomorb/common/README.md) for more details and references.
|
|
35
|
+
See [common/README.md](https://github.com/CUB-CORR/pycomorb/blob/main/src/pycomorb/common/README.md) for more details and references.
|
|
36
36
|
|
|
37
37
|
### Charlson Comorbidity Index
|
|
38
38
|
|
|
@@ -17,7 +17,7 @@ It is inspired by the R package [`comorbidity`](https://github.com/ellessenne/co
|
|
|
17
17
|
|
|
18
18
|
## Supported Variants
|
|
19
19
|
|
|
20
|
-
See [common/README.md](src/pycomorb/common/README.md) for more details and references.
|
|
20
|
+
See [common/README.md](https://github.com/CUB-CORR/pycomorb/blob/main/src/pycomorb/common/README.md) for more details and references.
|
|
21
21
|
|
|
22
22
|
### Charlson Comorbidity Index
|
|
23
23
|
|
|
@@ -132,31 +132,6 @@ def CustomComorbidityIndex(
|
|
|
132
132
|
.drop_nulls("best_prefix")
|
|
133
133
|
)
|
|
134
134
|
|
|
135
|
-
(
|
|
136
|
-
unique_codes.with_columns(
|
|
137
|
-
pl.col(code_col).str.slice(0, n).alias(f"prefix_{n}")
|
|
138
|
-
for n in range(1, len(longest_code) + 1)
|
|
139
|
-
)
|
|
140
|
-
.with_columns(
|
|
141
|
-
pl.when(pl.col(f"prefix_{n}").is_in(code_prefixes))
|
|
142
|
-
.then(pl.col(f"prefix_{n}"))
|
|
143
|
-
.otherwise(None)
|
|
144
|
-
.alias(f"prefix_{n}")
|
|
145
|
-
for n in range(1, len(longest_code) + 1)
|
|
146
|
-
)
|
|
147
|
-
.with_columns(
|
|
148
|
-
pl.concat_list(
|
|
149
|
-
pl.col(f"prefix_{n}")
|
|
150
|
-
for n in range(1, len(longest_code) + 1)
|
|
151
|
-
)
|
|
152
|
-
.list.drop_nulls()
|
|
153
|
-
.list.unique()
|
|
154
|
-
.list.join(", ")
|
|
155
|
-
.alias("best_prefixes")
|
|
156
|
-
)
|
|
157
|
-
.write_csv("best_prefix.csv")
|
|
158
|
-
)
|
|
159
|
-
|
|
160
135
|
code_to_category = (
|
|
161
136
|
best_prefix.join(
|
|
162
137
|
code_map, left_on="best_prefix", right_on="prefix", how="left"
|
|
@@ -195,7 +170,9 @@ def CustomComorbidityIndex(
|
|
|
195
170
|
|
|
196
171
|
# Combine: outer join on id_col, take max for each category
|
|
197
172
|
all_categories = sorted(set(cats9) | set(cats10))
|
|
198
|
-
df_combined = df9.join(
|
|
173
|
+
df_combined = df9.join(
|
|
174
|
+
df10, on=id_col, how="outer", suffix="_right", coalesce=True
|
|
175
|
+
)
|
|
199
176
|
for cat in all_categories:
|
|
200
177
|
left = cat
|
|
201
178
|
right = f"{cat}_right"
|
|
@@ -36,6 +36,7 @@ def GagneComorbidityIndex(
|
|
|
36
36
|
icd_version: str = "icd9",
|
|
37
37
|
icd_version_col: str = None,
|
|
38
38
|
return_categories=False,
|
|
39
|
+
gagne_name: bool = False,
|
|
39
40
|
):
|
|
40
41
|
"""
|
|
41
42
|
Calculate the Gagne Comorbidity Index using ICD codes.
|
|
@@ -49,7 +50,7 @@ def GagneComorbidityIndex(
|
|
|
49
50
|
return_categories (bool): If True, also return presence indicators for each Gagne category.
|
|
50
51
|
|
|
51
52
|
Returns:
|
|
52
|
-
- DataFrame with [id_col, "
|
|
53
|
+
- DataFrame with [id_col, "Combined Comorbidity Score"].
|
|
53
54
|
- DataFrame with category indicators if return_categories is True, else None.
|
|
54
55
|
"""
|
|
55
56
|
|
|
@@ -68,9 +69,9 @@ def GagneComorbidityIndex(
|
|
|
68
69
|
definition_file = "GAGNE.csv"
|
|
69
70
|
definition_file_path = Path(__file__).parent / f"common/{definition_file}"
|
|
70
71
|
weight_col_name = "weights"
|
|
71
|
-
score_col_name = "Gagne Score"
|
|
72
|
+
score_col_name = "Gagne Score" if gagne_name else "Combined Comorbidity Score"
|
|
72
73
|
|
|
73
|
-
# Define mutual exclusion rules for
|
|
74
|
+
# Define mutual exclusion rules for combined score
|
|
74
75
|
mutual_exclusion_rules = [
|
|
75
76
|
("Complicated diabetes", "Uncomplicated diabetes")
|
|
76
77
|
]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
__author__ = """Finn Fassbender"""
|
|
4
4
|
__email__ = "finn.fassbender@charite.de"
|
|
5
|
-
__version__ = "0.4"
|
|
5
|
+
__version__ = "0.4.2"
|
|
6
6
|
|
|
7
7
|
from .CharlsonComorbidityIndex import CharlsonComorbidityIndex
|
|
8
8
|
from .ElixhauserComorbidityIndex import ElixhauserComorbidityIndex
|
|
@@ -94,6 +94,7 @@ def comorbidity(
|
|
|
94
94
|
icd_version=icd_version,
|
|
95
95
|
icd_version_col=icd_version_col,
|
|
96
96
|
return_categories=return_categories,
|
|
97
|
+
gagne_name="gagne" in score,
|
|
97
98
|
)
|
|
98
99
|
elif score in (
|
|
99
100
|
"hfrs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pycomorb
|
|
3
|
-
Version: 0.4
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: Comorbidity and frailty score calculation utilities (Charlson, Elixhauser, Gagne, HFRS) using polars
|
|
5
5
|
Author-email: Finn Fassbender <finn.fassbender@charite.de>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -32,7 +32,7 @@ It is inspired by the R package [`comorbidity`](https://github.com/ellessenne/co
|
|
|
32
32
|
|
|
33
33
|
## Supported Variants
|
|
34
34
|
|
|
35
|
-
See [common/README.md](src/pycomorb/common/README.md) for more details and references.
|
|
35
|
+
See [common/README.md](https://github.com/CUB-CORR/pycomorb/blob/main/src/pycomorb/common/README.md) for more details and references.
|
|
36
36
|
|
|
37
37
|
### Charlson Comorbidity Index
|
|
38
38
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|