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
99 stars 55 forks source link

Adding form components. e.g. body site. #122

Closed fergusleen closed 1 year ago

fergusleen commented 1 year ago

Hi, I'm looking into adding different form components such as a body site map image (https://loinc.org/39111-0). Looking through the conversion to Lforms and the item.datatype. I'm wondering if there's a preferred way to add a new component?

plynchnlm commented 1 year ago

Do you want to show an image, or have the user interact with it somehow?

fergusleen commented 1 year ago

If there's a way to show an image that would be useful. But we'd also like the user to interact with a UX component which would then populate the Questionnaire Response. Initially I was thinking the component would be chosen when a certain LOINC code, such as https://loinc.org/39111-0, appeared in the questionnaire.

plynchnlm commented 1 year ago

There is a way to just show an image, without interaction. For an example of that, see the PROWL form at https://lhcforms.nlm.nih.gov/lhcforms. For interacting with it, that is something that we had some discussion on in the FHIR Questionnaire work-group calls, but it did not get very far beyond a demo of a closed-source implementation. That implementation (as I understand it) uses a custom extension to signal that a viewer is needed for an item of type "choice", which is a reasonable approach. Recently there has been renewed interest in getting a standard FHIR approach worked out. (https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/Body.20part.20questionnaire). I have not been paying too much attention to it because we have been focusing on getting R5 support in, and your issue is the first indication we've had that LHC-Forms users would like this functionality.

I am not sure how to advise you to implement it since the specification hasn't been worked out, but I suppose any implementation would be a good starting point. Are you using FHIR Questionnaires, or the LHC-Forms internal format?

fergusleen commented 1 year ago

Thank you for that information. Very useful. We're very early in our design, working from the FHIR Questionnaire. I could imagine that if there were some kind of template component, this could be used by third parties to build up a shared library of components. Would any of the existing components be suitable?

plynchnlm commented 1 year ago

Presumably, one would want some sort of system where additional components could be made known to LForms without needed to recompile LForms. In talking with @lhcye, it seems that this would require a lot of changes. One problem is that our existing components make a lot internal calls which externally-created components should not have to know about. In the meantime, I guess you would just have to look at the existing components and modify one. I would suggest adding some flag on the LhcFormData (in src/lib/lforms/lhc-form-data.ts) on the item level to keep track whether to use your new component. You would also want to modify the FHIR import routines under src/fhir to set that flag when the custom extension is found (assuming you are marking the item with a custom extension).

fergusleen commented 1 year ago

Thank you for this advice. Much appreciated.