Se ha usado un servidor hapiproject/hapi:v6.1.0
Configuración del servidor
Cambiar variable en archivo application.yaml
hapi: fhir: bulk_export_enabled:true spring: datasource: hikari: auto-commit:false
Request
POST /fhir/$export HTTP/1.1 Host: localhost:8081 Prefer: respond-async Content-Type: application/json { "resourceType": "Parameters", "parameter": [ { "name": "_outputFormat", "valueString": "application/fhir+ndjson" }, { "name": "_type", "valueString": "Patient" }, { "name": "_since", "valueInstant": "2019-10-25T11:01:45.660-04:00" }, { "name": "_typeFilter", "valueString": "Patient?identifier=foo" } ] }
Response
En la respuesta se recibirá una respuesta vacía pero en los headers o cabeceras de esa respuesta estara la variable Content-Location que será donde podemos ver el estado del $export
HEADERS
X-Powered-By: HAPI FHIR 6.1.0 REST Server (FHIR Server; FHIR 4.0.1/R4) Content-Location: http://localhost:8081/fhir/$export-poll-status?_jobId=851971dd-3ab6-4c2b-8d0c-bc36ef8cfb41 Content-Length: 0 Date: Mon, 14 Nov 2022 14:31:39 GMT Keep-Alive: timeout=60 Connection: keep-alive
Al ir a la ruta ej: http://localhost:8081/fhir/$export-poll-status?_jobId=851971dd-3ab6-4c2b-8d0c-bc36ef8cfb41
se podrá ver el estado del export y su linik de descarga en caso de que este completada.
En caso de no estar listo el export en los headers se encontrará su estado
En caso de estar listo retornará el resultado.
{ "transactionTime": "2022-11-14T15:24:02.554+00:00", "output": [ { "type": "Patient", "url": "http://localhost:8081/fhir/Binary/152" } ] }
Se detecta que el export solo funciona 1 vez por _type