Stream: implementers
Topic: Message Bundle support
Alex Goel (Feb 19 2021 at 15:08):
Hi, we're struggling with our FHIR Bundle type Message BundleAdrenalEx.xml We were able to test successfully against test.fhir.org/r4 but not against HAPI, Vonk, Spark, Aegis. Is Bundle.type Message not widely supported at this time? @Joel Francis
Lloyd McKenzie (Feb 19 2021 at 15:15):
Are you just trying to store it (posting it to the Bundle endpoint) or are you trying to have it processed? None of the reference implementations can process messages because processing requires specific coding for each message definition.
Kevin Mayfield (Feb 19 2021 at 15:51):
We have some custom code which validates using a MessageDefinition resource.
The eventCoding in a MessageDefinition must match in the FHIR Message Bundle.MessageHeader.eventCoding.
MessageDefinition states the profile to be used for the focus resource.
E.g.
https://simplifier.net/guide/DigitalMedicines/dispense-notification
These resources (MedicationDispense) are validated using that profile.
Alex Goel (Feb 19 2021 at 15:53):
Lloyd McKenzie said:
Are you just trying to store it (posting it to the Bundle endpoint) or are you trying to have it processed? None of the reference implementations can process messages because processing requires specific coding for each message definition.
Just a post, we typically get a 400 or 501 bad request, but it works on test.fhir.org/r4
Lloyd McKenzie (Feb 19 2021 at 15:58):
A post to what endpoint? Bundle or $process-message?
Alex Goel (Feb 19 2021 at 16:08):
Bundle
Alex Goel (Feb 19 2021 at 16:15):
ca.uhn.fhir.rest.server.exceptions.InvalidRequestException: HTTP 400 Bad Request: Unable to process transaction where incoming Bundle.type = message
Alex Goel (Feb 19 2021 at 16:33):
We found out our text element was failing on multiple servers, but working fine on test.fhir.org
Alex Goel (Feb 19 2021 at 16:35):
@James Agnew we had issues with our text element with the Bundle Message attached above. Here's the OperationOutcome we got from HAPI
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Failed to parse request body as JSON resource. Error was: Failed to parse JSON encoded FHIR content: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: UNKNOWN; line: 11, column: 20]</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "Failed to parse request body as JSON resource. Error was: Failed to parse JSON encoded FHIR content: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: UNKNOWN; line: 11, column: 20]"
}
]
}
Lloyd McKenzie (Feb 19 2021 at 17:04):
Systems should allow storing Bundles of whatever type at the Bundle endpoint. But they're not required to.
Gino Canessa (Feb 19 2021 at 17:08):
Do you have a copy of the JSON version? The example you posted is an XML and the error from HAPI is about parsing JSON. I'm wondering if there's an error in the conversion. (also, just to be sure; are you setting the content type on the request?)
Alex Goel (Feb 19 2021 at 18:30):
Alex Goel (Feb 19 2021 at 18:30):
Whoops! Yes we do. Here it is @Gino Canessa
Gino Canessa (Feb 19 2021 at 18:36):
The JSON is malformed; you cannot have actual newlines in the text (need to replace with \n
). As a note, those characters shouldn't be there anyway, since you should not have anything between the delimiter and literal (e.g., should be (edit: doing too many things at once =)<div
).
Fixing the two instances of that (can test in https://jsonlint.com) lets it pass validation, I think it will work after that.
Kevin Mayfield (Feb 21 2021 at 07:08):
If you don't want use the individual resources and not just store it, I would consider having some sort of processor to convert the message into a transaction bundle.
Message bundle is not a format I would expect epr or fhir servers to directly support without some form of processing. They would use a message handling component to handle the interaction.
Last updated: Apr 12 2022 at 19:14 UTC