FHIR Questionnaire and QuestionnaireResponse

Hi,

I’m trying to make a SMART on FHIR app that would be able to read and create custom data. I figured that the Questionnaire and QuestionnaireResponse, are what I’m looking for and so I ask, is it something supported by OpenMRS or by one of it’s modules? When I tried a GET request (at http://localhost:8080/openmrs/ws/fhir2/R4/Questionnaire) on the fhir2 API, I got the response :

{ “resourceType”: “OperationOutcome”, “text”: { “status”: “generated”, “div”: “<div xmlns="http://www.w3.org/1999/xhtml\”>

Operation Outcome

<table border="0"><td style="font-weight: bold;">ERROR[]
Unknown resource type ‘Questionnaire’ - Server knows how to handle: [Condition, Group, MedicationRequest, Immunization, Task, MedicationDispense, Patient, DiagnosticReport, RelatedPerson, ServiceRequest, Practitioner, AllergyIntolerance, Observation, Medication, Encounter, Person, ValueSet, OperationDefinition, Location]
\n\t\t\t\n\t\t\n\t" }, “issue”: [ { “severity”: “error”, “code”: “processing”, “diagnostics”: “Unknown resource type ‘Questionnaire’ - Server knows how to handle: [Condition, Group, MedicationRequest, Immunization, Task, MedicationDispense, Patient, DiagnosticReport, RelatedPerson, ServiceRequest, Practitioner, AllergyIntolerance, Observation, Medication, Encounter, Person, ValueSet, OperationDefinition, Location]” } ] }

which leads me to think it’s not currently supported. If that’s the case, are there plans to support it in the future?

Thanks

1 Like

No, they aren’t supported and there are no immediate plans to add support for them.

Thank you for the answer. I have another question, is there a common method used to collect custom data with OpenMRS (preferably through FHIR)?

Here is what we’re trying to do : We want to make a Smart on FHIR app that can read, create and update custom data, and we want to use OpenMRS so we don’t have to create a whole patient record app AND the Smart on FHIR app. So we’ve been looking into how OpenMRS can collect custom data. We’ve tried saving it through the FHIR API in an Observation with a new concept so we can save it as a string, but we’re limited by the max length of the string.

Have you ever had to do something similar or do you think such a thing is impossible?

Thanks again

Largely through observations. One reason we don’t have support for FHIR Questionnaires is that there’s no common schema for forms in OpenMRS. There are various form engines for OpenMRS which capture data and bundle them up as sets of encounters and observations. Since those underlying concepts map pretty straight-forwardly to FHIR, there hasn’t been a massive need to represent the Questionnaire itself or the QuestionnaireResponse.

Well, it seems like you’re probably trying to store too much data in a single observation? Generally, observations are sort of atomic units of healthcare data (e.g., systolic blood pressure, serum creatinine, a short clinical note). If you want to structure multiple such atomic units, we have a concept of ObsGroups, which are supported through the FHIR API via the Observation.hasMember attribute. With that kind of structure, you’d have essentially any number of atomic observations grouped together via a parent observation, which is meant to indicate something like “this group of observations are all related”. As an example, our FHIR Immunization API is based on the CIEL Immunization History structure which results in something like this:

group obs (no value; concept CIEL:1421)
   |
   ----> Immunization Sequence Number (int value; concept CIEL:1418)
   |
   ----> Immunization (coded value indicated actual immunization given; concept CIEL:984)
   |
   ----> Immunization Date (datetime; concept CIEL:1410)
   |
   ----> Immunization log number (string value; concept CIEL:1420)

Basically each structure like that is a record of an immunization being given with a number of sub-observations that define the actual data.

OpenMRS itself (but not the FHIR API currently) has a concept of a ComplexObs, which is essentially an observation associated with an arbitrary value that can be anything: a file, an entry in the CLOB table, whatever other structure you implement. The reason this isn’t mapped into the FHIR API lies in the complexity of handling the various cases, but, at the end of the day, the data might be represented via the FHIR Media resource (also unsupported right now), which is essentially an arbitrary file (DICOM image, video, PDF, etc.) when that’s added.

Without knowing more about your specific case, it probably makes sense to record whatever data you’re trying to enter as an encounter and break-up the data into more atomic observations. You can then use the FHIR API to get the encounter and matching observations returned as a single search bundle.

Thank you for the great answer!

I’m trying to replicate this but struggling to do so.

So far I’ve created the concepts for different custom values and one concept for the grouping with the Set Members being the other concepts.

Then I POSTed a new Encounter.

Here is where I’m getting confused. Should I POST an Observation for the group first and then POST one Observation for each new concept? And do any of these Observations or the group Observation require additional properties like hasMember or something in the JSON body of the request?

I’m also quite confused about how to GET all of these at once and how updating one value would be like.

Thank you in advance.

I also did POST an Encounter, an Observation with a reference to the Encounter and tried to GET http://localhost:8080/openmrs/ws/fhir2/R4/Observation?encounter=[EncounterUUID] but I end up with a empty Bundle. I was expecting to get the Observation. Do you have any idea how I can GET that?