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
103 stars 56 forks source link

Prepopulate form with source data #152

Open annabel-uzl opened 3 months ago

annabel-uzl commented 3 months ago

Hi Has anyone tried using source data as input values in the questionnaire? I was thinking of using variables of some sort 'out' of the questionnaire resource and put them in some way 'in' the questionnaire and I came by this example: https://hl7.org/fhir/uv/sdc/Questionnaire-questionnaire-sdc-test-fhirpath-prepop-source-query.json.html They use a bundle of type batch https://build.fhir.org/bundle.html and then use contained resources to put it in their questionnaire https://build.fhir.org/references.html#contained. Has anyone tried this? Is LForms prepared for this?

EDIT: the more general question is: can Lforms handle contained resources? Other example: https://build.fhir.org/questionnaire-example-gcs.json.html

plynchnlm commented 3 months ago

LForms supports Observation-based extraction and also the launchContext, variable, and initialExpression extensions, but not source queries. For an examples, see https://github.com/LHNCBC/lforms-fhir-app/blob/master/cypress/fixtures/R4/ussg-fhp.json or others under "R4". You can try these out in our "SDC Questionnaire App" (in the "Featured Questionnaires" section in the sidebar).

Contained ValueSets can be referenced in answerValueSet URLs, and I think contained Binary resources can be used for images.

annabel-uzl commented 3 months ago

Mmmh okay so if I understand correctly: If our source data is not in FHIR and our FHIR store is not always updated immediately, we will not be able to use recent data in our questionnaire? (Unless we convert the source data to FHIR resources on the spot and put them in a dummy store from which we fill the Context of the form?)

plynchnlm commented 3 months ago

LForms also supports x-fhir-query expressions, which are URLs that go to a FHIR server and fetch data. I suppose you could have a query (in a "variable" extension) that returned data that isn't FHIR (but still JSON) and then have an initialExpression that understood that format pick out the right value. The result would be something that only works for your server, obviously, but that might be okay for your goals.