We’ve started to use the EncounterTransaction functionality provided by the EMR API module within our new Visit Note. So far it has been working well. However, we’d like to be able to set the encounter role of providers, and currently, if I’m reading the code correctly, EncounterTransactions only support setting an encounter role of UNKNOWN ROLE. (I think the relevant code is: EncounterProviderServiceHelper:39).
Am I wrong about this, and is there a way to set the Encounter Role when associating a provider with an encounter via an EncounterTransaction?
If not, would people be opposed if we added this functionality? Ideally, you could modify an Encounter Transaction to allow one to pass in an Encounter Role with a provider, those for our case it might be sufficient to create a new global property “Default Encounter Transaction Encounter Role”, that, if present, is used instead of the role set in the “Unknown Role” GP.
I agree that the REST API should allow you to specify what provider +
encounter role you are currently submitting data for. And I also agree that
this should be optional and configurable, as many UIs won’t want to bother
I would presume that if you submit an encounter transaction explicitly
saying provider = Alice, encounterRole = Clinician, then this should only
match an existing encounter that has Alice in the Clinician role, but if
you submit without saying what encounter role, then it should match any
encounter with Alice as a provider. (In practice the distinction is a very
small use case.)
I think “2) Add a second Encounter Provider” is the only option that makes any sense.
Thinking more, and stepping back, I guess I would expect the default behavior to match an existing encounter based on same encounterType + compatible location + compatible datetime.
If you’ve matched a specific encounter, you should “add a new EncounterTransaction to the encounter.” Today this is conceptual, and means adding more obs, orders, and providers to the encounter. (Someday in the future the core API will support this natively, and we’ll need to change the web service to leverage that.)
This makes sense @darius. I will implement that way.
fwiw, I’m not touching (nor have I looked deeply into) the matching behavior. I’m (mainly) touching the EncounterProviderServiceHelper “update” method, which, given an Encounter and a Set<EncounterTransaction.Provider>, updates the encounter accordingly.