Questionnaire using a ValueSet fails to submit
# support
y
Hi there! I'm setting up a questionnaire with an OpenChoice input pointing to a ValueSet. When I preview the form, the value set autocomplete works properly. However, when I try to submit the form (using the Medplum app's form display), I see the following console error:
Copy code
Error: Invalid additional property "system" (QuestionnaireResponse.item.answer.system); Invalid additional property "code" (QuestionnaireResponse.item.answer.code); Invalid additional property "display" (QuestionnaireResponse.item.answer.display)
And here is the request body:
Copy code
{
  "resourceType": "QuestionnaireResponse",
  "item": [
    {
      "id": "id-2",
      "linkId": "outcome",
      "text": "Call outcome",
      "answer": [
        {
          "system": "https://imaginepediatrics.org/fhir/CodeSystem/imaginepediatrics",
          "code": "call-quality-issue",
          "display": "Call quality issue"
        }
      ],
      "item": []
    }
  ],
  "questionnaire": "Questionnaire/23eb7487-02d6-4c03-9ecf-ac58188ee338",
  "source": {
    "reference": "Practitioner/a4cdd5ba-d1d1-4c23-9ef6-631f0b3a36ae",
    "display": "Yale Spector"
  },
  "authored": "2023-10-18T19:11:12.138Z",
  "status": "completed"
}
Two questions: 1. Is this a bug with Medplum's questionnaire components? 2. If we were to generate a questionnaire response payload without the use of Medplum's components, how should we format an answer for a ValueSet field? (e.g., how would we modify the request body above to be successful?)
r
1. Yes this is a bug. Thank you for finding it - we will fix ASAP 2. The correct data would look like (adding
valueCoding
to indicate the answer type):
Copy code
answer": [
  {
    valueCoding: {
      "system":             "https://imaginepediatrics.org/fhir/CodeSystem/imaginepediatrics",
          "code": "call-quality-issue",
          "display": "Call quality issue"
        }
}
      ],
      "item": []
    }
  ],
We will have a fix out by end of today. Sorry for the inconvenience
y
Thanks @rahul1!!
The PR has merged and will be released in 2.1.6!
169 Views