Find Out What Resources Were Exported During the $export Operation
This guide explains how to find out what resources certain Bulk client had access to
$export operation is used to export huge amounts of patient data directly to S3 buckets. Sometimes it is important to clarify what resources certain Bulk client had access to.
In the guide we analyze the behavior of the inferno-my-clinic-bulk-client client
When the client used $export
To clarify when our client exported the data:
- 1.Open the
kibanaUI - 2.Enter the search request like
w_cid:inferno-my-clinic-bulk-client and w_m:get and w_url like /bulk-api/Group//$exportw_cidis the id of out client
- 3.Define the dates range
- 4.Press the
Refreshbutton
When the request list appears, collect if of the exported groups and timestamps.
- 1.Extract group id from the
w_urlproperty/tenant/my-clinic/bulk-api/Group/test-group-1/$export->test-group-1 - 2.Extract timestamp from the
tsproperty ->Dec 5, 2022 @ 16:34:30.417
Get list of patients
To get list of affected by the $export patient records:
- 1.Open the
REST Consolein Aidbox - 2.Perform the
GET /Group/test-group-1/_historyrequest for each group collected on the previous step - 3.Search for the version being active during the export (
tsproperty). The matching version haslastUpdatedless thants. If there are several versions, the closes totsshould be taken - 4.List of patient are held in the
memberssection
member:
- entity:
id: test-pt-1
resourceType: Patient
Get list of the resource were exported
List of resource types client had access to
List of resources types are defined with the scope attribute.
- 1.Open the
REST Consolein Aidbox - 2.Perform the
GET /Client/inferno-my-clinic-bulk-client/_historyrequest - 3.Search for the version being active during the export (
tsproperty). The matching version haslastUpdatedless thants. If there are several versions, the closes totsshould be taken - 4.List of resources the client had access to is defined by the
scopeproperty - 5.Convert scopes to the resource types
system/Observation.read->Observationresource type
See how system/*.read expands
List the id of resources
This should be done for every patient and resource type
To build the list of patient compartment resources:
- 1.Open the
REST Consolein Aidbox - 2.Clarify how to search for the patient's resources (see patient compartment )
- 3.Get the list of the resources. For example,
GET /fhir/Observation?subject=test-pt-1&_elements=id - 4.Collect all the ids related to the patient and a resource type.
The output could be a table like this.
| patient_id | resource_type | resource_id |
|---|---|---|
test-pt-1 | Observation | test-obs-1 |
test-pt-1 | Observation | test-obs-2 |
Location | loc-1 | |
test-pt-1 | Patient | test-pt-1 |
Location here is the example of the resource not in the compartment so the patient_id is empty
Get the exported resources details
This should be done for every row on the table above
To get the exported resources you should repeat those steps changing the resource type
- 1.Open the
REST Consolein Aidbox - 2.Perform the
GET /fhir/{resource_type}/{resource_id}/_historyrequest. For example,GET /fhir/Observation/test-obs-1/_history - 3.Search for the version being active during the export (
tsproperty). The matching version haslastUpdatedless thants. If there are several versions, the closes totsshould be taken