Skip to main content
Version: 3.1

Immunization recommendation

Technical reference for the ImmunizationRecommendation model in Care EMR. A recommendation is one planned vaccine dose in a patient's schedule, or a group that holds other recommendations. It maps to the FHIR ImmunizationRecommendation resource, with one Care row for each planned dose.

Recommendations usually come from an immunization policy: the apply_policy action copies the policy template into a tree of recommendations for one patient. An immunization record can point to the recommendation that it fulfils.

Source:

Models​

ModelPurpose
ImmunizationRecommendationOne planned dose (is_group = false) or a group of recommendations (is_group = true) for one patient

It extends EMRBaseModel. The same model file also holds Immunization (Immunization) and ImmunizationPolicy (Immunization policy).

ImmunizationRecommendation fields​

Clinical details​

These fields come from BaseImmunizationRecommendationSpec. The policy template uses the same base.

FieldTypeSpec typeNotes
codesJSONField, default []list[Coding], each bound to system-medicationThe vaccines. Required and not empty when is_group is false. Optional for a group
diseasesJSONField, nullablelist[Coding], each bound to system-condition-codeOptional. Target diseases
earliest_dateDateField, nullabledateOptional
due_dateDateField, nullabledateOptional
overdue_dateDateField, nullabledateOptional
descriptionTextField, nullablestrOptional
seriesCharField(255), nullablestrOptional. Free text
dose_numberCharField(255), nullablestrOptional. Free text, not a number
series_numberCharField(255), nullablestrOptional. Free text. care_fe shows it as the number of doses in the series

The recommendation specs do not check the order of the three dates. Only the policy template checks the order of its day offsets.

Status and tree​

FieldTypeSpec typeNotes
forecast_statusCharField(100)ImmunizationRecommendationForecastStatusRequired on create. Optional on update. See forecast status values
is_groupBooleanFieldboolRequired on create. Write once
parentFK → self, CASCADE, nullable, related_name="children"UUID4 or nullOptional. Write once. Must be a group (is_group = true) of the same patient. A root recommendation has no parent
FieldTypeSpec typeNotes
patientFK → Patient, CASCADEUUID4Required on create. Must match the patient in the URL. Write once
encounterFK → Encounter, CASCADE, nullableUUID4 or nullOptional. Write once. Must belong to the patient. Decides which permission check applies (see below)

Optional value fields accept a value or no key. They do not accept null. A key that an update leaves out keeps its stored value.

Enum values​

ImmunizationRecommendationForecastStatus values​

Valuecare_fe label
dueDue
immuneImmune
contraindicatedContraindicated
completeComplete

Care does not store "overdue" or "upcoming". care_fe derives them from a due recommendation and its dates:

  • Overdue: today is on or after overdue_date. Without overdue_date, today is after due_date.
  • Upcoming: not overdue, and today is before earliest_date.
  • Due: every other due recommendation.

Nested JSON shapes​

Coding (each item of codes and diseases)​

Coding {
system: str | null
version: str | null
code: str # required
display: str | null
}

Care validates each code against the bound value set.

Resource specs (API schema)​

SpecRoleFields
BaseImmunizationRecommendationSpecShared base, also used by the policy templateid, codes, diseases, due_date, earliest_date, overdue_date, description, series, dose_number, series_number
ImmunizationRecommendationCreateSpecwrite · createBase fields plus parent, patient, encounter, is_group, forecast_status. Rejects a non-group with no codes
ImmunizationRecommendationUpdateSpecwrite · updateBase fields plus forecast_status. No parent, patient, encounter or is_group. Rejects an update that would leave a non-group with no codes
ImmunizationRecommendationListSpecread · listBase fields plus forecast_status, is_group, parent (UUID or null)
ImmunizationRecommendationRetrieveSpecread · detailList fields plus patient, encounter (UUID or null), created_by, updated_by

Applying a policy​

POST /api/v1/patient/{patient_external_id}/immunization/recommendation/apply_policy/ creates the recommendation tree of one policy for the patient.

Request (ImmunizationPolicyApplySpec):

{
policy: UUID4 # required
reference_date: date # required. Day offsets count from this date
encounter: UUID4 | null # optional. Must belong to the patient
parent: UUID4 | null # optional. An existing group of the patient
}

Behaviour:

  • Care creates one recommendation for each node of the template, groups included, with the same tree structure. A parent in the request attaches the new root under that group.
  • Each node copies its own clinical fields. A group's fields do not pass to its children.
  • earliest_date, due_date and overdue_date are reference_date plus the node's day offset. A date outside the supported range returns a validation error.
  • Every new recommendation gets forecast_status = due, the request's encounter and the URL's patient.
  • Care creates the whole tree in one transaction. If one node fails, Care creates none.
  • The response is 201 with a list of ImmunizationRecommendationRetrieveSpec objects, one for each created node.
  • For a facility policy, the user needs can_read_immunization_policy in that facility. If encounter is set, it must be an encounter of the policy's facility.
  • If parent belongs to an encounter, the request's encounter must be the same encounter.

care_fe does not apply a policy that has more than 20 non-group recommendations. The backend has no such limit.

API integration notes​

  • Endpoints are nested under the patient: /api/v1/patient/{patient_external_id}/immunization/recommendation/. The viewset allows create, list, retrieve, update and apply_policy. It has no delete.
  • Filters: encounter, parent (UUIDs), root (true for recommendations with no parent), is_group, forecast_status (comma-separated, several values), due_date_after, due_date_before. Ordering: created_date, modified_date, due_date.
  • Write (create, update and apply_policy): a recommendation with an encounter needs can_write_immunization_recommendation in that encounter, and Care refuses it when the encounter is closed (completed, cancelled, entered_in_error or discontinued). A recommendation without an encounter needs the permission on the patient.
  • Read: can_read_immunization_recommendation on the patient, or in the recommendation's encounter. A list without the patient permission must pass an encounter filter for an encounter that the user can read.
  • Default roles with can_write_immunization_recommendation: Facility Admin, Doctor, Nurse. Default roles with can_read_immunization_recommendation: Facility Admin, Administrator, Staff, Doctor, Nurse, Volunteer, Pharmacist.
  • Recording an immunization against a recommendation does not change forecast_status. The client sets complete with an update.