I've just spent a couple of days working on our API around Visits and ADT, and I was surprised to find that we're not going to be using visits on the Mirebalais project the way I'd assumed they would work when we built them in OpenMRS.
Scenario: a very sick patient shows up at the outpatient clinic, checks in, sees a doctor, who gets him admitted to the inpatient ward, where he stays for two days.
While we were building visits in OpenMRS, I was assuming that we'd represent this with two visits:
- visit type = "Outpatient", location = "Outpatient Clinic", start = 9am, stop = 10am
- visit type = "Inpatient", location = "Inpatient Ward A", start = 10am, stop = 2 days later
However the clinical and M&E teams really want us to represent this as just a single visit. Which makes sense if you're not wearing a developer hat. :-)
So instead we'll represent that scenario as:
- One visit, with location = "Mirebalais Hospital", start = 9am, stop = 2 days later
- An encounter of type = "Check In" at "Outpatient Clinic" at 9am
- An encounter of type = "Outpatient consultation" at "Outpatient Clinic" at 9:30am
- An encounter of type = "Hospital Admission" at "Inpatient Ward A" at 10am
- An encounter of type = "Hospital Discharge" at "Inpatient Ward A" two days later
We've started to capture the business logic (up through check-in at time of writing) in an ADT Service (interface, implementation, unit tests) in the EMR module.
I actually think I like this better than the approach I'd originally assumed we'd take. And I'm really happy that our implementation of Visits in OpenMRS is flexible enough to let us model our business logic however we want. (Props to Burke for constantly reminding us of that!)