Description
The current export javabatch can only support the system level export of the spec.
We need to support patient export - export all patients' related resources.
https://build.fhir.org/ig/HL7/bulk-data/OperationDefinition-patient-export.html
Steps
-
Update the API $export Operation to accept the submission pattern from client for patient export with parameters:
(1) -since (optional, if without, then export for all patient)
(2) -format (optional, only support ndjson)
(3) -resourceTypes (optional, if no resource Type, then the job will export all resourcetypes for patient) -
Update the API $export Operation to call the patient export java batch job and pass in the parameters.
-
Create new java batch job for patient export
(1) Take the parameters from patient export operation.
(2) Construct the to-be-exported resource types - resource types parsed from the passed-in parameter or all compartment resource types of Patient.
(3) For each resource type
(a) Search and get a page of patients, for each found patient:
-- compartment search using patient id to get the resources.
-- write the found resources into buffer stream.
(b) If checkpoint satisfied, then write the buffered resources to COS bucket and append the exported file info to batch job exit status.
checkpoint algorithm: page of patients per exported file or by file size.
(4) After all resource types are processed, exit the batch job. -
Update the API $export Operation to parse the job exit status and construct links of exported resource type files and response to client.