module documentation

Calculation of comorbidity score based on the structure of the ICD-10 described in Stausberg; Hagn (2015): New Morbidity and Comorbidity Scores based on the Structure of the ICD-10 DOI: 10.1371/journal.pone.0143365.

There are two variants described: ICD-10-groups or ICD-10-chapters. The module currently implements the group variant only.

Function weight_by_icd_group Give the comorbidity-score per person.
Function _groups_code_dataframe Return data frame with ICD3 codes corresponding to icd_groups.
Constant _ARTIFACT_APPENDIX Undocumented
Constant _GROUP_WEIGHTS Stausberg scores per ICD group.
Variable _log Logger instance for that module.
def weight_by_icd_group(data: pandas.DataFrame, index_column: str, icd_column: str, weight_name: str = 'weight', ignored_icds: tuple = 'UUU', exclude_appendix_artifact: bool = True) -> pandas.DataFrame: (source)

Give the comorbidity-score per person.

The function use the ICD-10-groups variant as Comorbidity Scores based on the Structure of the ICD-10 by Stausberg and Hagn, 2015 DOI: 10.1371/journal.pone.0143365.

One ICD-group can be scored with values between -131 and +6. The range of the score per person can be between -176 and +71. Regarding to the discussion in the original publication the ICD group of appendix diseases (K35-K38 with score value of -131) can (and is by default) excluded from the scores calculation. Because of that by default the lowest possible score per group is -5 and per person -45.

Parameters
data:pandas.DataFrameInput date.
index_column:strName of column which is grouped for (e.g. Person ID).
icd_column:strName of column with specific ICD codes internally converted into ICD-10-groups.
weight_name:strName of resulting column with weight/score values.
ignored_icds:tupleCodes that are ignored in the input data.
exclude_appendix_artifact:boolICD codes belonging to the ICD group K35-K38 is excluded from score calculation.
Returns
pandas.DataFrameA new data frame with two columns.
def _groups_code_dataframe(icd_groups: list) -> pandas.DataFrame: (source)

Return data frame with ICD3 codes corresponding to icd_groups.

Example

The two groups ['T15-T19', 'T80-T88'] will be converted into ['T15', 'T16', .., 'T19', 'T80', .., 'T88'].

Parameters
icd_groups:listList of ICD groups. e.g. ["A01-A06", "X14-X20"]
Returns
pandas.DataFrameA data frame with column ICD3 and GROUP.
Raises
ValueErrorIf the format of the group string is invalid.
_ARTIFACT_APPENDIX: str = (source)

Undocumented

Value
'K35-K38'
_GROUP_WEIGHTS: dict[str, int] = (source)

Stausberg scores per ICD group.

Value
{'C00-C97': 4,
 'D10-D36': -5,
 'D60-D64': 1,
 'D65-D69': 1,
 'E00-E07': -2,
 'E50-E64': -7,
 'E65-E68': -2,
...

Logger instance for that module.