Step 4 · Build the kiosk app
Sign the nurse in, look patients up through the register, check identity, and save each reading to the patient's pseudonymous Ovok Patient.
A web app for a ward tablet: one sign-in per shift, then scan, check, record and hand over, patient after patient.
Before you begin
- The function from step 3, running.
@ovok/core0.4.58 or newer. The example pins 0.4.58.
Configure the kioskClient-side
VITE_OVOK_API_BASE_URL=https://api.sandbox.ovok.com
VITE_OVOK_TENANT_CODE={{TENANT_CODE}}
VITE_SUPABASE_URL=http://127.0.0.1:54321
VITE_STATION_NAME=Ward 3 measurement stationThese are browser-visible settings, not secrets. The kiosk holds no Supabase key: the function is its only way into the register.
Sign the nurse inClient-side
Create one Ovok client and sign the nurse in as a practitioner. Keeping the session in sessionStorage survives a reload mid-shift and ends when the tab closes.
export const ovok = new Ovok({
baseUrl: config.ovokBaseUrl,
tenantCode: config.tenantCode,
fhirPath: "/fhir/R4/",
storage: window.sessionStorage,
timeoutMs: 15_000,
});const result = await ovok.auth.login({ profileType: "Practitioner", email, password });
if (result.status === "mfa-required") setChallenge(result.challenge);The function needs the same token. Read it from the session, and let the SDK renew it first when it is about to expire:
export async function accessToken(): Promise<string> {
const session = await ovok.session.current();
if (!session) throw new SignedOutError();
if (session.expiresAt - Date.now() > TOKEN_MARGIN_MS) return session.accessToken;
await ovok.auth.me();
const renewed = await ovok.session.current();
if (!renewed) throw new SignedOutError();
return renewed.accessToken;
}Look the patient upClient-side
A barcode scanner types the card code and presses Enter, so the scan field is an ordinary form. The kiosk posts the code to the function with the nurse's token:
const response = await fetch(`${config.supabaseUrl}/functions/v1/patients/_search`, {
method: "POST",
headers: { authorization: `Bearer ${await accessToken()}`, "content-type": "application/json" },
body: JSON.stringify({ cardCode }),
});A 404 means nobody has the card; the kiosk offers to register it, which posts the new patient to /functions/v1/patients.
Check identity, then saveClient-side
The kiosk shows the name and date of birth in large type and unlocks the reading form only after the nurse confirms both with the patient. Then it saves the reading for that patient's Ovok Patient:
const measurement: BloodPressureMeasurement = {
measurementTypeKey: MeasurementTypeKey.bloodPressure,
systolic: entry.systolic,
diastolic: entry.diastolic,
...(entry.pulse === null ? {} : { heartRate: entry.pulse }),
};
const result = await ovok.measurements.save({
patientId: ovokPatientId,
sourceId: readingId,
effectiveDateTime: new Date(),
measurement,
});patientIdis theovokPatientIdthe function returned, not the register's id.sourceIdis generated once per form, so a retry after a dropped connection finds the first save instead of storing the reading twice. See ovok.measurements.result.statusisqueuedwhen the tablet is offline; tell the nurse the reading is kept on the tablet.
Show recent readingsClient-side
Each saved reading is a blood-pressure panel (LOINC 85354-9) and a heart rate (8867-4) that share a reading identifier. The kiosk reads both with one FHIR search and pairs them:
const page = await ovok.fhir.search("Observation", {
subject: `Patient/${ovokPatientId}`,
code: "http://loinc.org|85354-9,http://loinc.org|8867-4",
_sort: "-date",
_count: 6,
});Show the shift on the home boardClient-side
The kiosk's home is a station board: the scan card beside a tile for each patient measured this shift. Names stay hidden until the nurse taps Show names, and the list lives only in memory, so it is gone when the shift ends.
The board also shows how many blood-pressure readings the project has today, with a count-only FHIR search:
const page = await ovok.fhir.search("Observation", {
code: "http://loinc.org|85354-9",
date: `ge${midnight.toISOString()}`,
_summary: "count",
});
return page.total;Clear the stationClient-side
The next person at the station must never see the last patient. "Next patient" is the main action after a save, and the kiosk returns to scanning after 90 seconds without a touch or key press.
Verify your integration
- Start the kiosk with
npm run devand sign in as a nurse. - Scan or type
WARD-0042and register the patient when the kiosk offers to. - Confirm the identity and save
124/79, pulse66.
The reading appears under "Recent readings in Ovok". If it doesn't:
- A
403on save means the nurse's access policy lacks Observation create. Kept on this tabletmeans the save was queued; check the tablet's connection.- A register error names the problem; see the function's troubleshooting in step 3.
Next step
Continue to step 5: run it on the ward.
Last updated on
3. Patients function
A Supabase Edge Function that checks the nurse's Ovok token, serves the register and creates each patient's pseudonymous Ovok Patient.
5. Run on the ward
Self-host Supabase, deploy the function and the kiosk, lock the tablet to the app, and protect the register that re-identifies every reading.