From 9066ad618ec61dfc102fe18800fc143d477c53cf Mon Sep 17 00:00:00 2001 From: Justin McKelvy <60718638+Capt-Mac@users.noreply.github.com> Date: Fri, 31 Mar 2023 09:09:50 -0600 Subject: [PATCH] Bug cql engine paging (#4664) * WIP paging * iterable HapifhirRetrieveProvider * Bundle iterating action * cr config update * adding paging functionality for search in cr * updating BundleIterable logic and removing paging references * add measureeval threaded config into cr * update properties * adding hapi change log 4663 * version bump for hapi * update exception with msg.code, move copyright * exorcism of paging provider from cr * updating IT tests for terminology evaluatemeasure * unit test, javadocs, removed reflection code * added comments for explanation * fix javadoc, iterable.size instead of method * update from master --------- Co-authored-by: Jonathan Percival Co-authored-by: justin.mckelvy --- hapi-deployable-pom/pom.xml | 3 +- hapi-fhir-android/pom.xml | 3 +- hapi-fhir-base/pom.xml | 3 +- hapi-fhir-bom/pom.xml | 6 +- hapi-fhir-checkstyle/pom.xml | 3 +- hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 3 +- hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 3 +- hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 3 +- hapi-fhir-cli/pom.xml | 3 +- hapi-fhir-client-okhttp/pom.xml | 3 +- hapi-fhir-client/pom.xml | 3 +- hapi-fhir-converter/pom.xml | 3 +- hapi-fhir-dist/pom.xml | 3 +- hapi-fhir-docs/pom.xml | 3 +- .../6_6_0/4663-cr-bundleiterable.yaml | 4 + hapi-fhir-jacoco/pom.xml | 3 +- hapi-fhir-jaxrsserver-base/pom.xml | 3 +- hapi-fhir-jpa/pom.xml | 3 +- hapi-fhir-jpaserver-base/pom.xml | 3 +- .../predicate/ParsedLocationParam.java | 19 +++ .../pom.xml | 2 +- hapi-fhir-jpaserver-ips/pom.xml | 3 +- hapi-fhir-jpaserver-mdm/pom.xml | 3 +- hapi-fhir-jpaserver-model/pom.xml | 3 +- hapi-fhir-jpaserver-searchparam/pom.xml | 3 +- hapi-fhir-jpaserver-subscription/pom.xml | 2 +- hapi-fhir-jpaserver-test-dstu2/pom.xml | 3 +- hapi-fhir-jpaserver-test-dstu3/pom.xml | 3 +- hapi-fhir-jpaserver-test-r4/pom.xml | 3 +- hapi-fhir-jpaserver-test-r4b/pom.xml | 3 +- hapi-fhir-jpaserver-test-r5/pom.xml | 3 +- hapi-fhir-jpaserver-test-utilities/pom.xml | 3 +- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 3 +- hapi-fhir-server-mdm/pom.xml | 3 +- hapi-fhir-server-openapi/pom.xml | 3 +- hapi-fhir-server/pom.xml | 2 +- .../hapi-fhir-caching-api/pom.xml | 3 +- .../hapi-fhir-caching-caffeine/pom.xml | 6 +- .../hapi-fhir-caching-guava/pom.xml | 3 +- .../hapi-fhir-caching-testing/pom.xml | 3 +- hapi-fhir-serviceloaders/pom.xml | 2 +- .../pom.xml | 3 +- .../pom.xml | 2 +- .../pom.xml | 3 +- .../pom.xml | 3 +- .../hapi-fhir-spring-boot-samples/pom.xml | 3 +- .../hapi-fhir-spring-boot-starter/pom.xml | 3 +- hapi-fhir-spring-boot/pom.xml | 3 +- hapi-fhir-sql-migrate/pom.xml | 3 +- hapi-fhir-storage-batch2-jobs/pom.xml | 3 +- .../pom.xml | 3 +- hapi-fhir-storage-batch2/pom.xml | 3 +- hapi-fhir-storage-cr/pom.xml | 3 +- .../ca/uhn/fhir/cr/common/BundleIterable.java | 108 ++++++++++++++++ .../ca/uhn/fhir/cr/common/HapiFhirDal.java | 12 +- .../cr/common/HapiFhirRetrieveProvider.java | 107 +++++++++++----- .../cr/common/HapiLibrarySourceProvider.java | 12 +- .../uhn/fhir/cr/common/IDaoRegistryUser.java | 12 +- .../java/ca/uhn/fhir/cr/common/Searches.java | 20 +-- .../fhir/cr/common/TypedBundleProvider.java | 121 ------------------ .../config/BaseClinicalReasoningConfig.java | 8 +- .../ca/uhn/fhir/cr/config/CrProperties.java | 32 +++-- .../ISupplementalDataSearchParamUser.java | 4 +- .../r4/ISupplementalDataSearchParamUser.java | 4 +- .../fhir/cr/r4/measure/MeasureService.java | 1 + .../fhir/cr/dstu3/CrProviderDstu3Test.java | 1 - .../dstu3/MeasureOperationsProviderTest.java | 21 +-- .../uhn/fhir/cr/r4/BundleIterableR4Test.java | 34 +++++ .../ca/uhn/fhir/cr/r4/HapiFhirDalR4Test.java | 2 + .../cr/r4/MeasureOperationsProviderTest.java | 47 ++----- hapi-fhir-storage-mdm/pom.xml | 3 +- hapi-fhir-storage-test-utilities/pom.xml | 3 +- hapi-fhir-storage/pom.xml | 3 +- hapi-fhir-structures-dstu2.1/pom.xml | 3 +- hapi-fhir-structures-dstu2/pom.xml | 3 +- hapi-fhir-structures-dstu3/pom.xml | 3 +- hapi-fhir-structures-hl7org-dstu2/pom.xml | 3 +- hapi-fhir-structures-r4/pom.xml | 3 +- hapi-fhir-structures-r4b/pom.xml | 3 +- hapi-fhir-structures-r5/pom.xml | 3 +- hapi-fhir-test-utilities/pom.xml | 3 +- hapi-fhir-testpage-overlay/pom.xml | 3 +- .../pom.xml | 3 +- hapi-fhir-validation-resources-dstu2/pom.xml | 3 +- hapi-fhir-validation-resources-dstu3/pom.xml | 3 +- hapi-fhir-validation-resources-r4/pom.xml | 3 +- hapi-fhir-validation-resources-r4b/pom.xml | 3 +- hapi-fhir-validation-resources-r5/pom.xml | 3 +- hapi-fhir-validation/pom.xml | 3 +- hapi-tinder-plugin/pom.xml | 3 +- hapi-tinder-test/pom.xml | 3 +- pom.xml | 9 +- .../pom.xml | 3 +- .../pom.xml | 3 +- .../pom.xml | 3 +- 95 files changed, 469 insertions(+), 335 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4663-cr-bundleiterable.yaml create mode 100644 hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/BundleIterable.java delete mode 100644 hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/TypedBundleProvider.java create mode 100644 hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/BundleIterableR4Test.java diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml index 1b7c182e078..e441d7d527b 100644 --- a/hapi-deployable-pom/pom.xml +++ b/hapi-deployable-pom/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index 5818dfe25a1..a1c20ea9219 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 09ddbf0237c..527d33045cd 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml index a99eaf1df80..c284916d5eb 100644 --- a/hapi-fhir-bom/pom.xml +++ b/hapi-fhir-bom/pom.xml @@ -4,14 +4,16 @@ 4.0.0 ca.uhn.hapi.fhir hapi-fhir-bom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + pom HAPI FHIR BOM ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-checkstyle/pom.xml b/hapi-fhir-checkstyle/pom.xml index ce1e98b167d..5dfd29dbf5b 100644 --- a/hapi-fhir-checkstyle/pom.xml +++ b/hapi-fhir-checkstyle/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml index eb6a202b53f..7d28ec0892e 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml index 7ea8223ec77..fdbd8852b6e 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-fhir-cli - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml index 395e1c3804f..7b91c6a1835 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../../hapi-deployable-pom diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml index b10e5c6a525..e575e9f19f1 100644 --- a/hapi-fhir-cli/pom.xml +++ b/hapi-fhir-cli/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml index d286cbfe899..8cce88f6f38 100644 --- a/hapi-fhir-client-okhttp/pom.xml +++ b/hapi-fhir-client-okhttp/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml index 46e3d673a8a..353b3e5f911 100644 --- a/hapi-fhir-client/pom.xml +++ b/hapi-fhir-client/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index 59fc6c3391f..d104e6e1d83 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml index 34b5ae46560..f5bff28ee82 100644 --- a/hapi-fhir-dist/pom.xml +++ b/hapi-fhir-dist/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml index 76a4092c1ae..0f9fb71b21f 100644 --- a/hapi-fhir-docs/pom.xml +++ b/hapi-fhir-docs/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4663-cr-bundleiterable.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4663-cr-bundleiterable.yaml new file mode 100644 index 00000000000..62aafd18863 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4663-cr-bundleiterable.yaml @@ -0,0 +1,4 @@ +--- +type: fix +issue: 4663 +title: "Removing previous bundle provider to allow for iterableBundle provider, which will allow for paging resources instead of full consumption of patient resources at once" diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index 8e631445293..817e3ba5360 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -11,7 +11,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml index 51905769ddc..33a2db27f7d 100644 --- a/hapi-fhir-jaxrsserver-base/pom.xml +++ b/hapi-fhir-jaxrsserver-base/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpa/pom.xml b/hapi-fhir-jpa/pom.xml index 5a975911383..cca0c44b1ce 100644 --- a/hapi-fhir-jpa/pom.xml +++ b/hapi-fhir-jpa/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 15ff024a435..919495a0656 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ParsedLocationParam.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ParsedLocationParam.java index 9cbff347df4..83a039bae4d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ParsedLocationParam.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ParsedLocationParam.java @@ -1,3 +1,22 @@ +/*- + * #%L + * HAPI FHIR JPA Server + * %% + * Copyright (C) 2014 - 2023 Smile CDR, Inc. + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ package ca.uhn.fhir.jpa.search.builder.predicate; import ca.uhn.fhir.i18n.Msg; diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml index 155f910781b..9366244137b 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-ips/pom.xml b/hapi-fhir-jpaserver-ips/pom.xml index a5299f65b0c..d2b73607d76 100644 --- a/hapi-fhir-jpaserver-ips/pom.xml +++ b/hapi-fhir-jpaserver-ips/pom.xml @@ -3,7 +3,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml index 7c7e3cf63df..e8ea1cf50bf 100644 --- a/hapi-fhir-jpaserver-mdm/pom.xml +++ b/hapi-fhir-jpaserver-mdm/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml index 32bda9446b2..5f4d44eb132 100644 --- a/hapi-fhir-jpaserver-model/pom.xml +++ b/hapi-fhir-jpaserver-model/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index 919bc44e3d2..c4a9573c00b 100755 --- a/hapi-fhir-jpaserver-searchparam/pom.xml +++ b/hapi-fhir-jpaserver-searchparam/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml index 31057f5d5cf..44f9f99114e 100644 --- a/hapi-fhir-jpaserver-subscription/pom.xml +++ b/hapi-fhir-jpaserver-subscription/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-dstu2/pom.xml b/hapi-fhir-jpaserver-test-dstu2/pom.xml index b47403a8aed..a17747196fb 100644 --- a/hapi-fhir-jpaserver-test-dstu2/pom.xml +++ b/hapi-fhir-jpaserver-test-dstu2/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-dstu3/pom.xml b/hapi-fhir-jpaserver-test-dstu3/pom.xml index 6e3d678efaa..3736e0c4db6 100644 --- a/hapi-fhir-jpaserver-test-dstu3/pom.xml +++ b/hapi-fhir-jpaserver-test-dstu3/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r4/pom.xml b/hapi-fhir-jpaserver-test-r4/pom.xml index 9440a00dd7f..fd9b3ed19a4 100644 --- a/hapi-fhir-jpaserver-test-r4/pom.xml +++ b/hapi-fhir-jpaserver-test-r4/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r4b/pom.xml b/hapi-fhir-jpaserver-test-r4b/pom.xml index 4ec28024f50..9c3a6a89453 100644 --- a/hapi-fhir-jpaserver-test-r4b/pom.xml +++ b/hapi-fhir-jpaserver-test-r4b/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r5/pom.xml b/hapi-fhir-jpaserver-test-r5/pom.xml index dc6d9004053..1c89efe3595 100644 --- a/hapi-fhir-jpaserver-test-r5/pom.xml +++ b/hapi-fhir-jpaserver-test-r5/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml index 1c1d73a5bcb..7ad67eb5a2a 100644 --- a/hapi-fhir-jpaserver-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-test-utilities/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 1f402d2e2b8..2a0c24e8643 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml index fbc55be0278..bf5f2f7e63a 100644 --- a/hapi-fhir-server-mdm/pom.xml +++ b/hapi-fhir-server-mdm/pom.xml @@ -7,7 +7,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml index a6b7820b943..1aa1f3964e3 100644 --- a/hapi-fhir-server-openapi/pom.xml +++ b/hapi-fhir-server-openapi/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml index ca546a930b7..9ac559847fa 100644 --- a/hapi-fhir-server/pom.xml +++ b/hapi-fhir-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml index 7bf0def22b2..1ee90c11193 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml @@ -7,7 +7,8 @@ hapi-fhir-serviceloaders ca.uhn.hapi.fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml index 1c714597adc..7f0b4cb5393 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml @@ -7,7 +7,8 @@ hapi-fhir-serviceloaders ca.uhn.hapi.fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml @@ -20,7 +21,8 @@ ca.uhn.hapi.fhir hapi-fhir-caching-api - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + com.github.ben-manes.caffeine diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml index d4b4fb9eef3..daf46316b28 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml @@ -7,7 +7,8 @@ hapi-fhir-serviceloaders ca.uhn.hapi.fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml index 431ae23be57..c31afccb6c6 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml @@ -7,7 +7,8 @@ hapi-fhir ca.uhn.hapi.fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../../pom.xml diff --git a/hapi-fhir-serviceloaders/pom.xml b/hapi-fhir-serviceloaders/pom.xml index fb1f0f59a34..9ad1901fcb1 100644 --- a/hapi-fhir-serviceloaders/pom.xml +++ b/hapi-fhir-serviceloaders/pom.xml @@ -5,7 +5,7 @@ hapi-deployable-pom ca.uhn.hapi.fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml index 3d08b37a1a8..e252a859ba6 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml index aeca5576baf..654e5b26f4c 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT hapi-fhir-spring-boot-sample-client-apache diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml index d80bae417aa..fc133911fe5 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + hapi-fhir-spring-boot-sample-client-okhttp diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml index 9564ad68070..921216e8166 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + hapi-fhir-spring-boot-sample-server-jersey diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml index d770448c31e..8c8264d5925 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + hapi-fhir-spring-boot-samples diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml index dc9f2ef620d..40503f51578 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml index facbc3d28e9..07414ae1840 100644 --- a/hapi-fhir-spring-boot/pom.xml +++ b/hapi-fhir-spring-boot/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-sql-migrate/pom.xml b/hapi-fhir-sql-migrate/pom.xml index efeb350e52f..f60f09c4c5e 100644 --- a/hapi-fhir-sql-migrate/pom.xml +++ b/hapi-fhir-sql-migrate/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-batch2-jobs/pom.xml b/hapi-fhir-storage-batch2-jobs/pom.xml index 937c77e9ca2..228e8647f17 100644 --- a/hapi-fhir-storage-batch2-jobs/pom.xml +++ b/hapi-fhir-storage-batch2-jobs/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage-batch2-test-utilities/pom.xml b/hapi-fhir-storage-batch2-test-utilities/pom.xml index e529da84be2..0975820d7e7 100644 --- a/hapi-fhir-storage-batch2-test-utilities/pom.xml +++ b/hapi-fhir-storage-batch2-test-utilities/pom.xml @@ -7,7 +7,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-batch2/pom.xml b/hapi-fhir-storage-batch2/pom.xml index 6dc1ae63e3d..ed8bec9ece7 100644 --- a/hapi-fhir-storage-batch2/pom.xml +++ b/hapi-fhir-storage-batch2/pom.xml @@ -7,7 +7,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-cr/pom.xml b/hapi-fhir-storage-cr/pom.xml index 318071ec63e..9deef4b95a6 100644 --- a/hapi-fhir-storage-cr/pom.xml +++ b/hapi-fhir-storage-cr/pom.xml @@ -7,7 +7,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/BundleIterable.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/BundleIterable.java new file mode 100644 index 00000000000..23dc63bbeba --- /dev/null +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/BundleIterable.java @@ -0,0 +1,108 @@ +/*- + * #%L + * HAPI FHIR - Clinical Reasoning + * %% + * Copyright (C) 2014 - 2023 Smile CDR, Inc. + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package ca.uhn.fhir.cr.common; + +import ca.uhn.fhir.rest.api.server.IBundleProvider; +import ca.uhn.fhir.rest.api.server.RequestDetails; +import org.hl7.fhir.instance.model.api.IBaseResource; + +import javax.annotation.concurrent.NotThreadSafe; +import java.util.Iterator; +import java.util.List; + +/** + * This class leverages IBundleProvider Iterable to provide an iterator for processing bundle search results into manageable paginated chunks. This helped to avoid loading large result sets into lists + **/ + +@NotThreadSafe +public class BundleIterable implements Iterable { + + private final IBundleProvider sourceBundleProvider; + private final RequestDetails requestDetails; + + + public BundleIterable(RequestDetails requestDetails, IBundleProvider bundleProvider) { + this.sourceBundleProvider = bundleProvider; + this.requestDetails = requestDetails; + } + + @Override + public Iterator iterator() { + return new BundleIterator(this.requestDetails, this.sourceBundleProvider); + } + + static class BundleIterator implements Iterator { + + private IBundleProvider bundleProvider; + + private int offset = 0; + private int increment = 50; + private List currentResourceList; + + private final RequestDetails requestDetails; + + private int currentResourceListIndex = 0; + + + public BundleIterator(RequestDetails requestDetails, IBundleProvider bundleProvider) { + this.bundleProvider = bundleProvider; + this.requestDetails = requestDetails; + initChunk(); + } + + private void initChunk() { + this.currentResourceList = this.bundleProvider.getResources(offset, increment + offset); + // next offset created + offset += increment; + //restart counter on new chunk + currentResourceListIndex = 0; + } + + private void loadNextChunk() { + initChunk(); + } + + @Override + public boolean hasNext() { + // We still have things in the current chunk to return + if (this.currentResourceListIndex < this.currentResourceList.size()) { + return true; + } else if (this.currentResourceList.size() == 0) { + // no more resources! + return false; + } + + // We need our next chunk + this.loadNextChunk(); + return this.hasNext(); + } + + + @Override + public IBaseResource next() { + assert this.currentResourceListIndex < this.currentResourceList.size(); + + var result = this.currentResourceList.get(this.currentResourceListIndex); + this.currentResourceListIndex++; + return result; + } + } +} + diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiFhirDal.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiFhirDal.java index 2b722913cc8..2c958efc38f 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiFhirDal.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiFhirDal.java @@ -37,7 +37,7 @@ public class HapiFhirDal implements FhirDal { protected final RequestDetails myRequestDetails; public HapiFhirDal(DaoRegistry theDaoRegistry) { - this(theDaoRegistry, null); + this(theDaoRegistry,null); } public HapiFhirDal(DaoRegistry theDaoRegistry, RequestDetails theRequestDetails) { @@ -70,15 +70,15 @@ public class HapiFhirDal implements FhirDal { @Override public Iterable search(String theResourceType) { var b = this.myDaoRegistry.getResourceDao(theResourceType) - .search(SearchParameterMap.newSynchronous(), myRequestDetails); - return TypedBundleProvider.fromBundleProvider(b).getAllResources(); + .search(new SearchParameterMap(), myRequestDetails); + return new BundleIterable(myRequestDetails, b); } @Override public Iterable searchByUrl(String theResourceType, String theUrl) { - var c = this.myDaoRegistry.getResourceDao(theResourceType) - .search(SearchParameterMap.newSynchronous().add("url", new UriParam(theUrl)), myRequestDetails); - return TypedBundleProvider.fromBundleProvider(c).getAllResources(); + var b = this.myDaoRegistry.getResourceDao(theResourceType) + .search(new SearchParameterMap().add("url", new UriParam(theUrl)), myRequestDetails); + return new BundleIterable(myRequestDetails, b); } diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiFhirRetrieveProvider.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiFhirRetrieveProvider.java index 4c205d5a015..d3200d6df73 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiFhirRetrieveProvider.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiFhirRetrieveProvider.java @@ -21,7 +21,6 @@ package ca.uhn.fhir.cr.common; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.model.api.IQueryParameterType; -import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -31,13 +30,11 @@ import org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterResolver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; +import java.util.function.BiFunction; /** * This class provides an implementation of the cql-engine's RetrieveProvider @@ -51,6 +48,7 @@ public class HapiFhirRetrieveProvider extends SearchParamFhirRetrieveProvider im private final DaoRegistry myDaoRegistry; private final RequestDetails myRequestDetails; + public HapiFhirRetrieveProvider(DaoRegistry theDaoRegistry, SearchParameterResolver theSearchParameterResolver) { this(theDaoRegistry, theSearchParameterResolver, new SystemRequestDetails()); } @@ -62,47 +60,98 @@ public class HapiFhirRetrieveProvider extends SearchParamFhirRetrieveProvider im this.myRequestDetails = requestDetails; } + /** + * The queryIterable class provides an Iterable to cycle through a series of search queries and results of those queries, implementation of this avoided loading all resources into a list. + */ + static class QueryIterable implements Iterable { + + private final String dataType; + private final List queries; + + private final BiFunction> queryFunc; + + public QueryIterable(String dataType, List queries, BiFunction> queryFunc) { + this.dataType = dataType; + this.queries = queries; + this.queryFunc = queryFunc; + } + + static class QueryIterator implements Iterator { + + private final String dataType; + private final List queries; + + private final BiFunction> queryFunc; + + Iterator currentResult = null; + + public QueryIterator(String dataType, List queries, BiFunction> queryFunc) { + this.dataType = dataType; + this.queries = queries; + this.queryFunc = queryFunc; + } + + private int index = 0; + + @Override + public boolean hasNext() { + // initial load of first query results + if (currentResult == null && index < queries.size()) { + currentResult = loadNext(); + } + // when query results exhaust load next query + else if (!currentResult.hasNext()) { + currentResult = loadNext(); + } + // hasNext on current query result + return currentResult != null && currentResult.hasNext(); + } + + @Override + public Object next() { + return currentResult.next(); + } + + Iterator loadNext() { + // check to make sure there are more queries remaining + if (index >= queries.size()) { + return null; + } + //extract next query result + var result = this.queryFunc.apply(dataType, queries.get(index)).iterator(); + index++; + return result; + } + } + + public Iterator iterator() { + return new QueryIterator(dataType, queries, queryFunc); + } + } + @Override protected Iterable executeQueries(String dataType, List queries) { if (queries == null || queries.isEmpty()) { return Collections.emptyList(); } - List objects = new ArrayList<>(); - for (SearchParameterMap map : queries) { - objects.addAll(executeQuery(dataType, map)); - } - - return objects; + return new QueryIterable(dataType, queries, this::executeQuery); } - protected List executeQuery(String dataType, SearchParameterMap map) { - // TODO: Once HAPI breaks this out from the server dependencies - // we can include it on its own. - ca.uhn.fhir.jpa.searchparam.SearchParameterMap hapiMap = ca.uhn.fhir.jpa.searchparam.SearchParameterMap - .newSynchronous(); + protected Iterable executeQuery(String dataType, SearchParameterMap map) { + ca.uhn.fhir.jpa.searchparam.SearchParameterMap hapiMap = new ca.uhn.fhir.jpa.searchparam.SearchParameterMap(); try { - Method[] methods = hapiMap.getClass().getDeclaredMethods(); - List methodList = Arrays.asList(methods); - List puts = methodList.stream().filter(x -> x.getName().equals("put")).collect(Collectors.toList()); - Method method = puts.get(0); - method.setAccessible(true); - for (Map.Entry>> entry : map.entrySet()) { - method.invoke(hapiMap, entry.getKey(), entry.getValue()); + hapiMap.put(entry.getKey(), entry.getValue()); + } } catch (Exception e) { logger.warn("Error converting search parameter map", e); } - IBundleProvider bundleProvider = search(getClass(dataType), hapiMap, myRequestDetails); - if (bundleProvider.isEmpty()) { - return new ArrayList<>(); - } - - return bundleProvider.getAllResources(); + return search(getClass(dataType), hapiMap, myRequestDetails); } @Override diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiLibrarySourceProvider.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiLibrarySourceProvider.java index 550c1dd510d..02ee27194b9 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiLibrarySourceProvider.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/HapiLibrarySourceProvider.java @@ -30,7 +30,7 @@ import org.opencds.cqf.cql.evaluator.fhir.util.Versions; import java.io.ByteArrayInputStream; import java.io.InputStream; -import java.util.List; +import java.util.ArrayList; /** * This class provides an implementation of the cql-translator's LibrarySourceProvider @@ -56,14 +56,18 @@ public class HapiLibrarySourceProvider return this.myDaoRegistry; } + @Override public InputStream getLibraryContent(VersionedIdentifier theLibraryIdentifier, LibraryContentType theLibraryContentType) { String name = theLibraryIdentifier.getId(); String version = theLibraryIdentifier.getVersion(); - List libraries = search(getClass("Library"), Searches.byName(name), myRequestDetails) - .getAllResources(); - IBaseResource library = Versions.selectByVersion(libraries, version, + var libraries = search(getClass("Library"), Searches.byName(name), myRequestDetails); + var libraryList = new ArrayList(); + for(var l:libraries){ + libraryList.add(l); + } + IBaseResource library = Versions.selectByVersion(libraryList, version, Libraries::getVersion); if (library == null) { diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/IDaoRegistryUser.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/IDaoRegistryUser.java index a4d987b447c..e6295fbf513 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/IDaoRegistryUser.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/IDaoRegistryUser.java @@ -225,7 +225,7 @@ public interface IDaoRegistryUser { * @param theSearchMap the Search Parameters * @return Bundle provider */ - default TypedBundleProvider search(Class theResourceClass, + default Iterable search(Class theResourceClass, SearchParameterMap theSearchMap) { checkNotNull(theResourceClass); checkNotNull(theSearchMap); @@ -243,13 +243,13 @@ public interface IDaoRegistryUser { * @param theRequestDetails multi-tenancy information * @return Bundle provider */ - default TypedBundleProvider search(Class theResourceClass, - SearchParameterMap theSearchMap, - RequestDetails theRequestDetails) { + default Iterable search(Class theResourceClass, + SearchParameterMap theSearchMap, + RequestDetails theRequestDetails) { checkNotNull(theResourceClass); checkNotNull(theSearchMap); - return TypedBundleProvider.fromBundleProvider( - getDaoRegistry().getResourceDao(theResourceClass).search(theSearchMap, theRequestDetails)); + var provider = getDaoRegistry().getResourceDao(theResourceClass).search(theSearchMap, theRequestDetails); + return new BundleIterable(theRequestDetails, provider); } } diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/Searches.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/Searches.java index ca2d251aed5..eb3ffb09f17 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/Searches.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/Searches.java @@ -56,20 +56,6 @@ public class Searches { * Creates and returns Parameter search results */ public static SearchParameterMap all() { - return sync(); - } - - /** - * Creates and returns Parameter search results - */ - public static SearchParameterMap sync() { - return SearchParameterMap.newSynchronous(); - } - - /** - * Creates and returns Parameter search results - */ - public static SearchParameterMap async() { return new SearchParameterMap(); } @@ -84,7 +70,7 @@ public class Searches { checkNotNull(theParamName); checkNotNull(theParam); - return sync().add(theParamName, theParam); + return all().add(theParamName, theParam); } /** @@ -155,7 +141,7 @@ public class Searches { params.addOr(new UriParam(theUrl)); }); - return sync().add(ID_SP, params); + return all().add(ID_SP, params); } /** @@ -263,6 +249,6 @@ public class Searches { params.addOr(new TokenParam(theIdPart)); }); - return sync().add(ID_SP, params); + return all().add(ID_SP, params); } } diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/TypedBundleProvider.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/TypedBundleProvider.java deleted file mode 100644 index da6fd4f774d..00000000000 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/common/TypedBundleProvider.java +++ /dev/null @@ -1,121 +0,0 @@ -/*- - * #%L - * HAPI FHIR - Clinical Reasoning - * %% - * Copyright (C) 2014 - 2023 Smile CDR, Inc. - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ -package ca.uhn.fhir.cr.common; - -import ca.uhn.fhir.rest.api.server.IBundleProvider; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IPrimitiveType; - -import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -public class TypedBundleProvider implements IBundleProvider { - - private final IBundleProvider myInnerProvider; - - private TypedBundleProvider(IBundleProvider theInnerProvider) { - checkState(theInnerProvider.getNextPageId() == null, - "TypedBundleProvider does not support paging and theInnerProvider has a next page."); - myInnerProvider = checkNotNull(theInnerProvider); - } - - public static TypedBundleProvider fromBundleProvider( - IBundleProvider theBundleProvider) { - return new TypedBundleProvider<>(theBundleProvider); - } - - @Override - public IPrimitiveType getPublished() { - return myInnerProvider.getPublished(); - } - - @Override - public List getResources(int theFromIndex, int theToIndex) { - return myInnerProvider.getResources(theFromIndex, theToIndex); - } - - @Override - public String getUuid() { - return myInnerProvider.getUuid(); - } - - @Override - public Integer preferredPageSize() { - return myInnerProvider.preferredPageSize(); - } - - @Override - public Integer size() { - return myInnerProvider.size(); - } - - @Override - public List getAllResources() { - var size = size(); - if (size == null) { - return getResources(0, Integer.MAX_VALUE); - } else { - return getResources(0, size); - } - } - - @SuppressWarnings("unchecked") - public List getResourcesTyped(int theFromIndex, int theToIndex) { - return myInnerProvider.getResources(theFromIndex, theToIndex).stream().map(x -> (T) x) - .collect(Collectors.toList()); - } - - @SuppressWarnings("unchecked") - public List getAllResourcesTyped() { - return myInnerProvider.getAllResources().stream().map(x -> (T) x).collect(Collectors.toList()); - } - - /** - * Returns exactly one Resource. Throws an error if zero or more than one - * resource is found or if zero resources are found - * - * @return the Resource found. - */ - public T single() { - List resources = getResourcesTyped(0, 2); - checkState(!resources.isEmpty(), "No resources found"); - checkState(resources.size() == 1, "More than one resource found"); - return resources.get(0); - } - - /** - * Returns the first Resource found, or null if no resources are found. - * - * @return the first Resource found or null - */ - public T firstOrNull() { - List resources = getResourcesTyped(0, 1); - - if (resources.isEmpty()) { - return null; - } - - return resources.get(0); - } -} diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/BaseClinicalReasoningConfig.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/BaseClinicalReasoningConfig.java index 3bfa8d5e1f9..9d8d6453926 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/BaseClinicalReasoningConfig.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/BaseClinicalReasoningConfig.java @@ -59,7 +59,6 @@ import org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterResolver; import org.opencds.cqf.cql.engine.model.ModelResolver; import org.opencds.cqf.cql.engine.runtime.Code; import org.opencds.cqf.cql.evaluator.CqlOptions; -import org.opencds.cqf.cql.evaluator.builder.Constants; import org.opencds.cqf.cql.evaluator.builder.DataProviderComponents; import org.opencds.cqf.cql.evaluator.builder.EndpointInfo; import org.opencds.cqf.cql.evaluator.cql2elm.model.CacheAwareModelManager; @@ -68,6 +67,7 @@ import org.opencds.cqf.cql.evaluator.engine.execution.CacheAwareLibraryLoaderDec import org.opencds.cqf.cql.evaluator.engine.execution.TranslatingLibraryLoader; import org.opencds.cqf.cql.evaluator.engine.model.CachingModelResolverDecorator; import org.opencds.cqf.cql.evaluator.engine.retrieve.BundleRetrieveProvider; +import org.opencds.cqf.cql.evaluator.fhir.Constants; import org.opencds.cqf.cql.evaluator.fhir.adapter.AdapterFactory; import org.opencds.cqf.cql.evaluator.measure.MeasureEvaluationOptions; import org.opencds.cqf.cql.evaluator.spring.fhir.adapter.AdapterConfiguration; @@ -120,9 +120,13 @@ public abstract class BaseClinicalReasoningConfig { @Bean public MeasureEvaluationOptions measureEvaluationOptions(CrProperties theCrProperties) { - return theCrProperties.getMeasure().getMeasureEvaluation(); + theCrProperties.getMeasure(); + MeasureEvaluationOptions measureEvaluation = theCrProperties.getMeasure().getMeasureEvaluation(); + return measureEvaluation; } + + @Bean public CqlOptions cqlOptions(CrProperties theCrProperties) { return theCrProperties.getCql().getOptions(); diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/CrProperties.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/CrProperties.java index 4b91777b07d..d515781c2d1 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/CrProperties.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/config/CrProperties.java @@ -27,9 +27,14 @@ import org.opencds.cqf.cql.evaluator.measure.MeasureEvaluationOptions; public class CrProperties { private boolean enabled = true; - private MeasureProperties measureProperties = new MeasureProperties(); + private MeasureProperties measureProperties; private CqlProperties cqlProperties = new CqlProperties(); + public CrProperties () { + this.measureProperties = new MeasureProperties(); + }; + + public boolean isEnabled() { return enabled; } @@ -56,13 +61,27 @@ public class CrProperties { public static class MeasureProperties { - private boolean threadedCareGapsEnabled = true; private MeasureReportConfiguration measureReportConfiguration; + private MeasureEvaluationOptions measureEvaluationOptions; - private MeasureEvaluationOptions measureEvaluationOptions = MeasureEvaluationOptions.defaultOptions(); + public MeasureProperties() { + measureEvaluationOptions = MeasureEvaluationOptions.defaultOptions(); + measureEvaluationOptions.setNumThreads(4); + measureEvaluationOptions.setThreadedBatchSize(250); + measureEvaluationOptions.setThreadedEnabled(true); + }; + //eval options + public MeasureEvaluationOptions getMeasureEvaluation() { + return this.measureEvaluationOptions; + } + public void setMeasureEvaluation(MeasureEvaluationOptions measureEvaluation) { + this.measureEvaluationOptions = measureEvaluation; + } + + //care gaps public boolean getThreadedCareGapsEnabled() { return threadedCareGapsEnabled; } @@ -71,6 +90,7 @@ public class CrProperties { this.threadedCareGapsEnabled = enabled; } + //report configuration public MeasureReportConfiguration getMeasureReport() { return this.measureReportConfiguration; } @@ -79,13 +99,7 @@ public class CrProperties { this.measureReportConfiguration = measureReport; } - public MeasureEvaluationOptions getMeasureEvaluation() { - return this.measureEvaluationOptions; - } - public void setMeasureEvaluation(MeasureEvaluationOptions measureEvaluation) { - this.measureEvaluationOptions = measureEvaluation; - } public static class MeasureReportConfiguration { /** diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/dstu3/ISupplementalDataSearchParamUser.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/dstu3/ISupplementalDataSearchParamUser.java index d025467b497..769ffd63efb 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/dstu3/ISupplementalDataSearchParamUser.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/dstu3/ISupplementalDataSearchParamUser.java @@ -57,10 +57,10 @@ public interface ISupplementalDataSearchParamUser extends IDaoRegistryUser { new Coding(CODING_SYSTEM_CODE, CODING_COUNTRY_CODE, CODING_COUNTRY_DISPLAY))); default void ensureSupplementalDataElementSearchParameter(RequestDetails theRequestDetails) { - if (!search(SearchParameter.class, + if (search(SearchParameter.class, Searches.byUrlAndVersion(MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_URL, MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_VERSION), - theRequestDetails).isEmpty()) { + theRequestDetails).iterator().hasNext()) { return; } diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/r4/ISupplementalDataSearchParamUser.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/r4/ISupplementalDataSearchParamUser.java index 9be9405ae09..41cadef6396 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/r4/ISupplementalDataSearchParamUser.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/r4/ISupplementalDataSearchParamUser.java @@ -48,10 +48,10 @@ public interface ISupplementalDataSearchParamUser extends IDaoRegistryUser { new Coding("urn:iso:std:iso:3166", "US", "United States of America"))); default void ensureSupplementalDataElementSearchParameter(RequestDetails theRequestDetails) { - if (!search(SearchParameter.class, + if (search(SearchParameter.class, Searches.byUrlAndVersion(MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_URL, MEASUREREPORT_SUPPLEMENTALDATA_SEARCHPARAMETER_VERSION), - theRequestDetails).isEmpty()) { + theRequestDetails).iterator().hasNext()) { return; } diff --git a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/r4/measure/MeasureService.java b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/r4/measure/MeasureService.java index 3ebce00a666..94ddbb68b99 100644 --- a/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/r4/measure/MeasureService.java +++ b/hapi-fhir-storage-cr/src/main/java/ca/uhn/fhir/cr/r4/measure/MeasureService.java @@ -31,6 +31,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.param.ReferenceParam; +import ca.uhn.fhir.rest.server.IPagingProvider; import org.apache.commons.lang3.StringUtils; import org.cqframework.cql.cql2elm.LibrarySourceProvider; import org.hl7.fhir.instance.model.api.IBaseResource; diff --git a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/CrProviderDstu3Test.java b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/CrProviderDstu3Test.java index 70a4323e1ca..19e131e8cc2 100644 --- a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/CrProviderDstu3Test.java +++ b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/CrProviderDstu3Test.java @@ -23,7 +23,6 @@ import java.util.List; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/MeasureOperationsProviderTest.java b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/MeasureOperationsProviderTest.java index ee51b12838a..db09cd42c4f 100644 --- a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/MeasureOperationsProviderTest.java +++ b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/dstu3/MeasureOperationsProviderTest.java @@ -4,10 +4,8 @@ import ca.uhn.fhir.cr.BaseCrDstu3Test; import ca.uhn.fhir.cr.dstu3.measure.MeasureOperationsProvider; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import io.specto.hoverfly.junit.core.Hoverfly; -import io.specto.hoverfly.junit.dsl.StubServiceBuilder; import io.specto.hoverfly.junit5.HoverflyExtension; import org.hl7.fhir.dstu3.model.Bundle; -import org.hl7.fhir.dstu3.model.Endpoint; import org.hl7.fhir.dstu3.model.IdType; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -15,10 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import static io.specto.hoverfly.junit.core.SimulationSource.dsl; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -26,13 +21,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; @ExtendWith(HoverflyExtension.class) class MeasureOperationsProviderTest extends BaseCrDstu3Test { @Autowired - MeasureOperationsProvider measureOperationsProvider; + MeasureOperationsProvider myMeasureOperationsProvider; @Test void testMeasureEvaluate() throws IOException { loadBundle("Exm105Fhir3Measure.json"); - var returnMeasureReport = this.measureOperationsProvider.evaluateMeasure( + var returnMeasureReport = this.myMeasureOperationsProvider.evaluateMeasure( new IdType("Measure", "measure-EXM105-FHIR3-8.0.000"), "2019-01-01", "2020-01-01", @@ -56,7 +51,7 @@ class MeasureOperationsProviderTest extends BaseCrDstu3Test { var additionalData = readResource(Bundle.class, "Exm105FhirR3MeasureAdditionalData.json"); var patient = "Patient/denom-EXM105-FHIR3"; - var returnMeasureReport = this.measureOperationsProvider.evaluateMeasure( + var returnMeasureReport = this.myMeasureOperationsProvider.evaluateMeasure( new IdType("Measure", "measure-EXM105-FHIR3-8.0.000"), "2019-01-01", "2020-01-01", @@ -77,14 +72,8 @@ class MeasureOperationsProviderTest extends BaseCrDstu3Test { @Test void testMeasureEvaluateWithTerminology(Hoverfly hoverfly) throws IOException { loadBundle("Exm105Fhir3Measure.json"); - List reads = new ArrayList<>(); - reads.addAll(mockValueSet("2.16.840.1.114222.4.11.3591", "http://cts.nlm.nih.gov/fhir/ValueSet")); - reads.addAll(mockValueSet("2.16.840.1.113883.3.117.1.7.1.424", "http://cts.nlm.nih.gov/fhir/ValueSet")); - hoverfly.simulate(dsl(reads.toArray(new StubServiceBuilder[0]))); - var terminologyEndpoint = loadResource(ourFhirContext, Endpoint.class, "Endpoint.json"); - - var returnMeasureReport = this.measureOperationsProvider.evaluateMeasure( + var returnMeasureReport = this.myMeasureOperationsProvider.evaluateMeasure( new IdType("Measure", "measure-EXM105-FHIR3-8.0.000"), "2019-01-01", "2020-01-01", @@ -94,7 +83,7 @@ class MeasureOperationsProviderTest extends BaseCrDstu3Test { "2019-12-12", null, null, - terminologyEndpoint, + null, new SystemRequestDetails() ); diff --git a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/BundleIterableR4Test.java b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/BundleIterableR4Test.java new file mode 100644 index 00000000000..300d2216727 --- /dev/null +++ b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/BundleIterableR4Test.java @@ -0,0 +1,34 @@ +package ca.uhn.fhir.cr.r4; + +import ca.uhn.fhir.cr.BaseCrR4Test; +import ca.uhn.fhir.cr.common.BundleIterable; +import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; +import ca.uhn.fhir.rest.api.server.RequestDetails; +import com.google.common.collect.Iterables; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@ExtendWith(SpringExtension.class) +public class BundleIterableR4Test extends BaseCrR4Test { + private static final RequestDetails theRequestDetails = null; + private static final String MY_TEST_DATA = "ca/uhn/fhir/cr/r4/immunization/Patients_Encounters_Immunizations_Practitioners.json"; + + @Test + public void searchAllPatients() { + // load bundle + loadBundle(MY_TEST_DATA); //63 patients + var bundle1 = searchPatient(); //return BundleIterable + var firstCount = Iterables.size(bundle1); //count Patients + assertEquals(63, firstCount); + } + + public Iterable searchPatient() { + var b = this.myDaoRegistry.getResourceDao("Patient") + .search(new SearchParameterMap(), theRequestDetails); + return new BundleIterable(theRequestDetails, b); + } +} diff --git a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/HapiFhirDalR4Test.java b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/HapiFhirDalR4Test.java index 0838fa188bd..02847718c8f 100644 --- a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/HapiFhirDalR4Test.java +++ b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/HapiFhirDalR4Test.java @@ -2,6 +2,7 @@ package ca.uhn.fhir.cr.r4; import ca.uhn.fhir.cr.BaseCrR4Test; import ca.uhn.fhir.cr.common.HapiFhirDal; +import ca.uhn.fhir.rest.server.IPagingProvider; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -36,4 +37,5 @@ public class HapiFhirDalR4Test extends BaseCrR4Test { //verify all patient resources captured assertEquals(63, counter, "Patient search results don't match available resources"); } + } diff --git a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/MeasureOperationsProviderTest.java b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/MeasureOperationsProviderTest.java index a12c6edef78..2a6e0327b31 100644 --- a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/MeasureOperationsProviderTest.java +++ b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/r4/MeasureOperationsProviderTest.java @@ -4,9 +4,7 @@ import ca.uhn.fhir.cr.BaseCrR4Test; import ca.uhn.fhir.cr.r4.measure.MeasureOperationsProvider; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import io.specto.hoverfly.junit.core.Hoverfly; -import io.specto.hoverfly.junit.dsl.StubServiceBuilder; import io.specto.hoverfly.junit5.HoverflyExtension; -import org.hl7.fhir.r4.model.Endpoint; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.MeasureReport; import org.hl7.fhir.r4.model.Observation; @@ -17,27 +15,23 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit.jupiter.SpringExtension; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; import java.util.Optional; -import static io.specto.hoverfly.junit.core.SimulationSource.dsl; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @ExtendWith(SpringExtension.class) @ExtendWith(HoverflyExtension.class) class MeasureOperationsProviderTest extends BaseCrR4Test { @Autowired - MeasureOperationsProvider measureOperationsProvider; + MeasureOperationsProvider myMeasureOperationsProvider; @Test void testMeasureEvaluate() throws IOException { loadBundle("Exm104FhirR4MeasureBundle.json"); - var returnMeasureReport = this.measureOperationsProvider.evaluateMeasure( + var returnMeasureReport = this.myMeasureOperationsProvider.evaluateMeasure( new IdType("Measure", "measure-EXM104-8.2.000"), "2019-01-01", "2020-01-01", @@ -57,17 +51,8 @@ class MeasureOperationsProviderTest extends BaseCrR4Test { @Test void testMeasureEvaluateWithTerminologyEndpoint(Hoverfly hoverfly) throws IOException { loadBundle("Exm104FhirR4MeasureBundle.json"); - List reads = new ArrayList<>(); - reads.addAll(mockValueSet("2.16.840.1.114222.4.11.3591", "http://localhost:8080/fhir/ValueSet")); - reads.addAll(mockValueSet("2.16.840.1.113883.3.117.1.7.1.424", "http://localhost:8080/fhir/ValueSet")); - hoverfly.simulate(dsl(reads.toArray(new StubServiceBuilder[0]))); - var terminologyEndpointValid = readResource(Endpoint.class, "Endpoint.json"); - - var terminologyEndpointInvalid = readResource(Endpoint.class, "Endpoint.json"); - terminologyEndpointInvalid.setAddress("https://tx.nhsnlink.org/fhir234"); - - var returnMeasureReport = this.measureOperationsProvider.evaluateMeasure( + var returnMeasureReport = this.myMeasureOperationsProvider.evaluateMeasure( new IdType("Measure", "measure-EXM104-8.2.000"), "2019-01-01", "2020-01-01", @@ -77,33 +62,17 @@ class MeasureOperationsProviderTest extends BaseCrR4Test { "2019-12-12", null, null, - terminologyEndpointValid, + null, new SystemRequestDetails() ); assertNotNull(returnMeasureReport); - - var ex = assertThrows(Exception.class, () -> this.measureOperationsProvider.evaluateMeasure( - new IdType("Measure", "measure-EXM104-8.2.000"), - "2019-01-01", - "2020-01-01", - "subject", - "Patient/numer-EXM104", - null, - "2019-12-12", - null, - null, - terminologyEndpointInvalid, - new SystemRequestDetails() - )); - - assertTrue(ex.getMessage().contains("Error performing expansion")); } private void runWithPatient(String measureId, String patientId, int initialPopulationCount, int denominatorCount, int denominatorExclusionCount, int numeratorCount, boolean enrolledDuringParticipationPeriod, String participationPeriod) { - MeasureReport returnMeasureReport = this.measureOperationsProvider.evaluateMeasure( + var returnMeasureReport = this.myMeasureOperationsProvider.evaluateMeasure( new IdType("Measure", measureId), "2022-01-01", "2022-12-31", @@ -179,7 +148,7 @@ class MeasureOperationsProviderTest extends BaseCrR4Test { var measure = read(new IdType("Measure", "InitialInpatientPopulation")); assertNotNull(measure); - MeasureReport returnMeasureReport = this.measureOperationsProvider.evaluateMeasure( + MeasureReport returnMeasureReport = this.myMeasureOperationsProvider.evaluateMeasure( new IdType("Measure", "InitialInpatientPopulation"), "2019-01-01", "2020-01-01", @@ -211,7 +180,7 @@ class MeasureOperationsProviderTest extends BaseCrR4Test { this.loadBundle("multiversion/EXM124-7.0.000-bundle.json"); this.loadBundle("multiversion/EXM124-9.0.000-bundle.json"); - MeasureReport returnMeasureReportVersion7 = this.measureOperationsProvider.evaluateMeasure( + MeasureReport returnMeasureReportVersion7 = this.myMeasureOperationsProvider.evaluateMeasure( new IdType("Measure", "measure-EXM124-7.0.000"), "2019-01-01", "2020-01-01", @@ -225,7 +194,7 @@ class MeasureOperationsProviderTest extends BaseCrR4Test { assertNotNull(returnMeasureReportVersion7); - MeasureReport returnMeasureReportVersion9 = this.measureOperationsProvider.evaluateMeasure( + MeasureReport returnMeasureReportVersion9 = this.myMeasureOperationsProvider.evaluateMeasure( new IdType("Measure", "measure-EXM124-9.0.000"), "2019-01-01", "2020-01-01", diff --git a/hapi-fhir-storage-mdm/pom.xml b/hapi-fhir-storage-mdm/pom.xml index 0dcdf83e306..60066a5ff50 100644 --- a/hapi-fhir-storage-mdm/pom.xml +++ b/hapi-fhir-storage-mdm/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage-test-utilities/pom.xml b/hapi-fhir-storage-test-utilities/pom.xml index 7b277fc3371..9999fe09f01 100644 --- a/hapi-fhir-storage-test-utilities/pom.xml +++ b/hapi-fhir-storage-test-utilities/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage/pom.xml b/hapi-fhir-storage/pom.xml index d197455d9ec..6f11ff060bc 100644 --- a/hapi-fhir-storage/pom.xml +++ b/hapi-fhir-storage/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index 066b36b5c17..d0084401731 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index dbdca017748..ef71b937d84 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml index 8aa760dfab6..c8fa2d3c449 100644 --- a/hapi-fhir-structures-dstu3/pom.xml +++ b/hapi-fhir-structures-dstu3/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index 73edc71cc41..ccd93f02687 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml index ceb20fc4ec0..1e52e3f4500 100644 --- a/hapi-fhir-structures-r4/pom.xml +++ b/hapi-fhir-structures-r4/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4b/pom.xml b/hapi-fhir-structures-r4b/pom.xml index d51ebda76ae..bd7ade816dd 100644 --- a/hapi-fhir-structures-r4b/pom.xml +++ b/hapi-fhir-structures-r4b/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml index d6621fd2841..37ba353db07 100644 --- a/hapi-fhir-structures-r5/pom.xml +++ b/hapi-fhir-structures-r5/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml index d3d0acdffbf..22b247f556e 100644 --- a/hapi-fhir-test-utilities/pom.xml +++ b/hapi-fhir-test-utilities/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index cdd792a2ce3..4c7c761c97c 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml index 15d181a865a..ad099aa8be8 100644 --- a/hapi-fhir-validation-resources-dstu2.1/pom.xml +++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml index c3d4c9fbeef..73c4ab82734 100644 --- a/hapi-fhir-validation-resources-dstu2/pom.xml +++ b/hapi-fhir-validation-resources-dstu2/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml index a1e8fda645c..0d67e9ae1b4 100644 --- a/hapi-fhir-validation-resources-dstu3/pom.xml +++ b/hapi-fhir-validation-resources-dstu3/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml index 905ea60c365..b44d9106712 100644 --- a/hapi-fhir-validation-resources-r4/pom.xml +++ b/hapi-fhir-validation-resources-r4/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r4b/pom.xml b/hapi-fhir-validation-resources-r4b/pom.xml index a9d496a3785..98057f92ee1 100644 --- a/hapi-fhir-validation-resources-r4b/pom.xml +++ b/hapi-fhir-validation-resources-r4b/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml index b4286969d75..f273aa5ef7f 100644 --- a/hapi-fhir-validation-resources-r5/pom.xml +++ b/hapi-fhir-validation-resources-r5/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index c43a1655cb7..674c34520bc 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../hapi-deployable-pom/pom.xml diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index fed176ffb19..f03efe1b164 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml index f139afbd6a9..779ec51e9a8 100644 --- a/hapi-tinder-test/pom.xml +++ b/hapi-tinder-test/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../pom.xml diff --git a/pom.xml b/pom.xml index 1febbf2698f..4892f6d53ad 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,8 @@ ca.uhn.hapi.fhir hapi-fhir pom - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + HAPI-FHIR An open-source implementation of the FHIR specification in Java. https://hapifhir.io @@ -957,9 +958,9 @@ 1.28.4 - 2.4.0 - 2.3.0 - 2.3.0 + 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT + 3.0.0-SNAPSHOT 5.4.1 diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml index 22ef9bfaad8..e7f649a56b3 100644 --- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml +++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml @@ -6,7 +6,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml index 8e59b0fdc44..438ff1b8697 100644 --- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml @@ -4,7 +4,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml index 133c3fc38cb..d0e2511c615 100644 --- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml @@ -5,7 +5,8 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.8-SNAPSHOT + 6.5.9-SNAPSHOT + ../../pom.xml