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.
E.g.:
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:
Yes, I think the current behavior is well-defined only for
multiple questions that can have one answer each—in this case we get one row per encounter
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 .
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”?
For obsgroup display, looks like there’s exactly one unit test: “it should show separate obs groups on separate lines.” The test demonstrates usage with obs groups—the concepts specified are not grouping constructs themselves, but rather are contained within constructs. See the description at the top of the test file of how the mock data is structured.
So what this test says is that given two concepts A and B, where A is in obsgroup C and B is in obsgroup D, and given one obs for A and two obs for B, all in the same encounter, the widget will display two separate rows. I think we want to preserve this behavior.
Just to follow up on this, we did a small test by configuring an ObsAcrossEncounters widget with concepts contained within different obsgroups.
On the left (image below), we have the form with 4 obsgroups (one per line): Services, Transport, Accommodation and Food.
Transport group contains 3 concepts, the others contain 2 (as visible on the cells).
On the right, we have the resulting widget. As expected, the behaviour is the one described by @bistenes , groups are separated by rows.
Just one thing to point out: with this configuration, by looking at the widget, we don’t know which line corresponds to which group.
Thanks @icrc.psousa, that was a very clearly laid out example.
Also in the case above, all constructs are basically of the same nature (with actually the same members), so, even though the widget does not let us distinguish which row is which group exactly, things still roughly make sense and display coherently.
But if those constructs had been more foreign, with different sets of members, then this widget would not make much sense anymore. Probably all this should be better documented in the wiki…
@icrc.psousa Would it not make sense to add an obs column for the obs group so that you can identify it, in this case the Services/Transport/Accomodation/Food values
The reality is not to depend on the order of the data entered since it cannot be predicted