Encounters <> Program Attribution in O3

Encounters <> Program Attribution in O3

4 Must-Do’s 1. Problem Description: Have you clearly defined the user problem(s) you intend to solve, and what value this creates? Write down a story, user insight, or quote about this problem (this is important because (1) this will motivate your team, and (2) without this your problem might not actually be a big problem for the users themselves). 2. User Stories: Have you clearly written at least 3 user stories and use cases?  3. Market Analysis: Have you surveyed what the market is doing here (e.g. comparison to other EMRs, or paper approaches; and don’t forget about learning from historic/existing OMRS instances)? Have you written down any possible gaps in your understanding of your users or their workflows? Have you reviewed the topic in FHIR to see what requirements or fields the global community references? (Eg if working on insurance, should look here) 4. Technical Considerations & Dependencies: Have you outlined what you need from cross-functional areas for success of the feature? E.g. do you need the platform to support a new API call? Have you explained how you’ve addressed dev concerns, such as designs that may not be feasible, or will be extra time-intensive to implement?  Optional/Encouraged Sketches: Have you added a drawing or description of how the feature could work to solve the problem at hand? (Pictures of sketches are ok!)  Project Management: Have you created the Epic and JIRA tasks so you can share work clearly? Roll-out plan: Do you have an idea whether this will be an experiment, gradual roll out, and when? Have you added this to the timeline view? Have you planned how you will promote and/or work with communications folks in order to help this feature reach the widest audience and have the biggest impact it can? Later but should do QA Plan: Have you mentioned the plan for QA, such as how you will discover and address edge cases? Does your team/squad have a plan for automated tests to be added to new components (unit tests) or workflows (e2e tests)? Safety & Tech Risks: Is there any reason you could regret rolling out this feature? (e.g. possible patient harm, heavy tech debt like introducing an unsupported library) Have you thought through the risks for this particular solution? And, how to reduce/address those?  This checklist was inspired by this article. Additional Business Analyst Resources here.

Summary:

    • A program is a thread of care, not a one-time enrollment record. Some run for life (HIV, hypertension, diabetes, mental health); others are time-bounded and repeatable (a pregnancy/PMTCT episode, a TB treatment course). In every case, the patient returns for care under that program.

    • Desired capability: for whatever program a patient is enrolled in, the encounters delivered under it should be linkable back to that program — so the patient's program-specific care can be reassembled and continued.

    • Currently, no follow-up encounter is linked to its program. At return-to-care, a clinician sees only an undifferentiated pile of all encounters. "Which program was this encounter for?" is unanswerable in the stack. Root cause is structural: the data model has no encounter/visit → program reference.

Picture showing what this project is about (e.g. a key mockup, drawing; anything visual)

1. Problem

Enrolling a patient in a program is only the front door. What matters is the care that follows: the patient comes back to the facility under that program — a hypertensive patient for blood-pressure reviews and refills, an HIV patient for viral loads and ART, a pregnant patient for antenatal visits across one pregnancy. The purpose of program support is to link those encounters to the program, so that when the patient returns, their program-specific history can be reassembled and continued as one coherent thread — regardless of whether the program lasts a lifetime or a single episode.

O3 doesn't do this. Enrollment is stored as a free-floating marker — payload {program, patient, dateEnrolled, dateCompleted, location, states}, no encounter or visit field (programs.resource.tsx:53) — and the encounters that follow are never tied back to it. The chart can show that a patient is enrolled and that encounters happened, but not which encounters belong to which program.

The structural cause — Nothing stamps an encounter with the program it served. Core OpenMRS has no reference from an encounter or visit to a program; PatientProgram carries only patient, program, dates, location, and states. Attribution therefore has to be reconstructed downstream in ETL/reporting by deriving from encounter type, form, and enrollment date window.

Determination should happen at the point of care, not after. A patient enrolled in two concurrent programs — HIV and TB, or hypertension and diabetes — with a generic "Clinical consultation" encounter is ambiguous to any after-the-fact rule; date-window inference then breaks further on re-enrollment and retrospective entry. The moment the system actually knows the answer is at check-in — and today it throws that knowledge away. Capturing the program when the visit starts is the only point at which ambiguity never enters the record.

2. User Stories

  • As a clinician, when a patient returns for follow-up, I want the encounters, labs, and medications for the program they're enrolled in gathered under that program, so I can continue care with the full journey in front of me.

  • As a clinician, I want each follow-up encounter I create in a program visit linked to that program, so the care thread stays coherent visit after visit.

  • As an M&E/reporting officer, I want encounters attributed to a program in the record, so program indicators (e.g., hypertension control rates, viral suppression, ANC coverage) come from data, not reconstruction.

  • As a program manager, I want a patient's follow-up encounters tied to the enrollment that governed them, so a program's care reads as one timeline instead of scattered across the chart.

  • As a data manager, I want a patient who completes and re-enrols (e.g., a new pregnancy) to keep each episode's encounters tied to that episode, so history isn't collapsed.

  • As a clinician, when a patient is in two programs at once, I want each encounter attributed correctly, so neither program's record is polluted.

3. Market Analysis

No implementer has a first-class encounter → program link in the platform: PIH reconstructs it downstream (data-warehouse date window), TaifaCare/KenyaEMR binds it at the point of care via a Care Panel + form metadata (enrollment confirmed; follow-up unproven), and UgandaEMR builds an implied relationship on encounter type and wants it structured. Everyone works around a link the platform should own.

Implementer

How implementers tie encounters to a program

Implementer

How implementers tie encounters to a program

PIH

  • PIH doesn’t have any EMR or Code solution.

  • Downstream only: enrollment start/end date window computed in the data warehouse — explicitly no EMR or code linkage. Unique program ID per enrollment; re-enrollment allowed (pregnancy → one episode each); distinct encounter types per service, but these aren't the linkage mechanism.

Palladium

  • Taifa Care has a care panel that allows providers to enroll a patient in a specific program and drop them off once they complete the service.

  • All clinical forms are linked to that program of enrollment.

  • Different encounter types per program; each encounter form carries referenced metadata.

image-20260910-084818.png
Care Panel
image-20260910-090534.png
Encounter Type
image-20260910-090421.png
Form <> Encounter Type
image-20260910-085959.png
Form <> Encounter Type

UgandaEMR

No backend link — attribution is an implied / assumed relationship built on encounter type.

Confirmed; explicitly wants it "finally fully structured to relate directly" — a direct endorsement of the platform fix.

4. Technical Considerations & Dependencies

Gap analysis → proposed direction:

#

Gap

Impact on the care

Proposed direction

#

Gap

Impact on the care

Proposed direction

1

Enrolled in a program ↔ clinical visits — enrollment is a one-time record; the visits that follow carry no reference back to the program. The two sides never touch

When the patient returns, there's no thread to pull — program-specific care can't be reassembled

Stamp the visit with the program at check-in: visit attribute short-term, FHIR EpisodeOfCare as the durable model (enrollment = episode every follow-up encounter references)

2

Are there programs using visit type? — the visit-start form recommends visit types by enrollment but discards the program on submit. No core program↔visit-type metadata

The one moment the system knows which program the visit is for, it throws it away

Persist the selected program on the visit (cheapest); move the program→visit-type mapping into core metadata instead of ETL

3

What encounters need relationships — every follow-up encounter in a longitudinal program needs a tie to that program; none has one and the model offers no field

Encounters can't be differentiated by the program that produced them

Once visits are stamped, every encounter under a program-linked visit inherits the program; program-specific forms reinforce the attribution

4

Determination of which program? — a shared/generic encounter type can't tell you which program it served (a patient in HIV and TB, or hypertension and diabetes, with a "Clinical consultation" encounter is ambiguous).

Inferred-later determination is lossy; ambiguity enters the record and breaks on re-enrollment and retrospective entry

The check-in stamp is the determination moment — the program is declared when the visit starts, so ambiguity never enters the record. UgandaEMR names this exact "implied/assumed relationship" problem and asks for it to be structured directly.

Options

First/second option capture the program at the point of care (determination unambiguous); third/fourth infer it later (lossy).

  1. FHIR EpisodeOfCare — Preferred (durable)

    • Enrollment episode = an episode; every encounter in the period references it

    • Strongest — built to group encounters over a program period; re-enrollment = new episode. FHIR-module support unverified

  2. Program reference on the visit (visit attribute) — Candidate (short-term)

    • Stamp the visit; encounters inherit it

    • Good, simpler; visit-level only, no first-class episode. Platform change

  3. Encounter/visit-type → program config map — Interim bridge

    • Core metadata mapping, replacing ETL

    • Weak — breaks on shared encounter types across concurrent programs

  4. Date-window correlation — Fallback only

    • Attribute encounters inside the enrollment window

    • Weakest — ambiguous on overlap / re-enrollment / RDE; reconstructs rather than records

5. Sketches