Closed danielcoam closed 3 years ago
Hi, @danielcoam Thank you for the contribution!
What FHIR server implementation do you use?
P.S.
The documentation is confusing.
Based on general guidelines http://hl7.org/fhir/http.html#styleguide _format
may be passed.
However _format
doesn't define for DELETE http://hl7.org/fhir/http.html#delete . It looks wrong to me since DELETE may return OperationOutcome in some cases http://hl7.org/fhir/http.html#3.1.0.7.1 and it make sense to define the format of OperationOutcome resource by _format
Hi @ir4y Thanks for the response!
I use FHIR-R4 on Google Cloud Healthcare API
It looks (http://hl7.org/fhir/http.html#3.1.0.7.1 ) that in very rare cases when there is no support in a Conditional delete there might be an OperationOutcome response.
But the majority of DELETE operations won't support that.
What I did in our project meanwhile is that:
class CustomizedFHIRAsyncClient(AsyncFHIRClient):
"""
There is a bug in the library see :https://github.com/beda-software/fhir-py/issues/71
The only thing we are changing in the `AsyncFHIRClient` is removing the _format=json from DELETE operation
"""
async def _do_request(self, method, path, data=None, params=None):
headers = self._build_request_headers()
url = self._build_request_url(path, params)
if method.lower() == 'delete': # The change from the original function
url = url.split('_format=json')[0][:-1]
async with aiohttp.request(
method, url, json=data, headers=headers
) as r:
if 200 <= r.status < 300:
data = await r.text()
return json.loads(data, object_hook=AttrDict)
if r.status == 404 or r.status == 410:
raise ResourceNotFound(await r.text())
raise OperationOutcome(await r.text())
But it means we are on a fixed version(1.2.0) of the fhirpy
package and we can't get any updates.
It's a major blocking that I think should be fixed in the library (the only thing that's weird for me is that there isn't an open bug already)
@danielcoam Now it should work. Please upgrade to 1.2.1
I can't make the
delete()
resource function workThis is my remove-patient function
The Error I get from the FHIR server:
It looks like the problem is here : https://github.com/beda-software/fhir-py/blob/master/fhirpy/base/lib.py#L90 When adding the
_format=json
to theDELETE
requestWhen I remove this line it works as expected.
Any help? Couldn't find an open issue for that