class documentation

class BaseStatistics(BaseModel):

View In Hierarchy

Basic statistics to be computed and displayed on the dashboard.

This defines the base class with counts of the basic patient and tumor information. It also defines the classmethod to compute the statistics from a dataset. In a dynamically created subclass of this one, the fields for every LNL ipsi- and contralaterally are added to the Statistics class.

Class Method from_table Compute statistics from a table of patients.
Class Variable central For how many patients was the tumor located centrally, for how many not?
Class Variable datasets How many patients are in each dataset.
Class Variable hpv Patients with or without HPV.
Class Variable is_n_plus Number of patients with or without N+ status.
Class Variable midext Number of patients with or without tumors crossing the midline.
Class Variable sex Number of male and female patients.
Class Variable smoke Number of patients who did or did not smoke.
Class Variable subsite Number of patients with tumors in different subsites.
Class Variable surgery Number of patients that did or did not undergo surgery.
Class Variable t_stage Counts of patients with different T-stages.
Property total Return the total number of patients in the dataset.
@classmethod
def from_table(cls: type[T], table: pd.DataFrame, method: Literal['max_llh', 'rank'] = 'max_llh') -> T:

Compute statistics from a table of patients.

This method computes e.g. how many patients in the queried table are HPV positive, or how many patients have a certain T-stage. The statistics are computed from the queried table and passed to the context of the dataexplorer.views. From there, the statistics can be displayed in the rendered HTML or JSON response.

For how many patients was the tumor located centrally, for how many not?

datasets: dict[str, int] =

How many patients are in each dataset.

Patients with or without HPV.

Number of patients with or without N+ status.

Number of patients with or without tumors crossing the midline.

Number of male and female patients.

Number of patients who did or did not smoke.

subsite: SubsiteCounts =

Number of patients with tumors in different subsites.

Number of patients that did or did not undergo surgery.

t_stage: TStageCounts =

Counts of patients with different T-stages.

@computed_field
@property
total: int =

Return the total number of patients in the dataset.