LHNCBC / lforms

See the project website at http://lhncbc.github.io/lforms/, or view the demo website at https://lhcforms.nlm.nih.gov/lhcforms.
Other
107 stars 56 forks source link

Re: Customising the UI for the Lforms #115

Open nikhil-ht-el opened 1 year ago

nikhil-ht-el commented 1 year ago

Hi I am rendering the lform using the fhir questionnaire response. It is currently displaying in the form structure on UI. Is their any provision where we can change the UI of the lforms to show up in the table format.

Please help around this.

Thanks Nikhil

plynchnlm commented 1 year ago

If you mean having a group presented as a table where the questions are column headings like this: image then you can set the questionnaire-itemControl extension to 'gtable'. (https://hl7.org/fhir/uv/sdc/STU3/rendering.html#control-appearance)

boxwala commented 1 year ago

Hi Paul, specifically, in this case, the gtable solution comes close, but I am not sure it is a perfect fit. All the items in our Questionnaire have the same structure - a parent item with three subitems. All parents and subitems have the same datatypes. So, a grid structure could work. But the items are not "repeating".

Generally, we are looking to have more control over the layout of item for other applications too. One possibility may be to allow the questionnaire or application developer to supply an HTML table with mappings from cells in the table to the item (linkids).

plynchnlm commented 1 year ago

I am having trouble imagining what you have in mind. Maybe you could share a screenshot or drawing?

You can set repeats=false if you don't want the gtable repeating, in which case it would have just one row.

Have you had a look at the itemControl options at http://hl7.org/fhir/R4/valueset-questionnaire-item-control.html? Not that we support them all yet, but I would prefer to implement something that was part of the standard.

boxwala commented 1 year ago

I have attached a sample questionnaire. We'd like to display them somewhat like in the image below. image

It is similar to gtable, except the list of items is predefined. The user will not add more items but they can edit the existing items. In other words, the questions all have a similar pattern (kind of like PHQ-9) and the list of items is fixed. In our questionnaire response, we defined child items too. We can change the structure of the questionnaire if we need to do so. pain_demo_qr.json.txt

plynchnlm commented 1 year ago

I think this would be supported by itemControl type='grid' (https://build.fhir.org/valueset-questionnaire-item-control.html)-- but lforms does not yet support grid, though it is on our list of things to add.

boxwala commented 1 year ago

could we contribute it as a pull request?

plynchnlm commented 1 year ago

Sure-- pull requests are welcome. Please include some tests. The basic idea is that you mark a group with itemControl='grid', and then the subgroups are rows (groups, with sub-items for the column questions). In your case the items in the sub-groups would be the same (the same questions) for each row, but each row could contain different (or partially different) questions, in which case the the columns would contain headers for all of the different questions, but not all rows would have answer fields for each question.

boxwala commented 1 year ago

How would you distinguish that two questions are the same or different? Based on the relative linkId/text?

plynchnlm commented 1 year ago

The linkId will have be different for every cell in the grid, but I would suggest looking at item.text. I suppose you could have two different questions with the same text, but then there would be two columns with the same text, which would be confusing, so I am not sure there is a need to support that. Implementation questions like this are better asked on chat.fhir.org ("questionnaire" stream). There is already a thread about the "grid" type (https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/Grid.20Question). I think this question about how implementations regard questions as distinct between rows should be asked there, so the answer can get into the itemControl specification. If you don't mind, please ask there, and we will see what others think.

annabel-uzl commented 5 months ago

Is the use of gtable something we can implement using the formbuilder? Because at https://lhcformbuilder.nlm.nih.gov/ I don't see how... (I now we can just edit the json but our doctors cannot). If so, how and can you also make tables in tables? EDIT: I adapted the json of my questionnaire to have nested tables but they don't appear in the UI. Can this be correct? If so, can I make a seperate issue for this to fix this?

plynchnlm commented 5 months ago

Is the use of gtable something we can implement using the formbuilder?

Sorry for the delayed reply; I was away last week. I think this question would be better off in its own issue. However, it is a good question. There is no way to specify gtable from within the form builder, which I think is an urgent problem. LHC-Forms already supports gtable. We will try to give this priority.

I now we can just edit the json but our doctors cannot

Yes, that is a good argument.

If so, how and can you also make tables in tables? EDIT: I adapted the json of my questionnaire to have nested tables but they don't appear in the UI. Can this be correct? If so, can I make a seperate issue for this to fix this?

That will require some discussion. Please make a separate issue.