Stream: implementers
Topic: Converting Questionnaire to Resources
Dave Barnet (Aug 25 2021 at 08:58):
I'm looking at a use case where a "referrer" can ask for a refferal to a care setting. The Care Setting returns a request for the information they require to complete the referral. I was thinking that the request for information would be a Questionnaire. However, rather than a QuestionnaireResponse, I would prefer a Message Bundle as the response to the Quesionnaire (containing Patient details, Condition details, History detailas & whatever). I see from SDC (Structured Data Capture) spec this all seems possible. Could someone point me to a live public test FHIR server that has implmented the URL: [base]/QuestionnaireResponse/[id]/$extract operation, so I can test this out?
Kevin Mayfield (Aug 25 2021 at 09:12):
-
Placer POSTs the ServiceRequest A (intent = proposal). (Or message 'referral' if that is the payload requirement)
exchange type = message -
Filler POSTs a 'task/complete-form' message with the SDC content .... which is either a Task which specifies Questionnaire is to be completed (may contain Questionnaire)
exchange type = message or restful POST /Task -
Original Placer - POSTs the response is also a message which is 'patient-form' event which contains all your data (focus QuestionnaireResponse)
exchange type = message -
Filler POSTs back ServiceReques to indicate accepted, rejected, etc
Jose Costa Teixeira (Aug 25 2021 at 09:53):
@Oliver Egger has done somethign similar and has a good demonstration of that
Kevin Mayfield (Aug 25 2021 at 09:57):
Wondering if this is SDC, more accurately SDC is long term aim. At the moment its just asking for a form to be completed and responding with the completed form.
Jose Costa Teixeira (Aug 25 2021 at 10:01):
I read that instead of a QuestionnaireResponse we want a MessageBundle - that is SDC.
Jose Costa Teixeira (Aug 25 2021 at 10:02):
Oliver's implementation has a working $extract operation
Jose Costa Teixeira (Aug 25 2021 at 10:05):
https://ahdis.github.io/matchbox-formfiller/#/questionnaire/referral-min
Grahame Grieve (Aug 25 2021 at 10:29):
you could ask on #questionnaire
Dave Barnet (Aug 25 2021 at 10:55):
@Jose Costa Teixeira - probably just me being a bit dumb. I can fill in the questionnaire, get the QuestionnaireResponse below to update - how do I call the $extract operation & see the created resources?
Jose Costa Teixeira (Aug 25 2021 at 10:58):
Sorry, this is the link: https://ahdis.github.io/matchbox-formfiller/#/questionnaire/sdc-extract
Dave Barnet (Aug 25 2021 at 13:46):
Thanks @Jose Costa Teixeira - a nice demo of what's possible with $extract
Oliver Egger (Aug 25 2021 at 15:40):
@Dave Barnet the $extract operation is invoked after filling out the questionnaire, if it is specified in the questionnaire according to the SDC profile for StructureMap-based extraction. You can also invoke the $extract directly, however the server needs the questionnaire/structuremap available. we plan to set up a test server for the upcoming fhir connectathon that you can upload your questionnaires and fhir maps and will participate in the FHIR questionnaire track, if you are interested in using it do not hesitate to contact me.
Dave Barnet (Sep 03 2021 at 10:20):
@Oliver Egger - I'd be very interested in having a look at any test server you plan to set up in relation to SDC. I've had a "dabble" creating a couple of resources trying to create a Patient from a Questionnaire:
Questionnaire http://server.fire.ly/Questionnaire/e5c5e2d9-deab-462f-9581-450f4847fd55
QuestionnaireResponse http://server.fire.ly/QuestionnaireResponse/20f5a694-181a-452a-bcf8-a01f1e0f32ac
StructureMap http://server.fire.ly/StructureMap/49c4e073-4ee0-4417-b6aa-962d0c81ca8d
I'm sure the StructureMap isn't right, but I can't find anywhere to test it out?
Lloyd McKenzie (Sep 03 2021 at 17:48):
The FHIR validator allows you to execute StructureMaps
Oliver Egger (Sep 15 2021 at 20:44):
@Dave Barnet sorry for delayed response. Were you successful using the FHIR validator? If you want to try to run StructureMap you can post it also on our test server, see info here: https://github.com/ahdis/matchbox/blob/main/fml.http
Dave Barnet (Sep 20 2021 at 14:38):
Thanks for your help @Oliver Egger. To be honest, I think I've struggled with the help and guidance on the wiki pages (https://wiki.hl7.org/Using_the_FHIR_Validator_to_transform_content), which leads you to download the validator and set up the transform along the lines of
Validator [fileToTransform] -transform -output [outputFile] -log [logFile] -map [uriOfMap] -ig [folderOfIG]
... which for me produced either "Exception: Can only nominate a single -map parameter", or when I juggled the parameters and eventually got the validator to spark into life ""Exception: Can only have one source when doing a transform (found [c:\BaRS\TstQR.xml, http://fhir.nhs.uk/StructureMap/patientxform])" - which are the file names of the QR I want to transform.
The format that I eventually discovered that works (for me at least) is
Validator [fileToTransformFrom] -transform [StructureDefURI] -ig [IGFolder] -output [ResultsFile] -log [LogFile] -version
Which was fine for creating a patient with a gender element - I can even add a birthDate, but anything more complicated involving complex data types seems to be even harder (for example a QR has a text field for a name, how do you load this into Patient.name.text ? - Just my frustration - thanks for your help !
Lloyd McKenzie (Sep 20 2021 at 15:34):
@Joee Garcia Any words of advice?
Oliver Egger (Sep 20 2021 at 18:40):
@Dave Barnet we started the same way as you did, we moved then to a server side approach that the iteration gets faster. You can fill the patient.name.text with the following rule:
src.item as item where linkId.value in ('patient.name.text') -> tgt.name as name, name.text = (item.answer.valueString);
Oliver Egger (Sep 20 2021 at 18:42):
you can try the map here yourself: https://ahdis.github.io/matchbox-formfiller/#/mappinglanguage
when you load the qr response and map into the editor qrpatienttext.json qrpatienttext.map
Dave Barnet (Sep 22 2021 at 08:59):
Thanks for that link @Oliver Egger - that was very useful & I've managed to create most of a Patient resource from a QR (just using valueString in the QR). I'm not sure how to create a CodeableConcept in the target. For example, I (following your example) I tried to create Patient.maritalStatus. I tried
src.item as thing where linkId.value in ('patient.maritalStatus') -> tgt.maritalStatus as maritalStatus, maritalStatus=(thing.answer.valueString);
src.item as thing where linkId.value in ('patient.maritalStatus') -> tgt.maritalStatus as maritalStatus, maritalStatus.code=(thing.answer.valueString);
src.item as thing where linkId.value in ('patient.maritalStatus') -> tgt.maritalStatus as maritalStatus, maritalStatus.coding.code=(thing.answer.valueString);
src.item as thing where linkId.value in ('patient.maritalStatus') -> tgt.maritalStatus = cc("SomeSystem", "123");
...but none of these worked. I also had issues creating anything described as element[x] (for example deceasedBoolean). For example none of these worked
src.item as thing where linkId.value in ('patient.deadOrNot') -> tgt.deceasedBoolean as deceasedBoolean, deceasedBoolean= ("true");
src.item as thing where linkId.value in ('patient.deadOrNot') -> tgt.deceasedBoolean = ("true");
src.item as thing where linkId.value in ('patient.deadOrNot') -> tgt.deceasedBoolean as deceasedBoolean, deceasedBoolean.value= ("true");
But overall I feel I'm making progress - Thanks again
Rik Smithies (Oct 11 2021 at 21:58):
does the FHIR validator execute StructureMaps or FML files?
Lloyd McKenzie (Oct 11 2021 at 22:00):
@Joee Garcia
Joee Garcia (Oct 11 2021 at 23:40):
@Rik Smithies I don't think the FHIR Validator supports FML files. I've only been able to execute StructureMaps with it. Check-out https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Mapping+Language#UsingtheFHIRMappingLanguage-ExecutewithaTransform
Last updated: Apr 12 2022 at 19:14 UTC