gpsea.analysis.predicate package
- class gpsea.analysis.predicate.PatientCategory(cat_id: int, name: str, description: str | None = None)[source]
Bases:
object
PatientCategory represents one of several exclusive discrete groups.
Patient category has
cat_id
, a unique numeric identifier of the group,name
with human-readable group name, anddescription
with an optional verbose description.
- class gpsea.analysis.predicate.PatientCategories[source]
Bases:
object
A static utility class to serve common patient categories.
- YES = PatientCategory(cat_id=1, name=Yes, description=The patient belongs to the group.)
Category for a patient who belongs to the tested group.
- NO = PatientCategory(cat_id=0, name=No, description=The patient does not belong to the group.)
Category for a patient who does not belong to the tested group.
- class gpsea.analysis.predicate.Categorization(category: PatientCategory)[source]
Bases:
object
Categorization represents one of discrete group a
Patient
can be assigned into.- static from_raw_parts(cat_id: int, name: str, description: str | None = None)[source]
Create Categorization from the cat_id identifier, name, and an optional description.
- property category: PatientCategory
- class gpsea.analysis.predicate.PolyPredicate[source]
Bases:
Generic
[C
]PolyPredicate bins a
Patient
into one of several discrete groups represented byCategorization
.The groups must be exclusive - the patient can be binned into one and only one group, and exhaustive - the groups must cover all possible scenarios.
However, if the patient cannot be assigned into any meaningful category, None can be returned. As a rule of thumb, returning None will exclude the patient from the analysis.
- abstract get_categorizations() Sequence[C] [source]
Get a sequence of all categories which the PolyPredicate can produce.
- get_categories() Iterator[PatientCategory] [source]
Get an iterator with
PatientCategory
instances that the predicate can produce.
- get_category_names() Iterator[str] [source]
Get an iterator with names of the
PatientCategory
items that the predicate can produce.
- get_category(cat_id: int) PatientCategory [source]
Get the category name for a
PatientCategory.cat_id
.- Parameters:
cat_id – an int with the id.
- Raises:
ValueError if there is no such category was defined.
- get_category_name(cat_id: int) str [source]
Get the category name for a
PatientCategory.cat_id
.- Parameters:
cat_id – an int with the id.
- Raises:
ValueError if there is no such category was defined.
- abstract get_question_base() str [source]
Prepare a str with the question the predicate can answer.
- display_question() str [source]
Prepare the question which the predicate can answer.
The question includes the question base and the category names