Upload Strategy
Defines strategies for uploading FHIR resource local changes to a server during synchronization. It is used by the FhirSyncWorker to determine the specific upload behavior.
To specify an upload strategy, override getUploadStrategy in your app's FhirSyncWorker, for example:
override fun getUploadStrategy(): UploadStrategy =
UploadStrategy.forBundleRequest(methodForCreate = HttpCreateMethod.PUT, methodForUpdate = HttpUpdateMethod.PATCH, squash = true, bundleSize = 500)
The strategy you select depends on the server's capabilities (for example, support for PUT
vs POST
requests), and your business requirements (for example, maintaining the history of every local change).
Each strategy specifies three key aspects of the upload process:
Fetching local changes: This determines which local changes are included in the upload, specified by the localChangesFetchMode property.
Generating patches: This determines how the local changes are represented for upload, specified by the patchGeneratorMode property.
Creating upload requests: This determines how the patches are packaged and sent to the server, specified by the requestGeneratorMode property.
Note: The strategies listed here represent all currently supported combinations of local change fetching, patch generation, and upload request creation. Not all possible combinations of these modes are valid or supported.