Skip to main content

patient

Criteria on the patient's own record (FHIR Patient).

The alive leaf (AliveCriterion): the EHR does not record the patient as deceased. Read from the deceased column of the EHR data.

Module​

Functions​

alive_leaf_filter​

def alive_leaf_filter(criterion: AliveCriterion, ctx: FilterBuildContext) ‑> MethodFilter:

Build a MethodFilter for an AliveCriterion criteria_tree leaf.

Arguments

  • criterion: The leaf to compile; it has nothing to configure.
  • ctx: What the filter builders share; unused here.

Returns A MethodFilter that passes a patient not recorded as deceased, and degrades to unknown when DECEASED_COL is absent or empty.

Classes​

AliveCriterion​

class AliveCriterion(**data: Any):

The EHR does not record the patient as deceased.

Reads FHIR Patient.deceased[x] (https://hl7.org/fhir/R4/patient-definitions.html#Patient.deceased_x_), which both the FHIR R4 and the NextGen backends fetch with the patient's demographics:

  • deceasedBoolean: true, or any deceasedDateTime, fails.
  • deceasedBoolean: false passes, and so does a Patient resource with no deceased[x] at all. FHIR R4 calls an absent value "no statement", but notes that "most systems will interpret the absence of a value as a sign of the person being alive"; most EHRs only ever set it on death.
  • A patient whose Patient resource was not read is unknown: one the EHR lookup did not find, or one whose ehr_data row was written before the deceased column existed (cache v9) and has not been refreshed since.

Arguments

  • node: Discriminator identifying this as an alive-type criteria_tree node.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables​

  • static model_config
  • static node : Literal['alive']

Methods​


model_post_init​

def model_post_init(self: BaseModel, context: Any, /) ‑> None:

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that's what pydantic-core passes when calling it.

Arguments

  • self: The BaseModel instance.
  • context: The context.