Stream: hapi
Topic: Transactions and Conditional PATCH
Dexter (Feb 01 2021 at 07:59):
I'm trying to send this transaction. Crate a Patient, and then, assign a device to that patient.
So, as a part of a transaction, I have this entry. But this doesn't work, says Invalid match URL[21] - URL has no search parameters
So, Question 1, what's wrong here?
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
// other entries
{
"resource": {
"resourceType": "Parameters",
"parameter": [
{
"name": "operation",
"part": [
{
"name": "type",
"valueString": "add"
},
{
"name": "path",
"valueString": "Device"
},
{
"name": "name",
"valueString": "patient"
},
{
"name": "value",
"valueReference": {
"reference": "Patient/id",
"type": "Patient"
}
}
]
}
]
},
"request": {
"method": "PATCH",
"url": "Device/1835297",
"ifMatch": "id"
}
}
]
}
Dexter (Feb 01 2021 at 08:01):
So as an alternative, I'm doing this, first check version with a JSON PATCH test
like so
{
"resource": {
"resourceType": "Binary",
"contentType": "application/json-patch+json",
"data": "WwogICAgewogICAgICAgICJvcCI6ICJ0ZXN0IiwKICAgICAgICAicGF0aCI6ICIvbWV0YS92ZXJzaW9uSWQiLAogICAgICAgICJ2YWx1ZSI6ICIyMiIKICAgIH0KXQ=="
},
"request": {
"method": "PATCH",
"url": "Device/1835297"
}
}
// rest of the entries above
This works, since the transaction can either work or fail as a whole. Great!
Now, the main part
Dexter (Feb 01 2021 at 08:22):
I'm trying to create a patient, and assign a device. I was told by kind volunteers that Binary
resource doesn't resolve references to items that are a part of a transaction, and I should use FHIRPatch, but that didn't seem to work either.
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"resource": {
"resourceType": "Binary",
"contentType": "application/json-patch+json",
"data": "base64( [{ "op": "test", "path": "/meta/versionId", "value": "versionId"}] )"
},
"request": {
"method": "PATCH",
"url": "Device/1835297"
}
},
{
"fullUrl": "urn:uuid:abe0b81e-2aca-44c7-8469-1dc1f7301fe9",
"resource": {
"resourceType": "Patient",
// some data
},
"request": {
"method": "POST"
}
},
{
"resource": {
"resourceType": "Parameters",
"parameter": [
{
"name": "operation",
"part": [
{
"name": "type",
"valueString": "add"
},
{
"name": "path",
"valueString": "Device"
},
{
"name": "name",
"valueString": "patient"
},
{
"name": "value",
"valueReference": {
// This must resolve to "Patient/someid"
"reference": "urn:uuid:abe0b81e-2aca-44c7-8469-1dc1f7301fe9",
"type": "Patient"
}
}
]
}
]
},
"request": {
"method": "PATCH",
"url": "Device/1835297"
}
}
]
}
{
"resourceType": "Device",
"id": "1835297",
// ... other data
"patient": {
"reference": "urn:uuid:abe0b81e-2aca-44c7-8469-1dc1f7301fe9",
"type": "Patient"
}
}
What am I doing wrong?
Lin Zhang (Feb 02 2021 at 00:56):
Just put your patient and the device entries in the same bundle of type transaction. Give the patient a uuid fullurl, then refer to the patient uuid in the device resource entry.
Dexter (Feb 02 2021 at 05:23):
Yeah I did that here, if I'm not mistaken
Also, queries with _offset
and _count
don't seem to return the total
field
I assume this means that all searches are supposed to return the total
parameter in response bundles
Dexter (Feb 03 2021 at 08:10):
How do I check for support for FHIRPatch
. I"m trying this on the public server at hapi.fhir.org
. How do I get this transaction to work?
René Spronk (Feb 03 2021 at 08:58):
Have you tried using FHIRPatch as a 'standalone' REST interaction (outside of a bundle) ? Does that work?
Dexter (Feb 03 2021 at 08:59):
Yep! That's the first thing I checked to make sure I could use parameters
, and know for-sure that I had the syntax right
René Spronk (Feb 03 2021 at 09:06):
Have you tried using FHIRPatch in a transaction (with only the PATCH in it) ? Does that work as expected ?
Dexter (Feb 03 2021 at 09:08):
Yes! The above JSON request I sent works, just that the urn:uuid:xx...
doesn't resolve to the fullUrl
of the Patient
René Spronk (Feb 03 2021 at 09:15):
You'd better contact the authors of HAPI -looks like a bug to me. Although I'm not sure if this would work on one of the other public test servers either.
Dexter (Feb 03 2021 at 09:26):
Yikes, really? I'll try with another public server, a few mins
Dexter (Feb 03 2021 at 09:37):
I just tried with server.fire.ly/R4
, and I get this error
"text": "Interaction POST in entry with fullUrl urn:uuid:7a712ad0-c34f-4faa-930c-ab3edaf85652 is
not supported: A transaction Bundle cannot contain a nested Batch or Transaction interaction"
I don't see what's nested?
Nevermind, just noticed this on the public servers list
This test instance runs on MongoDB and therefore can do batch but not transaction.
, so I guess vonk public server wasn't the right one to try against. Trying with something else
Dexter (Feb 03 2021 at 09:40):
René Spronk said:
Although I'm not sure if this would work on one of the other public test servers either.
I see, so it's an uncommon feature implementation?
Dexter (Feb 03 2021 at 10:02):
René Spronk said:
You'd better contact the authors of HAPI -looks like a bug to me. Although I'm not sure if this would work on one of the other public test servers either.
Where do I file this bug report? Also, I tried on https://r4.test.pyrohealth.net/fhir
, and doesn't seem to follow transaction rules itself, as test
PATCH OP works, even though it should be failing
Joel Schneider (Feb 03 2021 at 15:21):
According to the hapifhir.io site ...
GitHub issue tracker is here:
https://github.com/hapifhir/hapi-fhir/issues
Google Group for discussion is here:
https://groups.google.com/g/hapi-fhir
Dexter (Feb 04 2021 at 05:04):
Thank you, I posted the issue on GitHub
Christiaan Knaap (Feb 04 2021 at 10:52):
On server.fire.ly we simulate transactions for testing purposes.
I don't see the mentioned fullUrl urn:uuid:7a712ad0-c34f-4faa-930c-ab3edaf85652
in the transaction mentioned by you here. Could you post the exact transaction you were sending to server.fire.ly/R4 so I can reproduce the issue?
Dexter (Feb 04 2021 at 11:02):
I sent a new one, server.fire.ly/R4/Operation-Outcome/0a1159de-67c1-4fae-922f-76eb10b0068d
. Please do let me know if I need to share the request payload
Dexter (Feb 04 2021 at 11:02):
That doesn't seem to have the full response, here it is
{
"resourceType": "OperationOutcome",
"id": "0a1159de-67c1-4fae-922f-76eb10b0068d",
"meta": {
"versionId": "e36072c6-71d0-40f6-85d2-401d625e4e83",
"lastUpdated": "2021-02-04T11:00:27.944+00:00"
},
"issue": [
{
"severity": "warning",
"code": "not-supported",
"details": {
"coding": [
{
"system": "http://hl7.org/fhir/dotnet-api-operation-outcome",
"code": "5003"
}
],
"text": "Argument is not supported"
},
"diagnostics": "/Device"
},
{
"severity": "warning",
"code": "not-supported",
"details": {
"coding": [
{
"system": "http://hl7.org/fhir/dotnet-api-operation-outcome",
"code": "5003"
}
],
"text": "Argument is not supported"
},
"diagnostics": "/48d8b843-7e9f-4cfe-99ef-da0688725aba"
},
{
"severity": "error",
"code": "not-supported",
"details": {
"coding": [
{
"system": "http://hl7.org/fhir/dotnet-api-operation-outcome",
"code": "5005"
}
],
"text": "Interaction PATCH Device/48d8b843-7e9f-4cfe-99ef-da0688725aba in entry is not implemented."
}
}
]
}
Dexter (Feb 08 2021 at 07:12):
Do I have any alternatives? I could go with making 2 separate requests (which is what I'm doing right now), but would be great to have just one do it
Dexter (Feb 10 2021 at 08:55):
How do I query Practitioner
, PractitionerRole
, CareTeam
for a given patient? I have a patient with a careteam. I can get the Practitioner
, CareTeam
, but getting the PractitionerRole
eludes me. This is what I have
https://hapi.fhir.org/baseR4/CareTeam?subject=id&_include=CareTeam:participant
Dexter (Feb 10 2021 at 09:01):
Got it! I jut had to look at it from a different perspective!
https://hapi.fhir.org/baseR4/Practitioner
?_has:CareTeam:participant:subject=1852143
&_revinclude=PractitionerRole:practitioner
&_revinclude=CareTeam:participant
Last updated: Apr 12 2022 at 19:14 UTC