How to track progress of dollar operation jobs on a hapi fhir server

94 views Asked by At

I am writing a frontend application that allows user to explore data stored on a hapi FHIR server(R4). As a result I can only interact with the server through the api.

The hapi FHIR server version in use does not support search on CareTeam resource by default, but I found i could use the SearchParameter resource to add support for such a usecase.

So I posted a custom search parameter for CareTeams like shown below:

{
  "id": "a19e1405-e08c-4f7e-bef6-80486637a2ec",
  "resourceType": "SearchParameter",
  "name": "careteam-search",
  "status": "active",
  "description": "Custom search parameter using name for CareTeams",
  "code": "name",
  "base": ["CareTeam"],
  "type": "string",
  "expression": "CareTeam.name",
  "comparator": ["eq"],
  "modifier": ["contains"],
  "multipleOr": false,
  "multipleAnd": false
}

I noticed that the search was not applied to all careteams, I did a bit of research and apparently one needs to explicitly reindex previously existing careteams so that they can be matched.

To do this I sent a POST request to /$reindex

{
    "resourceType": "Parameters",
    "parameter": [
        {
            "name": "targetSearchParameterTypes",
            "valueString": "SearchParameter/a19e1405-e08c-4f7e-bef6-80486637a2ec"
        }
    ]
}

This returns a jobid as shown below:

{
    "resourceType": "Parameters",
    "parameter": [
        {
            "name": "jobId",
            "valueString": "f64336e0-756e-44d5-8445-6e9521364525"
        }
    ]
}

I would like to be sure that the job completed succesfully before i test if search now works.

My question is What request do I need to make to get the progress status of the job with the given jobid.

1

There are 1 answers

2
Ashavan On

Make a POST call to /$export-poll-status with the below body:

{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "_jobId",
      "valueString": "f64336e0-756e-44d5-8445-6e9521364525"
    }
  ]
}

You should see a response header of X-Progress that tells you the status.