Dynamic Questionnaire
# support
m
👋 , I've been playing with the questionnaire builder in order to "visually" test our workflow before I dig into the integration portion for the proof of concept. I've built a simple form with the following json, with the goal being: If "remove" is selected, the other option disappears. (it works!) If "changes" is selected, "variants" should show up. This one works partially. The options are not showing up regardless of how I configure the enableWhen attribute. I'm sure this might be something small that I'm overlooking, but I have tried everything I could think of there in order to get the select component to show.
r
Hi @markitosaad , I took a look at you questionnaire and was able to diagnose the issue. It turns out your question #3 is listed in the
items
field of question #2, which makes it a "sub-question". This actually isn't valid for questions that aren't of type
group
. If you just make your question #3 parallel to question 2 (i.e. all of your questions are in the top-level
items
array), this should work as expected
m
Interesting! I was going for a nested approach! I'll try the type
group
and what you suggested @rahul1 ! Thanks 🙂
@rahul1 is there any trick to get a Device that was created to show up in the searchable options for a questionnaire answer? I've added a device (https://app.medplum.com/Device/d934017b-6f8f-4508-92de-a79de8986a39/details) and I'm trying to pick it in a field defined by
Copy code
json
 {
      "linkId": "new_item",
      "text": "Add a new item",
      "type": "reference"
    }
I saw that the query is looking for a parameter called
_id
(GET https://api.medplum.com/fhir/R4/Device?_id=d&_count=10). Is this the randomly generated id that can be found in the device json? ("d934017b-6f8f-4508-92de-a79de8986a39"). If so, I guess the next question is, would we need to customize the behavior of the component to search based on other parameters for this reference type?
r
That's right. By default, our
ReferenceInput
component searches by any search parameter called
name
, if it exists. If not, we fallback to the
id
For
Device
, which search param would you want to search by?
device-name
?
m
Yeah, I'd expect similar behavior to patient search for example, in this case it would be for it to have pulled it from the
device-name
r
m
SUPER! Thanks
@rahul1 has the team given any thoughts on allowing you to build a reference input where you can define an input as
reference
type, define it's initial value's reference type (ex: patient, device, questionnaire, etc) without having to set an actual reference object? The goal here is to have a form input that is constrained on which reference types you can select, but doesn't define a value ref by default.
r
Hi @markitosaad - yes there is a way to define a restricted set of types for the reference input. This is done via a special FHIR extension, but our builder supports it
m
Awesome, got it to work 👍
242 Views