From bac7e2ad3166bd7384dfcb6108e6e99fcea42e4d Mon Sep 17 00:00:00 2001 From: lincmba Date: Wed, 7 Feb 2024 18:45:04 +0300 Subject: [PATCH] Update documentation --- README.md | 15 +++++++++++---- .../fhir/gateway/plugins/SyncAccessDecision.java | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index beb488b..b8ccc45 100755 --- a/README.md +++ b/README.md @@ -193,12 +193,19 @@ types through the gateway. The FHIR Gateway Mode allows for custom processing of responses from the FHIR server. The mode is triggered by a HTTP Header sent by the client named -`FHIR-Gateway-Mode` with a value of `list-entries`. +`FHIR-Gateway-Mode` with a value e.g. `list-entries`(Currently only supported). -##### Pagination +##### FHIR-Gateway-Mode: list-entries -Pagination is supported in fetching data from a FHIR server using the List -endpoint. This can be useful when dealing with Resources with high volume of +This mode is used when using the `/List` endpoint. Normally, fetching using this +endpoint returns a list of references which can then be used to query for the +actual resources. With this header value configured the response is instead a +Bundle that contains all the actual (referenced) resources. + +###### Pagination + +Pagination is supported in fetching the data from a FHIR server. This can be +useful when dealing with List resources that have a large number of referenced entries like Locations. To enable pagination, you need to include two parameters in the request URL: diff --git a/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java b/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java index 126ebfa..de0b631 100755 --- a/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java +++ b/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java @@ -321,6 +321,8 @@ private Bundle postProcessModeListEntries( } Bundle resultBundle = fhirR4Client.transaction().withBundle(requestBundle).execute(); + + // add total resultBundle.setTotal(requestBundle.getEntry().size()); // add pagination links @@ -329,7 +331,6 @@ private Bundle postProcessModeListEntries( Bundle.BundleLinkComponent selfLink = new Bundle.BundleLinkComponent(); List link = new ArrayList<>(); - ; String selfUrl = constructUpdatedUrl(request, parameters); selfLink.setRelation(IBaseBundle.LINK_SELF); selfLink.setUrl(selfUrl);