HFE: obs' set of coded answers to depend on other obs' selected value

Tags: #<Tag:0x00007f0f22e22858>

Hi @AMPATH and @PIH teams,

Here is what I mean by a ‘dependent obs’:


As you can see, the possible condition types depend on the condition being selected.

Here is a first stab at a design idea for HFE, everything is more than open to be challenged:

<obs id="condition" .. />
<obs dependentObs="condition" dependencySet="MKS:Conditions_Types_Superset" .. />

The dependency set is a superset of sets that operates as a mapping configuration. Each of its sets provides the possible ‘Condition Type’ dependent answers for each ‘Condition’ depended on answer.

It would look as such in a Iniz-like CSV format:

Same as mapping Attribute|Referred Concept Members
MKS:Conditions_Types_Superset MKS:Arthropaties_Set; MKS:Dorsalgia_Set
MKS:Arthropaties_Set MKS:Arthropaties MKS:Arthritis; MKS:Arthrosis; MKS:Polyarthritis; MKS:Polyarthrosis; MKS:Coxarthrosis_[arthrosis_of_hip]; MKS:Gonarthrosis_[arthrosis_of_knee]
MKS:Dorsalgia_Set MKS:Dorsalgia MKS:Cervicalgia; MKS:Sciatica; MKS:Lumbago_with_sciatica; MKS:Low_back_pain

I would love to get your thoughts on this, 1) about the design and 2) also your insight on the usefulness of/need for such feature.

Cc @ruhanga @mksrom @jesplana @frederic.deniger

Credits to @sameermotwani11, @prateek, @mukesh and their team for the initial POC that they came up with for this feature.

@angshuonline is there anything as such already available in Bahmni Forms 2.0?


Thanks @mksd

for what it’s worth, the way we would currently accomplish this (though it’s not super elegant) would be to use the “controls” and “when” tags:


In this case you’d have three “Condition Type” obs, each with different answer sets, and you’d use use the “when” tag to hide/show them based on the Condition obs.

I agree that having a more elegant way to do this would be an improvement, though not sure of the priority as there’s a way to do this now.

fyi @ball

Thanks @mogoodrich. Well I don’t think the <when/> solution is inelegant at all! I just should better read the existing docs in the first place.

Do you know if that scales well? Obviously my example was oversimplified. There’s not just two conditions to choose from but about thirty, each of them with their specific set of types. And there’s more dependent obs whose possible answers vary based on the choice made for ‘Condition Type’ this time.

I think we’ve only used it for relatively simple use cases @mksd so haven’t tested scaling… however, it really is just JavaScript so I don’t think it will be too much of an issue?

Thanks @mksd