matching visits, encounters on order entry

Hello!

we have been using the emr api in the radiology module to find or create active visits and encounters when saving new radiology orders/discontinue existing ones but we want remove this dependency since it forces us to install ~11 modules.

I would love to get some input and maybe clinical background (@burke) on visits/encounters and the way we think about implementing this.

Currently we use global properties to configure

  • visit type (used to set the visitType in Visit)
  • encounter type (used to set the encounterType in Encounter)
  • encounter role (used to set the encounterRole in EncounterProvider)

Creating/Discontinuing RadiologyOrder

  • in case there is no active Visit for the patient and the configured VisitType: we create a new Visit and save with it a new encounter (populated with all the types/roles mentioned before)
  • in case there is an active Visit for the patient and the configured VisitType: we create a new encounter and attach it to the active Visit

Do you see this as a sane approach?

Furthermore, we are wondering if we should create a Visit when discontinuing an order? since the patient might not even be at the facility (for ex. he called to cancel the imaging procedure).

I wouldn’t think you should directly create a visit to create an order. You should (and must) create an encounter, and a visit may be indirectly created for that reason.

OpenMRS core already support the model of having a configurable bit of code that decides what to do with respect to a visit when creating an encounter. The interface name is something like EncounterVisitHandler.

So basically you want to make your code work for any configured set up by merely creating an encounter for the order and presuming that the implementer has set everything up correctly.

2 Likes

Thank you so much @darius, your post just got the radiology module rid of ~10 dependencies. Take this virtual sixpack as a big “thank you” from @teleivo and me! :beer::beer::beer: :beer::beer::beer:

1 Like