Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation for UploadStrategy #2778

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading