ObsAcrossEncounters widget - Coalesce multiple answers recorded for the same question

Tags: #<Tag:0x00007f600531a148> #<Tag:0x00007f6005319a90>

Hello to you all,

It was noticed that whenever we have multiple answers recorded for the same question on an encounter , obsacrossencounters widgets do not show all the answers.



When using obsacrossencounters widget to see the above obs on the specific encounter:


So maybe we could make some changes in order to coalesce multiple answers recorded for the same answer in obsacrossencounters. Something like below:


What your thoughts about this?

Thank you.

CC: @mksd @dkayiwa @mogoodrich @bistenes

1 Like

Looks like the documentation says " If an encounter has multiple obs with the given concept then they will be displayed in separate rows"


So either this is a bug or the documentation is incorrect…

Not sure about the initial reasoning behind displaying in multiple rows, but I do think I like the idea of coaleascing into a single row better…

@ssmusoke I forget if this is a widget your team uses? If so, do you have any insight?

Take care, Mark


If an encounter has multiple obs with the given concept then they will be displayed in separate rows.

But then what happens if there multiple answers recorded for several questions during the same encounter, eg:

(Q1) Condition

  • (A1) Asthma
  • (A2) Obesity

(Q2) Allergy

  • (A1) Nuts
  • (A2) Pollen

Then what? This?

Date Condition Allergy
04.May.2021 Asthma Pollen
04.May.2021 Asthma Nuts
04.May.2021 Obesity Pollen
04.May.2021 Obesity Nuts

Or this?

Date Condition Allergy
04.May.2021 Asthma
04.May.2021 Obesity
04.May.2021 Pollen
04.May.2021 Nuts

What @ifernandes suggests is that this gets coalesced as this:

Date Condition Allergy
04.May.2021 Asthma, Obesity Pollen, Nuts
1 Like

Yes, I think the current behavior is well-defined only for

  1. multiple questions that can have one answer each—in this case we get one row per encounter
  2. an obsgroup that can appear multiple times—in this case we get one row per obsgroup

I didn’t actually know that it was allowed to have the same question multiple times in the same encounter if that question was not wrapped in an obsgroup. If that’s legal, then we should write test cases for it and make it behave well, while not breaking the existing test cases.

The trick will be to differentiate case (2) above from this new case (3) one or more questions that can appear multiple times. I think we still want obsgroups in separate rows as they are currently. But I like your solution for the use case you mention, @ifernandes .

1 Like


Thank you for your insights.

@bistenes , about current behavior on point 2., I tested an obsacrossencounters using obsgroup but I got empty values on the widget.



Using the above 2 concepts (Other Question and Obsgroup) in obsacrossencounter json config:


Maybe you are referring to obsgroup used on Latest Obs For Concept List, correct?

So, should I open an improvement on Openmrs JIRA to enhance obsacrossencounters with multiple answers coalesce on the same question? Thanks!


We use this widget, however we have not had to use it with ObsGroups

IMO this is correct since the concept is grouped once by encounter then by the obs

@ssmusoke those are not obs groups, those are just multiple different answers to the same question.

@mksd Thanks for the clarification

While we have not used the multiple obs answers, IMO they should appear in a single row as suggested by @bistenes - not sure how it works at the moment

Interesting @ifernandes ! Yes, I might be mixing those up. What’s the behavior of the obsacrossencounter widget when configured to only display the obsgroup, and not “Other Question”?

Hello @bistenes . When configured to only diplay the obsgroup , I have empty field:


Not sure if it’s expected to have any data. To be honest I thought that obsgroup concepts could only be used on latestobsforconceptlist.

Thanks for helping understand the normal behavior here :wink:

I have opened an Improvement on openmrs jira:

1 Like