Skip to main content

Data Model

The app uses three domain objects. All are immutable Java record types (except SmartLaunchContext which is mutable session state). There is no database — all data comes from HAPI FHIR R4 via the ImmunizationFhirService.

VaccinationRecord

Wraps one FHIR Immunization resource, flattened for template rendering and JSON serialisation.

FieldTypeFHIR sourceNotes
fhirIdStringImmunization.idHAPI logical ID
vaccineCodeStringImmunization.vaccineCode.coding[0].codeCVX (US), SNOMED CT, ICD-11
vaccineNameStringImmunization.vaccineCode.coding[0].display or .textHuman-readable name
vaccineSystemStringImmunization.vaccineCode.coding[0].systeme.g. http://hl7.org/fhir/sid/cvx
occurrenceDateLocalDateImmunization.occurrenceDateTimeConverted from HAPI DateTimeType
lotNumberStringImmunization.lotNumberFor safety recalls
performerOrganisationRefStringImmunization.performer[0].actor.referenceFHIR Organisation reference
performerDisplayStringImmunization.performer[0].actor.displayFacility name
doseNumberStringImmunization.protocolApplied[0].doseNumber"1", "2", "Booster"
seriesNameStringImmunization.protocolApplied[0].seriesGroups related doses
statusStringImmunization.status.toCode()completed, entered-in-error, not-done
routeStringImmunization.route.coding[0].display"IM", "SC", "PO"
siteStringImmunization.site.coding[0].display"Left deltoid"
noteStringImmunization.note[0].textClinician notes or reactions
patientReportedbooleanImmunization.reportedBooleanTypeTrue for self-reported vaccinations

Business methods

isValid() — returns true when status == "completed" AND occurrenceDate != null. Used to filter records for the VDS-NC certificate (only completed records with a known date are included).

shortLabel() — returns the vaccineName truncated to 40 characters if needed, falling back to vaccineCode, then "Unknown vaccine". Used in the dashboard recent-history card and certificate table.

VaccineRecommendation

Wraps one entry from a FHIR ImmunizationRecommendation.recommendation[] array.

FieldTypeFHIR sourceNotes
fhirIdStringImmunizationRecommendation.idParent resource ID
vaccineCodeStringrecommendation.vaccineCode[0].coding[0].code
vaccineNameStringrecommendation.vaccineCode[0].coding[0].display
forecastStatusStringrecommendation.forecastStatus.coding[0].codedue, overdue, immune, contraindicated
dateCriterionDueLocalDatedateCriterion where code = 30100Earliest recommended date
dateCriterionLatestLocalDatedateCriterion where code = 30101Latest recommended date
doseNumberStringrecommendation.doseNumber
seriesNameStringrecommendation.series
seriesDosesRequiredStringrecommendation.seriesDosesTotal doses in the series
descriptionStringrecommendation.descriptionForecast narrative

Business methods

isOverdue()true if forecastStatus == "overdue" OR dateCriterionDue is before today AND the patient is not immune.

isDueWithin30Days()true if due date is within the next 30 days (inclusive).

statusBadgeClass() — returns a CSS class string for the status badge: badge-overdue, badge-due, badge-immune, badge-contraindicated, or badge-neutral.

SmartLaunchContext

Mutable session object stored in the HTTP session under the key "SMART_LAUNCH_CONTEXT". Contains both pre-handshake data (cleared after /callback) and post-handshake data.

Post-handshake fields (used by views and services)

FieldSource
accessTokenaccess_token from token response
refreshTokenrefresh_token from token response
patientIdpatient top-level field in token response
encounterIdencounter top-level field (may be null)
needPatientBannerneed_patient_banner top-level field
scopescope from token response (space-separated)
expiresAtInstant.now() + expires_in seconds
fhirBaseUrliss from the /launch request
clinicianNamename claim from id_token
fhirUserfhirUser claim from id_token

Pre-handshake fields (cleared after /callback)

FieldPurpose
pkceVerifier96-byte S256 verifier, sent in token exchange
pkceState32-byte CSRF state, validated on callback
nonce32-byte nonce, validated in id_token
issISS from launch, used for token exchange

Session serialisation

All fields are primitives, String, or Instant. The class implements Serializable with serialVersionUID = 1L for Redis-based session replication in multi-instance deployments.


Next: Caching →