Skip to main content
Version: 3.1

Immunization

Technical reference for the Immunization model in Care EMR. An Immunization records one vaccine dose for one patient in one encounter: a dose that the facility gave, a dose that the patient or another provider reports, or a dose that was not given. It maps to the FHIR Immunization resource.

The Django model stores the record. Several fields are JSONFields. The Pydantic resource specs bind them to value sets and give them a shape, so read the spec columns below for what a write must contain.

Source:

Models​

care/emr/models/immunisation.py holds three models. This page documents Immunization. The other two have their own pages.

ModelPurposePage
ImmunizationOne vaccine dose given, reported or not givenThis page
ImmunizationRecommendationOne planned dose, or a group of planned doses, in a patient's scheduleImmunization recommendation
ImmunizationPolicyA reusable template of recommendations, for one facility or for the instanceImmunization policy

All three extend EMRBaseModel, which gives external_id, the audit fields, soft delete through deleted, history and meta.

Immunization fields​

Status and vaccine​

FieldTypeSpec typeNotes
statusCharField(100)ImmunizationStatusRequired on create. Optional on update. See ImmunizationStatus values
reasonCharField(100), nullableImmunizationReasonOptional. Why the dose was not given. The backend does not tie it to not_done; the care_fe form asks for it only when status is not_done
codeJSONField, default {}Coding, bound to system-medicationRequired on create. Optional on update. The vaccine
primary_sourceBooleanFieldboolRequired on create. Optional on update. true when the facility gave the dose. The care_fe form sends false for a historical (reported) record
occurrenceDateTimeField, nullabledatetimeOptional. When the dose was given

Administration details​

FieldTypeSpec typeNotes
siteJSONField, nullableCoding, bound to system-body-siteOptional
routeJSONField, nullableCoding, bound to system-routeOptional
dose_quantityJSONField, nullableQuantityOptional. See Nested JSON shapes
is_subpotentBooleanField, nullableboolOptional
subpotent_reasonTextField, nullablestrOptional. Free text
noteTextField, nullablestrOptional. Free text
FieldTypeSpec typeNotes
encounterFK → Encounter, CASCADEUUID4Required on create. Write once: the update spec has no encounter field. See Encounter
patientFK → Patient, CASCADE—Server-set from the encounter. Not in any read spec
facilityFK → Facility, PROTECT—Server-set from the encounter. Not in any read spec
recommendationFK → ImmunizationRecommendation, SET_NULL, nullableUUID4 or nullOptional. Must belong to the same patient. null clears it
productFK → Product, SET_NULL, nullableUUID4 or nullOptional. Must belong to the encounter's facility. See Product
locationFK → FacilityLocation, SET_NULL, nullableUUID4 or nullOptional. Must belong to the encounter's facility. See Location
administered_byFK → users.User, SET_NULL, nullablestr (username) or nullOptional. Written as a username, read back as a UserSpec object

Optional value fields (reason, occurrence, site, route, dose_quantity, is_subpotent, subpotent_reason, note) accept a value or no key. They do not accept null. The writer uses exclude_defaults, so a key that an update leaves out keeps its stored value.

Enum values​

ImmunizationStatus values​

Valuecare_fe label
draftDraft
completedCompleted
entered_in_errorEntered in error
not_doneNot given

ImmunizationReason values​

HL7 v3 ActReason codes. The labels come from care_fe.

Valuecare_fe label
IMMUNEPatient is immune
MEDPRECMedical precaution
OSTOCKVaccine out of stock
PATOBJPatient objection
PHILISOPPhilosophical objection
RELIGReligious objection
VACEFFVaccine efficacy concerns
VACSAFVaccine safety concerns

Nested JSON shapes​

Coding (code, site, route)​

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

Extra keys are rejected. Care validates the code against the bound value set (system-medication, system-body-site or system-route).

Quantity (dose_quantity)​

Quantity {
value: Decimal | null # max 20 digits, 6 decimal places
unit: Coding | null
code: Coding | null
meta: dict | null
}

Extra keys are rejected.

Resource specs (API schema)​

SpecRoleFields beyond BaseImmunizationSpec
BaseImmunizationSpecShared baseid, status, reason, code, occurrence, primary_source, site, route, dose_quantity, note, is_subpotent, subpotent_reason
ImmunizationWriteSpecShared write baserecommendation, product, location, administered_by. Resolves each link and checks its scope
ImmunizationCreateSpecwrite · createencounter (required). Sets patient and facility from the encounter
ImmunizationUpdateSpecwrite · updateMakes status, code and primary_source optional. No encounter
ImmunizationListSpecread · listencounter (UUID), recommendation (UUID or null), administered_by (UserSpec or null)
ImmunizationRetrieveSpecread · detailList fields plus product, location (UUIDs or null), created_by, updated_by

The read specs do not return patient or facility.

API integration notes​

  • Endpoints are nested under the patient: /api/v1/patient/{patient_external_id}/immunization/record/. The viewset allows create, list, retrieve and update. It has no delete. To void a record, set status to entered_in_error.
  • Create checks that the encounter belongs to the patient in the URL.
  • Filters: encounter, recommendation, facility (UUIDs), status and reason (comma-separated, several values), occurrence (occurrence_after / occurrence_before), primary_source. Ordering: created_date, modified_date.
  • Create and update need can_write_immunization in the encounter. Care refuses both when the encounter status is completed, cancelled, entered_in_error or discontinued. Update checks the record's own encounter.
  • Read needs can_read_immunization on the patient, or in the record's encounter. A list without can_read_immunization on the patient must pass an encounter filter for an encounter that the user can read.
  • Default roles with can_write_immunization: Facility Admin, Doctor, Nurse. Default roles with can_read_immunization: Facility Admin, Administrator, Staff, Doctor, Nurse, Volunteer, Pharmacist. See Permission.
  • Saving a record does not change its recommendation. care_fe sets the recommendation's forecast_status to complete with a separate update after it saves a completed dose.
  • A referral can link an immunization as a resource of type immunization. Care renders it with ImmunizationListSpec for users who can view the patient's or the encounter's clinical data.