LHNCBC / formbuilder-lhcforms

Build LHC-Forms and FHIR Questionnaires
Other
26 stars 21 forks source link

Customizing UI via formbuilder - gtable #87

Open annabel-uzl opened 3 months ago

annabel-uzl commented 3 months ago

Linked to https://github.com/LHNCBC/lforms/issues/115#issuecomment-2174201479

When using Lforms you can adapt the json structure of your questionnaire to use gtable to customize your UI a bit. However, our doctors cannot change the json. Therefore we would like a way to implement tables in Lforms by doing some setup in formbuilder.

plynchnlm commented 3 months ago

Thanks for bringing this issue up. I am hoping we can get gtable support in the formbuilder live within a few weeks.

However, in the issue you linked to, you mentioned "nested tables". If by that you mean a table inside another table, that is not something LHC-Forms supports, and I am not sure what that would look like. Do you have a picture you could share of what you are trying to achieve?

annabel-uzl commented 3 months ago

image image image image image

Yes, by "nested tables" I mean a table inside another table. Attached some examples of what we do now with infoPath (in Dutch, apologies). I feel like this is more a nice-to-have to further customize the layout of the forms but I also think grouping some questions can enhance reading performance

plynchnlm commented 3 months ago

gtable support gives you a table in which the questions are the columns, and the rows are the answers. You can have more than one row of answers if repeats=true for the group. Here is an example: https://rxterms.nlm.nih.gov/

The kinds of layouts above make sense for paper forms or for applications that are trying to fit everything onto one screen, but in a web browser is it not necessary to be so compact in the layout; the page scan scroll. So far there is no mechanism for representing these kinds of layouts in FHIR Questionnaire. There is a mechanism for breaking the form into pages (itemControl=page) and or tabs (itemControl=tab-container), for which we are planning to add support. If that is not sufficient for your needs, then you can always propose something new. The best place to bring that up would be on the "questionnaire" stream on chat.fhir.org, and after some discussion there, you could file a Jira ticket at jira.hl7.org.

plynchnlm commented 3 months ago

After looking at these examples a bit more, it seems (though I can't be sure because my understanding of Dutch is limited to "ja" and "nee") that in the first and third examples what the form is doing is with columns is what you would do with "enableWhen" in FHIR. That is, in the first column the user selects a check box, and then only answers the questions to the right of the selected checkbox in the next column, and so on. In FHIR Questionnaire, you would have that left-most question first, and then when the user selects an answer, there would be a group below with enableWhen set up to show itself in response to that answer.

annabel-uzl commented 3 months ago

@plynchnlm Thanks for explaining this so clearly! I think you are right that we can probably do a similar thing using enableWhen and gtable. We'll try that first and if that's not sufficient for the user, we can always go brainstorming on the fhir-chat. The support for itemControl=tab-container is something we'll definitely use as well :)