LHNCBC / formbuilder-lhcforms

Build LHC-Forms and FHIR Questionnaires
Other
28 stars 22 forks source link

Export form as lforms json #82

Closed ngavier closed 5 months ago

ngavier commented 7 months ago

When using the new version, it does not allow to export the created questionnaire in the LFORMS structure. Using the /previous version does allow it.

We need this format to be able to render forms that calculate scores based on answers. When rendering it from the FHIR structure using the renderer widget, it does not calculate scores that should be automatically calculated.

Is this export possible in the new builder version?

Thanks!

plynchnlm commented 7 months ago

We decided not to advertise the lforms format and just recommend the FHIR Questionnaire format. Unfortunately, in the FHIR Questionnaire format it is not as easy to create a "total score" field. We are working on some things to make that easier.

Anyway, if you want the lforms format, it is still possible to get it, though involves typing some JavaScript into the developer console. Instructions for Chrome: 1) Bring up the form builder's preview showing the rendered form. 2) Right-click on the preview and choose "inspect" from the context menu 3) In the developer tools window that opens, click on "Console". 4) Type: console.log(JSON.stringify(LForms.Util.getFormData(),null, 2)) The form definition (along with any values in the fields, I think) will be output and you can copy the result.

Edit: We will add some means in the UI to get the lforms format, since you need it, but it might take us a few weeks.

Rosnyni commented 7 months ago

Hello,

I'm not familiar with LFORMS structure.

However, for total score computation, we add the following extensions to our local formbuilder instance :

And it works for calculation (with the above exemple, the preview: image)

Are you interested in a PR ?

plynchnlm commented 7 months ago

Thanks for the offer of a pull request for those changes. I agree it is an improvement over what we (don't) have now, but we are also right on the edge of adding a tool to the form builder that will make managing total score calculations easy. That is, probably in the next week, someone will try to start adding it, though its addition will depend on a couple of other pull requests, so it might be some weeks away yet. This tool will also allow adding variables and calculated expressions. So, I think it is probably not worth the effort (for either of us) to add your approach at this point. If somehow things go badly in adding the tool, we might take you up on your offer later.

ngavier commented 6 months ago

Thanks everyone for your replies! @plynchnlm Could you please keep me updated on those additions?

Thanks!

Rosnyni commented 6 months ago

we are also right on the edge of adding a tool to the form builder that will make managing total score calculations easy.

Do you share something like a roadmap somewhere that would allow the community to have an insight of form builder future ?

I take a look on the github project and I don't find anything

plynchnlm commented 6 months ago

we are also right on the edge of adding a tool to the form builder that will make managing total score calculations easy.

Do you share something like a roadmap somewhere that would allow the community to have an insight of form builder future ?

I take a look on the github project and I don't find anything

That is a good idea. We would have to update it, perhaps every other week, because our priorities change frequently. Anyway, I can see how it might have been helpful in this case, though perhaps you would still have implemented your solution anyway, because when I said "right on the edge" I meant the attempt was about to be made to integrate a new widget into the form builder, but fixing all of the resulting UI issues could take a few weeks.

plynchnlm commented 5 months ago

There is now a menu option that will allow the download of the internal LForms format.

image