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 Oct 17, 2024
1 parent c29fe39 commit 9bca4bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion codelabs/engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,13 @@ outlined below will guide you through the process.
override fun getFhirEngine() = FhirApplication.fhirEngine(applicationContext)
override fun getUploadStrategy() = UploadStrategy.AllChangesSquashedBundlePut
override fun getUploadStrategy() =
UploadStrategy.forBundleRequest(
methodForCreate = HttpCreateMethod.PUT,
methodForUpdate = HttpUpdateMethod.PATCH,
squash = true,
bundleSize = 500,
)
}
```
Expand Down
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`.

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 9bca4bd

Please sign in to comment.