onconova.oncology.models.comorbidities
CharlsonPanelDetails()
dataclass
¶
Class that provides comorbidity categories and scoring logic for the Charlson Comorbidity Index.
References
- C. N. Klabunde et al., Annals of Epidemiology,Volume 17, Issue 8, 2007, 584-590
- Quan H et al., Medical Care 2005; 43(11):1130-1139.
acute_mi
class-attribute
instance-attribute
¶
aids
class-attribute
instance-attribute
¶
chf
class-attribute
instance-attribute
¶
cpd
class-attribute
instance-attribute
¶
cvd
class-attribute
instance-attribute
¶
dementia
class-attribute
instance-attribute
¶
diabates_complications
class-attribute
instance-attribute
¶
diabetes
class-attribute
instance-attribute
¶
history_mi
class-attribute
instance-attribute
¶
liver_disease
class-attribute
instance-attribute
¶
mild_liver_disease
class-attribute
instance-attribute
¶
paralysis
class-attribute
instance-attribute
¶
pvd
class-attribute
instance-attribute
¶
renal_disease
class-attribute
instance-attribute
¶
rheumatic_disease
class-attribute
instance-attribute
¶
ulcers
class-attribute
instance-attribute
¶
get_score_annotation()
classmethod
¶
Constructs a Django ORM annotation that calculates the total comorbidity score for a patient based on the presence of specific condition codes. Each condition code is mapped to a weight, and the sum of these weights is computed using conditional logic.
Returns:
Type | Description |
---|---|
Sum
|
An annotation expression that can be used in queryset aggregation |
Sum
|
to compute the total comorbidity score for each patient. |
Source code in onconova/oncology/models/comorbidities.py
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 |
|
ComorbiditiesAssessment
¶
Bases: BaseModel
Represents an assessment of patient comorbidities within a specific clinical case.
Attributes:
Name | Type | Description |
---|---|---|
COMORBIDITY_PANELS_DETAILS |
dict
|
Maps comorbidity panel types to their detail classes. |
objects |
QueryablePropertiesManager
|
Custom manager for querying properties. |
case |
ForeignKey[PatientCase]
|
Reference to the patient case being assessed. |
date |
DateField
|
Date when the comorbidities assessment was performed. |
index_condition |
ForeignKey[NeoplasticEntity]
|
The primary neoplastic entity for comorbidity assessment. |
panel |
CharField
|
Type of comorbidities panel used for assessment. |
present_conditions |
CodedConceptField[ICD10Condition]
|
List of present comorbid conditions (ICD-10). |
absent_conditions |
CodedConceptField[ICD10Condition]
|
List of absent comorbid conditions (ICD-10). |
score |
AnnotationProperty
|
Calculated comorbidity score based on the selected panel. |
COMORBIDITY_PANELS_DETAILS
class-attribute
instance-attribute
¶
absent_conditions
class-attribute
instance-attribute
¶
case
class-attribute
instance-attribute
¶
date
class-attribute
instance-attribute
¶
description
property
¶
index_condition
class-attribute
instance-attribute
¶
objects
class-attribute
instance-attribute
¶
panel
class-attribute
instance-attribute
¶
present_conditions
class-attribute
instance-attribute
¶
score
class-attribute
instance-attribute
¶
ComorbiditiesAssessmentPanelChoices
¶
Bases: TextChoices
An enumeration of comorbidity panel types used in oncology models.
Attributes:
Name | Type | Description |
---|---|---|
CHARLSON |
Represents the Charlson comorbidity index panel. |
|
ELIXHAUSER |
Represents the Elixhauser comorbidity index panel. |
|
NCI |
Represents the National Cancer Institute (NCI) comorbidity index panel. |
ComorbidityPanelCategory(label, default, codes, weight)
dataclass
¶
Represents a category within a comorbidity panel, including its label, default value, associated codes, and weight.
Attributes:
Name | Type | Description |
---|---|---|
label |
str
|
The display name of the comorbidity category. |
default |
str
|
The default value or code for the category. |
codes |
List[str]
|
A list of codes associated with this category. |
weight |
int | float
|
The numerical weight assigned to this category. |
Methods:
Name | Description |
---|---|
get_weight |
List[str]) -> int | float: Returns the weight of the category if any of the provided codes match the category's codes; otherwise, returns 0. |
ElixhauserPanelDetails()
dataclass
¶
This class defines the Elixhauser comorbidity index panel, mapping ICD codes to comorbidity categories and their respective weights.
Each comorbidity is represented as a class attribute, instantiated as a ComorbidityPanelCategory
with a label, default ICD code, a list of ICD codes, and a weight.
References
- van Walraven al., Medical Care 47(6):p 626-633, June 2009.
- Quan H et al., Medical Care 2005; 43(11):1130-1139.
aids
class-attribute
instance-attribute
¶
alcohol
class-attribute
instance-attribute
¶
blane
class-attribute
instance-attribute
¶
carit
class-attribute
instance-attribute
¶
chf
class-attribute
instance-attribute
¶
coag
class-attribute
instance-attribute
¶
cpd
class-attribute
instance-attribute
¶
dane
class-attribute
instance-attribute
¶
depre
class-attribute
instance-attribute
¶
diabc
class-attribute
instance-attribute
¶
diabunc
class-attribute
instance-attribute
¶
drug
class-attribute
instance-attribute
¶
fed
class-attribute
instance-attribute
¶
hypc
class-attribute
instance-attribute
¶
hypothy
class-attribute
instance-attribute
¶
hypunc
class-attribute
instance-attribute
¶
ld
class-attribute
instance-attribute
¶
obes
class-attribute
instance-attribute
¶
ond
class-attribute
instance-attribute
¶
para
class-attribute
instance-attribute
¶
pcd
class-attribute
instance-attribute
¶
psycho
class-attribute
instance-attribute
¶
pud
class-attribute
instance-attribute
¶
pvd
class-attribute
instance-attribute
¶
rf
class-attribute
instance-attribute
¶
rheumd
class-attribute
instance-attribute
¶
valv
class-attribute
instance-attribute
¶
wloss
class-attribute
instance-attribute
¶
get_score_annotation()
classmethod
¶
Calculates the total comorbidity score annotation for a queryset by summing the weights of present conditions.
This method returns a Django ORM annotation that uses a conditional sum (Sum + Case + When) to assign
specific weights to each condition code found in present_conditions__code
. Each condition group (e.g., chf, carit, valv)
has its own set of codes and associated weight. If a condition code matches one of the predefined groups,
its corresponding weight is added to the total score. If no match is found, a default value of 0 is used.
Returns:
Type | Description |
---|---|
Sum
|
An annotation that can be used in queryset aggregation to compute the total score. |
Source code in onconova/oncology/models/comorbidities.py
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 |
|
NciPanelDetails()
dataclass
¶
This class defines comorbidity categories and their associated ICD codes and weights for the NCI comorbidity panel.
Each comorbidity is represented as a ComorbidityPanelCategory
with a label, default ICD code, a list of ICD codes, and a weight.
References
- C. N. Klabunde et al., Annals of Epidemiology, Volume 17, Issue 8, 2007, 584-590
- Quan H et al., Medical Care 2005; 43(11):1130-1139.
acute_mi
class-attribute
instance-attribute
¶
aids
class-attribute
instance-attribute
¶
chf
class-attribute
instance-attribute
¶
cpd
class-attribute
instance-attribute
¶
cvd
class-attribute
instance-attribute
¶
dementia
class-attribute
instance-attribute
¶
diabates_complications
class-attribute
instance-attribute
¶
diabetes
class-attribute
instance-attribute
¶
history_mi
class-attribute
instance-attribute
¶
liver_disease
class-attribute
instance-attribute
¶
mild_liver_disease
class-attribute
instance-attribute
¶
paralysis
class-attribute
instance-attribute
¶
pvd
class-attribute
instance-attribute
¶
renal_disease
class-attribute
instance-attribute
¶
rheumatic_disease
class-attribute
instance-attribute
¶
ulcers
class-attribute
instance-attribute
¶
get_score_annotation()
classmethod
¶
Generates a Django ORM annotation that calculates the weighted comorbidity score for a queryset.
The score is computed by summing the weights of present comorbid conditions, based on their codes. Each condition is checked against its respective code list, and the corresponding weight is applied. Special handling is provided for diabetes and liver disease, where the weight depends on whether complications or severity are present.
Returns:
Name | Type | Description |
---|---|---|
Sum |
Sum
|
A Django ORM annotation representing the total comorbidity score as a float. |
Source code in onconova/oncology/models/comorbidities.py
1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 |
|