Unable to use HTTP Delete for operation $export-poll-status

82 views
Skip to first unread message

Shubham Chaurasia

unread,
Nov 24, 2023, 5:05:02 AM11/24/23
to HAPI FHIR
Hello,
I am having trouble with the Bulk Data Delete Request. This is what I did:
  1. I used the [fhir base]/Group/[id]/$export API and got an absolute URL of an endpoint from the Content-Location header for checking the status later (polling location).

  2. Then I used the endpoint DELETE [fhir base]/$export-poll-status?_jobId=58001db7-36ec-49e3-8d3d-01413db486bd, which I got from the first step, but it did not delete the request.

    The response I got was "Job instance <58001db7-36ec-49e3-8d3d-01413db486bd> was already cancelled or has completed.  Nothing to do".

  3. Then I used GET [fhir base]/$export-poll-status?_jobId=SOME_RANDOM_STRING_FOR_JOBID, and I still got the response.
This means the Delete request is not working. Here are the details of my working environment:
  • FHIR version: R4
  • Hapi FHIR Server version: 6.2.0
According to the change log, Issue Id: #3947, it says that this DELETE feature for $export-poll-status is added, but I am still unable to use it.

Can anyone please help me with the solution?

Thanks in advance!

Anton Kurylovich

unread,
Nov 24, 2023, 9:41:24 AM11/24/23
to HAPI FHIR
Hi Shubham, what's the full response you get in your step 3?

Shubham Chaurasia

unread,
Nov 24, 2023, 12:11:35 PM11/24/23
to Anton Kurylovich, HAPI FHIR
Thanks for the quick response. In step 3, I'm getting the 200 as status code and the response is :

{
  "transactionTime": "2023-11-24T16:55:19.080+00:00",
  "request": "/Group/1a/$export?_outputFormat=application%2Ffhir%2Bndjson&_type=Condition,Immunization,MedicationRequest,Provenance,Organization,CareTeam,Device,MedicationDispense,Patient,DiagnosticReport,Coverage,ServiceRequest,RelatedPerson,Practitioner,Specimen,AllergyIntolerance,CarePlan,Goal,Observation,Medication,Procedure,Encounter,DocumentReference,Location&_groupId=Group/1a&_mdm=false",
  "requiresAccessToken": true,
  "output": [
    {
      "type": "Condition",
      "url": "[fhir base]/fhir/Binary/4678"
    },
    {
      "type": "Immunization",
      "url": "[fhir base]/fhir/Binary/4684"
    },
    {
      "type": "MedicationRequest",
      "url": "[fhir base]/fhir/Binary/4666"
    },
    {
      "type": "Provenance",
      "url": "[fhir base]/fhir/Binary/4680"
    },
    {
      "type": "Organization",
      "url": "[fhir base]/fhir/Binary/4676"
    },
    {
      "type": "CareTeam",
      "url": "[fhir base]/fhir/Binary/4671"
    },
    {
      "type": "Device",
      "url": "[fhir base]/fhir/Binary/4663"
    },
    {
      "type": "MedicationDispense",
      "url": "[fhir base]/fhir/Binary/4674"
    },
    {
      "type": "Patient",
      "url": "[fhir base]/fhir/Binary/4675"
    },
    {
      "type": "DiagnosticReport",
      "url": "[fhir base]/fhir/Binary/4667"
    },
    {
      "type": "Coverage",
      "url": "[fhir base]/fhir/Binary/4682"
    },
    {
      "type": "ServiceRequest",
      "url": "[fhir base]/fhir/Binary/4672"
    },
    {
      "type": "RelatedPerson",
      "url": "[fhir base]/fhir/Binary/4681"
    },
    {
      "type": "Practitioner",
      "url": "[fhir base]/fhir/Binary/4662"
    },
    {
      "type": "Specimen",
      "url": "[fhir base]/fhir/Binary/4669"
    },
    {
      "type": "AllergyIntolerance",
      "url": "[fhir base]/fhir/Binary/4664"
    },
    {
      "type": "CarePlan",
      "url": "[fhir base]/fhir/Binary/4665"
    },
    {
      "type": "Goal",
      "url": "[fhir base]/fhir/Binary/4670"
    },
    {
      "type": "Observation",
      "url": "[fhir base]/fhir/Binary/4683"
    },
    {
      "type": "Medication",
      "url": "[fhir base]/fhir/Binary/4679"
    },
    {
      "type": "Procedure",
      "url": "[fhir base]/fhir/Binary/4673"
    },
    {
      "type": "Encounter",
      "url": "[fhir base]/fhir/Binary/4677"
    },
    {
      "type": "DocumentReference",
      "url": "[fhir base]/fhir/Binary/4661"
    },
    {
      "type": "Location",
      "url": "[fhir base]/fhir/Binary/4668"
    }
  ],
  "error": []
}


Instead of giving the full response with 200 status code, it should return the 404 error code.
Please let me know if you need more information.

Thanks!

--
You received this message because you are subscribed to a topic in the Google Groups "HAPI FHIR" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hapi-fhir/5leTO6AoIus/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/36d9de3a-8f81-46c2-83e7-00d80f9be4c7n%40googlegroups.com.

Anton Kurylovich

unread,
Nov 24, 2023, 1:20:49 PM11/24/23
to HAPI FHIR
What is the status of the job? Since the check is done on: 'if (theStatusEnum.equals(BulkExportJobStatusEnum.COMPLETE))'

https://github.com/hapifhir/hapi-fhir/blob/cfe99d7acd38b8b20d3273e1ddd65615a933ce67/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/provider/BulkDataExportProvider.java#L324 

Then I guess you get the "was already cancelled or has completed.  Nothing to do" error message that you mentioned

So if you want to be able to perform a DELETE (or expunge?) on COMPLETED jobs then that might a new issue to log in the project. 

Message has been deleted
Message has been deleted

Shubham Chaurasia

unread,
Nov 27, 2023, 2:43:49 AM11/27/23
to HAPI FHIR
I re-tried test today and it seems that the delete request is working. However, when I do the next GET request (Step 3), I get a 202 status code with an empty response. I expected to get a 404 status code. Here are the steps I followed:
  1. I made an export request using the Group resource(Worked Perfectly)
    URL: [https://fhir-dev.intelimd.com/Group/42202/$export]
    Method: GET
    Status Code: 202
    Reposne Header (content-location): [https://fhir-dev.intelimd.com/fhir/$export-poll-status?_jobId=e3ba61bc-645f-4faa-8db4-ed5ffb5be7cc]

  2. I deleted the bulk data request(Worked Perfectly)
    URL: [https://fhir-dev.intelimd.com/fhir/$export-poll-status?_jobId=e3ba61bc-645f-4faa-8db4-ed5ffb5be7cc]
    Method: DELETE
    Status Code: 202

  3. I got the bulk data using the same jobId(Found an issue for status code)
    URL: [https://fhir-dev.intelimd.com/fhir/$export-poll-status?_jobId=e3ba61bc-645f-4faa-8db4-ed5ffb5be7cc]
    Method: GET
    Status Code: 202
I thought that after deleting, the next GET request would return a 404 status code, but instead I got a 202 status code with an empty response. This is causing the inferno tests to fail. Here are the screenshots from the inferno test tool, which might help you debug the problem.

ss-1.pngss--2.png

Anton Kurylovich

unread,
Nov 27, 2023, 10:24:17 AM11/27/23
to HAPI FHIR
Thanks for more details, I would just log a github issue for this, and see if you can make a pull request as needed. 

Although, since the main blocker here is to get the right response, you might be able to intercept the request as needed and return a 404 in the time being. You can use the pre process outgoing exception pointcut: https://hapifhir.io/hapi-fhir/docs/interceptors/server_pointcuts.html 

Shubham Chaurasia

unread,
Nov 30, 2023, 7:05:52 AM11/30/23
to HAPI FHIR
Thank you for your feedback. I have made some modifications to pass the inferno test. I am looking forward to the simple solutions.
Reply all
Reply to author
Forward
0 new messages