Skip to content

Commit

Permalink
Update documentation for UploadStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
MJ1998 committed Jan 29, 2025
1 parent be94dd5 commit 68ae067
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/use/FEL/Sync-data-with-FHIR-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Finally, provide an implementation of `FhirSyncWorker`. This class is responsibl
* **`getDownloadWorkManager()`**: This should return the implementation of `DownloadWorkManager` you created earlier.
* **`getConflictResolver()`**: This controls how conflicts between the local and remote versions of resources are resolved. You can set it to `AcceptLocalConflictResolver` if the local version should take precedence, or `AcceptRemoteConflictResolver` if the remote version should.
* **`getFhirEngine()`**: This should return your application's `FhirEngine` instance.
* **`getUploadStrategy()`**: This defines how local changes are uploaded to the FHIR server. Currently, the only supported strategy is `UploadStrategy.AllChangesSquashedBundlePut`, which squashes all local changes into a single bundle and uses the `PUT` method to upload it.
* **`getUploadStrategy()`**: This defines how local changes are uploaded to the FHIR server. You can provide either `UploadStrategy.forBundleRequest` or `UploadStrategy.forIndividualRequest`. Both take `methodForCreate` (PUT/POST), `methodForUpdate` (PUT/PATCH) and `squash` parameters. `forBundleRequest` also takes `bundleSize`.

Here's an example implementation:

Expand All @@ -107,7 +107,12 @@ class FhirPeriodicSyncWorker(appContext: Context, workerParams: WorkerParameters
override fun getFhirEngine() = FhirApplication.fhirEngine(applicationContext)

override fun getUploadStrategy(): UploadStrategy {
return UploadStrategy.AllChangesSquashedBundlePut
return UploadStrategy.forBundleRequest(
methodForCreate = HttpCreateMethod.PUT,
methodForUpdate = HttpUpdateMethod.PATCH,
squash = true,
bundleSize = 500,
)
}
}
```
Expand Down

0 comments on commit 68ae067

Please sign in to comment.