From 8147c4ea4b61c2316f5e60f3dc4ee5e56ad6e912 Mon Sep 17 00:00:00 2001 From: Luke deGruchy Date: Fri, 7 Mar 2025 14:11:53 -0500 Subject: [PATCH 1/9] Everything compiles but there are still injection errors. --- pom.xml | 12 +++++++++++- .../jpa/starter/cdshooks/CdsHooksServlet.java | 2 +- .../starter/cdshooks/StarterCdsHooksConfig.java | 15 ++++++++------- .../starter/cdshooks/UpdatedCdsCrServiceR4.java | 4 ++-- .../cdshooks/UpdatedCrDiscoveryServiceR4.java | 4 ++-- .../uhn/fhir/jpa/starter/cr/CrCommonConfig.java | 6 +++--- .../jpa/starter/cr/StarterCrDstu3Config.java | 10 +++++----- .../fhir/jpa/starter/cr/StarterCrR4Config.java | 16 ++++++++-------- .../uhn/fhir/jpa/starter/CdsHooksServletIT.java | 6 +++--- .../fhir/jpa/starter/ExampleServerDstu3IT.java | 2 +- .../uhn/fhir/jpa/starter/ExampleServerR4IT.java | 2 +- 11 files changed, 45 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index ef2aec2..9230b86 100644 --- a/pom.xml +++ b/pom.xml @@ -6,6 +6,7 @@ 17 1 + 3.19.0-SNAPSHOT @@ -19,7 +20,9 @@ ca.uhn.hapi.fhir hapi-fhir - 8.0.0 + + + 8.1.1-LUKE-SNAPSHOT hapi-fhir-jpaserver-starter @@ -112,11 +115,18 @@ + + + org.opencds.cqf.fhir + cqf-fhir-cr-hapi + ${clinical-reasoning.version} + ca.uhn.hapi.fhir diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksServlet.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksServlet.java index 62a6b65..034d5cf 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksServlet.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/CdsHooksServlet.java @@ -24,7 +24,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import java.io.IOException; import java.util.stream.Collectors; -import static ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig.CDS_HOOKS_OBJECT_MAPPER_FACTORY; +import static org.opencds.cqf.fhir.cr.hapi.config.test.TestCdsHooksConfig.CDS_HOOKS_OBJECT_MAPPER_FACTORY; @Configurable public class CdsHooksServlet extends HttpServlet { diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java index a27d4b8..2d3535a 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java @@ -5,14 +5,14 @@ import ca.uhn.fhir.jpa.starter.cr.CrCommonConfig; import ca.uhn.fhir.jpa.starter.cr.CrConfigCondition; import ca.uhn.fhir.jpa.starter.cr.CrProperties; import ca.uhn.hapi.fhir.cdshooks.api.ICdsHooksDaoAuthorizationSvc; -import ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig; import ca.uhn.hapi.fhir.cdshooks.svc.CdsHooksContextBooter; -import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrServiceRegistry; -import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrSettings; -import ca.uhn.hapi.fhir.cdshooks.svc.cr.ICdsCrServiceRegistry; -import ca.uhn.hapi.fhir.cdshooks.svc.cr.discovery.CdsCrDiscoveryServiceRegistry; -import ca.uhn.hapi.fhir.cdshooks.svc.cr.discovery.ICdsCrDiscoveryServiceRegistry; import org.hl7.fhir.instance.model.api.IBaseResource; +import org.opencds.cqf.fhir.cr.hapi.cdshooks.CdsCrServiceRegistry; +import org.opencds.cqf.fhir.cr.hapi.cdshooks.CdsCrSettings; +import org.opencds.cqf.fhir.cr.hapi.cdshooks.ICdsCrServiceRegistry; +import org.opencds.cqf.fhir.cr.hapi.cdshooks.discovery.CdsCrDiscoveryServiceRegistry; +import org.opencds.cqf.fhir.cr.hapi.cdshooks.discovery.ICdsCrDiscoveryServiceRegistry; +import org.opencds.cqf.fhir.cr.hapi.config.CrCdsConfig; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -22,7 +22,8 @@ import org.springframework.context.annotation.Import; @Configuration @Conditional({CdsHooksConfigCondition.class, CrConfigCondition.class}) -@Import({CdsHooksConfig.class, CrCommonConfig.class}) +//@Import({CdsHooksConfig.class, CrCommonConfig.class}) +@Import({CrCdsConfig.class, CrCommonConfig.class}) public class StarterCdsHooksConfig { // @Bean diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrServiceR4.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrServiceR4.java index 249d477..e821ce9 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrServiceR4.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrServiceR4.java @@ -3,12 +3,12 @@ package ca.uhn.fhir.jpa.starter.cdshooks; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.cdshooks.CdsServiceRequestJson; import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService; -import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrServiceR4; import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.Parameters; import org.opencds.cqf.fhir.api.Repository; +import org.opencds.cqf.fhir.cr.hapi.cdshooks.CdsCrServiceR4; -import static ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrConstants.APPLY_PARAMETER_DATA; +import static org.opencds.cqf.fhir.utility.Constants.APPLY_PARAMETER_DATA; import static org.opencds.cqf.fhir.utility.r4.Parameters.part; public class UpdatedCdsCrServiceR4 extends CdsCrServiceR4 { diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryServiceR4.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryServiceR4.java index ba194eb..50676fa 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryServiceR4.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryServiceR4.java @@ -1,12 +1,12 @@ package ca.uhn.fhir.jpa.starter.cdshooks; -import ca.uhn.hapi.fhir.cdshooks.svc.cr.discovery.CrDiscoveryServiceR4; import org.hl7.fhir.instance.model.api.IIdType; import org.opencds.cqf.fhir.api.Repository; +import org.opencds.cqf.fhir.cr.hapi.cdshooks.discovery.CrDiscoveryServiceR4; public class UpdatedCrDiscoveryServiceR4 extends CrDiscoveryServiceR4 { public UpdatedCrDiscoveryServiceR4(IIdType thePlanDefinitionId, Repository theRepository) { super(thePlanDefinitionId, theRepository); - myMaxUriLength = 6000; + maxUriLength = 6000; } } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/CrCommonConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/CrCommonConfig.java index 26d7f5f..1822340 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cr/CrCommonConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/CrCommonConfig.java @@ -1,8 +1,5 @@ package ca.uhn.fhir.jpa.starter.cr; -import ca.uhn.fhir.cr.common.CodeCacheResourceChangeListener; -import ca.uhn.fhir.cr.common.CqlThreadFactory; -import ca.uhn.fhir.cr.common.ElmCacheResourceChangeListener; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry; import ca.uhn.fhir.jpa.cache.ResourceChangeListenerRegistryInterceptor; @@ -19,6 +16,9 @@ import org.opencds.cqf.cql.engine.runtime.Code; import org.opencds.cqf.fhir.cql.EvaluationSettings; import org.opencds.cqf.fhir.cql.engine.retrieve.RetrieveSettings; import org.opencds.cqf.fhir.cql.engine.terminology.TerminologySettings; +import org.opencds.cqf.fhir.cr.hapi.common.CodeCacheResourceChangeListener; +import org.opencds.cqf.fhir.cr.hapi.common.CqlThreadFactory; +import org.opencds.cqf.fhir.cr.hapi.common.ElmCacheResourceChangeListener; import org.opencds.cqf.fhir.cr.measure.CareGapsProperties; import org.opencds.cqf.fhir.cr.measure.MeasureEvaluationOptions; import org.opencds.cqf.fhir.utility.ValidationProfile; diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java index 44f7d42..b707ffc 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java @@ -1,11 +1,11 @@ package ca.uhn.fhir.jpa.starter.cr; -import ca.uhn.fhir.cr.config.dstu3.ApplyOperationConfig; -import ca.uhn.fhir.cr.config.dstu3.CrDstu3Config; -import ca.uhn.fhir.cr.config.dstu3.DataRequirementsOperationConfig; -import ca.uhn.fhir.cr.config.dstu3.EvaluateOperationConfig; -import ca.uhn.fhir.cr.config.dstu3.PackageOperationConfig; import ca.uhn.fhir.jpa.starter.annotations.OnDSTU3Condition; +import org.opencds.cqf.fhir.cr.hapi.config.dstu3.CrDstu3Config; +import org.opencds.cqf.fhir.cr.hapi.config.dstu3.DataRequirementsOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.dstu3.EvaluateOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.dstu3.PackageOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.ApplyOperationConfig; import org.springframework.context.annotation.*; @Configuration diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java index 28c10cf..d8ad4f1 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java @@ -1,14 +1,14 @@ package ca.uhn.fhir.jpa.starter.cr; -import ca.uhn.fhir.cr.config.r4.ApplyOperationConfig; -import ca.uhn.fhir.cr.config.r4.CrR4Config; -import ca.uhn.fhir.cr.config.r4.DataRequirementsOperationConfig; -import ca.uhn.fhir.cr.config.r4.EvaluateOperationConfig; -import ca.uhn.fhir.cr.config.r4.ExtractOperationConfig; -import ca.uhn.fhir.cr.config.r4.PackageOperationConfig; -import ca.uhn.fhir.cr.config.r4.PopulateOperationConfig; -import ca.uhn.fhir.cr.config.r4.QuestionnaireOperationConfig; import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition; +import org.opencds.cqf.fhir.cr.hapi.config.dstu3.DataRequirementsOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.dstu3.EvaluateOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.dstu3.PackageOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.ApplyOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.CrR4Config; +import org.opencds.cqf.fhir.cr.hapi.config.r4.ExtractOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.PopulateOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.QuestionnaireOperationConfig; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java index 6571487..112a88e 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.jpa.starter; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.cr.config.RepositoryConfig; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig; import ca.uhn.fhir.jpa.starter.cdshooks.StarterCdsHooksConfig; @@ -9,7 +8,6 @@ import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.hapi.fhir.cdshooks.api.ICdsServiceRegistry; -import ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; @@ -22,6 +20,8 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.opencds.cqf.fhir.cr.hapi.config.CrCdsConfig; +import org.opencds.cqf.fhir.cr.hapi.config.RepositoryConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; @@ -39,7 +39,7 @@ import static org.junit.jupiter.api.Assertions.fail; Application.class, NicknameServiceConfig.class, RepositoryConfig.class, - CdsHooksConfig.class, + CrCdsConfig.class, StarterCdsHooksConfig.class }, properties = { "spring.profiles.include=storageSettingsTest", diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java index 32fabbc..7dfb1ed 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.jpa.starter; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.cr.config.RepositoryConfig; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.api.CacheControlDirective; @@ -19,6 +18,7 @@ import org.hl7.fhir.instance.model.api.IIdType; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.opencds.cqf.fhir.cr.hapi.config.RepositoryConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java index d8044d8..3a15b96 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.jpa.starter; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.cr.config.RepositoryConfig; import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig; import ca.uhn.fhir.jpa.starter.cr.CrProperties; import ca.uhn.fhir.model.primitive.IdDt; @@ -35,6 +34,7 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import org.opencds.cqf.fhir.cr.hapi.config.RepositoryConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; From 49f47db115ceedd199756b9ac043a1203a558869 Mon Sep 17 00:00:00 2001 From: Luke deGruchy Date: Fri, 7 Mar 2025 14:48:41 -0500 Subject: [PATCH 2/9] Try to fix injection errors. --- .../fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java | 7 ++++--- .../java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java index 2d3535a..77f234e 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java @@ -12,7 +12,7 @@ import org.opencds.cqf.fhir.cr.hapi.cdshooks.CdsCrSettings; import org.opencds.cqf.fhir.cr.hapi.cdshooks.ICdsCrServiceRegistry; import org.opencds.cqf.fhir.cr.hapi.cdshooks.discovery.CdsCrDiscoveryServiceRegistry; import org.opencds.cqf.fhir.cr.hapi.cdshooks.discovery.ICdsCrDiscoveryServiceRegistry; -import org.opencds.cqf.fhir.cr.hapi.config.CrCdsConfig; +import org.opencds.cqf.fhir.cr.hapi.config.CrCdsHooksConfig; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -22,8 +22,9 @@ import org.springframework.context.annotation.Import; @Configuration @Conditional({CdsHooksConfigCondition.class, CrConfigCondition.class}) -//@Import({CdsHooksConfig.class, CrCommonConfig.class}) -@Import({CrCdsConfig.class, CrCommonConfig.class}) +// LUKETODO: Config missing ICdsServiceRegistry +// LUKETODO: HAPI-1653: Provider not supported for the current FHIR version +@Import({CrCdsHooksConfig.class, CrCommonConfig.class}) public class StarterCdsHooksConfig { // @Bean diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java index 112a88e..8ce9ff9 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java @@ -20,7 +20,7 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.opencds.cqf.fhir.cr.hapi.config.CrCdsConfig; +import org.opencds.cqf.fhir.cr.hapi.config.CrCdsHooksConfig; import org.opencds.cqf.fhir.cr.hapi.config.RepositoryConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -39,7 +39,7 @@ import static org.junit.jupiter.api.Assertions.fail; Application.class, NicknameServiceConfig.class, RepositoryConfig.class, - CrCdsConfig.class, + CrCdsHooksConfig.class, StarterCdsHooksConfig.class }, properties = { "spring.profiles.include=storageSettingsTest", @@ -116,7 +116,7 @@ class CdsHooksServletIT implements IServerSupport { } @Test - void testCdsHooks() throws IOException, InterruptedException { + void testCdsHooks() throws IOException { loadBundle("r4/HelloWorld-Bundle.json", ourCtx, ourClient); await().atMost(10000, TimeUnit.MILLISECONDS).until(() -> hasCdsServices()); var cdsRequest = "{\n" + From f716f99ad5bac384533da293909e0ec6317b7454 Mon Sep 17 00:00:00 2001 From: Luke deGruchy Date: Fri, 7 Mar 2025 15:32:21 -0500 Subject: [PATCH 3/9] Add TestCdsHooksConfig. --- src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java index 8ce9ff9..9297cce 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.opencds.cqf.fhir.cr.hapi.config.CrCdsHooksConfig; import org.opencds.cqf.fhir.cr.hapi.config.RepositoryConfig; +import org.opencds.cqf.fhir.cr.hapi.config.test.TestCdsHooksConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; @@ -40,6 +41,7 @@ import static org.junit.jupiter.api.Assertions.fail; NicknameServiceConfig.class, RepositoryConfig.class, CrCdsHooksConfig.class, + TestCdsHooksConfig.class, StarterCdsHooksConfig.class }, properties = { "spring.profiles.include=storageSettingsTest", From bbb5ab0d37cd5bc6f0a2ede0cfdf10199822e4e2 Mon Sep 17 00:00:00 2001 From: Luke deGruchy Date: Fri, 7 Mar 2025 15:45:41 -0500 Subject: [PATCH 4/9] Add TestCdsHooksConfig. Remove commented out dependency. --- pom.xml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 9230b86..0279982 100644 --- a/pom.xml +++ b/pom.xml @@ -20,9 +20,7 @@ ca.uhn.hapi.fhir hapi-fhir - - - 8.1.1-LUKE-SNAPSHOT + 8.0.0 hapi-fhir-jpaserver-starter @@ -115,18 +113,11 @@ - - - org.opencds.cqf.fhir - cqf-fhir-cr-hapi - ${clinical-reasoning.version} - ca.uhn.hapi.fhir From f64f1beba692af04761297f9edd971a378961f72 Mon Sep 17 00:00:00 2001 From: Brenin Rhodes Date: Sun, 9 Mar 2025 13:24:28 -0600 Subject: [PATCH 5/9] fix config --- .../cdshooks/StarterCdsHooksConfig.java | 19 +++---------------- .../jpa/starter/cr/StarterCrDstu3Config.java | 2 +- .../jpa/starter/cr/StarterCrR4Config.java | 6 +++--- src/main/resources/application.yaml | 2 +- .../fhir/jpa/starter/CdsHooksServletIT.java | 2 +- 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java index 77f234e..845900b 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java @@ -13,6 +13,8 @@ import org.opencds.cqf.fhir.cr.hapi.cdshooks.ICdsCrServiceRegistry; import org.opencds.cqf.fhir.cr.hapi.cdshooks.discovery.CdsCrDiscoveryServiceRegistry; import org.opencds.cqf.fhir.cr.hapi.cdshooks.discovery.ICdsCrDiscoveryServiceRegistry; import org.opencds.cqf.fhir.cr.hapi.config.CrCdsHooksConfig; +import org.opencds.cqf.fhir.cr.hapi.config.RepositoryConfig; +import org.opencds.cqf.fhir.cr.hapi.config.test.TestCdsHooksConfig; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -22,24 +24,9 @@ import org.springframework.context.annotation.Import; @Configuration @Conditional({CdsHooksConfigCondition.class, CrConfigCondition.class}) -// LUKETODO: Config missing ICdsServiceRegistry -// LUKETODO: HAPI-1653: Provider not supported for the current FHIR version -@Import({CrCdsHooksConfig.class, CrCommonConfig.class}) +@Import({RepositoryConfig.class, TestCdsHooksConfig.class, CrCdsHooksConfig.class, CrCommonConfig.class}) public class StarterCdsHooksConfig { - // @Bean - // CdsPrefetchSvc cdsPrefetchSvc( - // CdsResolutionStrategySvc theCdsResolutionStrategySvc, - // CdsPrefetchDaoSvc theResourcePrefetchDao, - // CdsPrefetchFhirClientSvc theResourcePrefetchFhirClient, - // ICdsHooksDaoAuthorizationSvc theCdsHooksDaoAuthorizationSvc) { - // return new ModuleConfigurationPrefetchSvc( - // theCdsResolutionStrategySvc, - // theResourcePrefetchDao, - // theResourcePrefetchFhirClient, - // theCdsHooksDaoAuthorizationSvc); - // } - @Bean public ICdsCrDiscoveryServiceRegistry cdsCrDiscoveryServiceRegistry() { CdsCrDiscoveryServiceRegistry registry = new CdsCrDiscoveryServiceRegistry(); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java index b707ffc..c1e3b5a 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java @@ -5,7 +5,7 @@ import org.opencds.cqf.fhir.cr.hapi.config.dstu3.CrDstu3Config; import org.opencds.cqf.fhir.cr.hapi.config.dstu3.DataRequirementsOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.dstu3.EvaluateOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.dstu3.PackageOperationConfig; -import org.opencds.cqf.fhir.cr.hapi.config.r4.ApplyOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.dstu3.ApplyOperationConfig; import org.springframework.context.annotation.*; @Configuration diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java index d8ad4f1..80ffc4c 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java @@ -1,9 +1,9 @@ package ca.uhn.fhir.jpa.starter.cr; import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition; -import org.opencds.cqf.fhir.cr.hapi.config.dstu3.DataRequirementsOperationConfig; -import org.opencds.cqf.fhir.cr.hapi.config.dstu3.EvaluateOperationConfig; -import org.opencds.cqf.fhir.cr.hapi.config.dstu3.PackageOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.DataRequirementsOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.EvaluateOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.PackageOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.r4.ApplyOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.r4.CrR4Config; import org.opencds.cqf.fhir.cr.hapi.config.r4.ExtractOperationConfig; diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index a0756d6..30953c6 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -123,7 +123,7 @@ hapi: data: search_parameter_mode: USE_SEARCH_PARAMETERS # AUTO, USE_SEARCH_PARAMETERS, FILTER_IN_MEMORY terminology_parameter_mode: FILTER_IN_MEMORY # AUTO, USE_VALUE_SET_URL, USE_INLINE_CODES, FILTER_IN_MEMORY - profile_mode: DECLARED # ENFORCED, DECLARED, OPTIONAL, TRUST, OFF + profile_mode: OFF # ENFORCED, DECLARED, OPTIONAL, TRUST, OFF cdshooks: enabled: false diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java index 9297cce..2745ce0 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/CdsHooksServletIT.java @@ -40,8 +40,8 @@ import static org.junit.jupiter.api.Assertions.fail; Application.class, NicknameServiceConfig.class, RepositoryConfig.class, - CrCdsHooksConfig.class, TestCdsHooksConfig.class, + CrCdsHooksConfig.class, StarterCdsHooksConfig.class }, properties = { "spring.profiles.include=storageSettingsTest", From 9a2d3d31d738eb50edf69c098c6eb4ed8d37aa9d Mon Sep 17 00:00:00 2001 From: Brenin Rhodes Date: Sun, 9 Mar 2025 13:27:42 -0600 Subject: [PATCH 6/9] spotless --- .../ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java | 2 +- .../java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java index c1e3b5a..b418077 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrDstu3Config.java @@ -1,11 +1,11 @@ package ca.uhn.fhir.jpa.starter.cr; import ca.uhn.fhir.jpa.starter.annotations.OnDSTU3Condition; +import org.opencds.cqf.fhir.cr.hapi.config.dstu3.ApplyOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.dstu3.CrDstu3Config; import org.opencds.cqf.fhir.cr.hapi.config.dstu3.DataRequirementsOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.dstu3.EvaluateOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.dstu3.PackageOperationConfig; -import org.opencds.cqf.fhir.cr.hapi.config.dstu3.ApplyOperationConfig; import org.springframework.context.annotation.*; @Configuration diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java index 80ffc4c..69c0a36 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cr/StarterCrR4Config.java @@ -1,12 +1,12 @@ package ca.uhn.fhir.jpa.starter.cr; import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition; -import org.opencds.cqf.fhir.cr.hapi.config.r4.DataRequirementsOperationConfig; -import org.opencds.cqf.fhir.cr.hapi.config.r4.EvaluateOperationConfig; -import org.opencds.cqf.fhir.cr.hapi.config.r4.PackageOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.r4.ApplyOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.r4.CrR4Config; +import org.opencds.cqf.fhir.cr.hapi.config.r4.DataRequirementsOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.EvaluateOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.r4.ExtractOperationConfig; +import org.opencds.cqf.fhir.cr.hapi.config.r4.PackageOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.r4.PopulateOperationConfig; import org.opencds.cqf.fhir.cr.hapi.config.r4.QuestionnaireOperationConfig; import org.springframework.context.annotation.Conditional; From 40c3745ad2776e113d00b00bcb131d3871caad7d Mon Sep 17 00:00:00 2001 From: Brenin Rhodes Date: Thu, 13 Mar 2025 10:48:54 -0600 Subject: [PATCH 7/9] update to new service class --- .../fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java | 4 ++-- ...pdatedCdsCrServiceR4.java => UpdatedCdsCrService.java} | 8 ++++---- ...overyServiceR4.java => UpdatedCrDiscoveryService.java} | 6 +++--- src/main/resources/application.yaml | 2 +- src/main/resources/cds.application.yaml | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) rename src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/{UpdatedCdsCrServiceR4.java => UpdatedCdsCrService.java} (81%) rename src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/{UpdatedCrDiscoveryServiceR4.java => UpdatedCrDiscoveryService.java} (60%) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java index 845900b..5da4dae 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/StarterCdsHooksConfig.java @@ -31,7 +31,7 @@ public class StarterCdsHooksConfig { public ICdsCrDiscoveryServiceRegistry cdsCrDiscoveryServiceRegistry() { CdsCrDiscoveryServiceRegistry registry = new CdsCrDiscoveryServiceRegistry(); registry.unregister(FhirVersionEnum.R4); - registry.register(FhirVersionEnum.R4, UpdatedCrDiscoveryServiceR4.class); + registry.register(FhirVersionEnum.R4, UpdatedCrDiscoveryService.class); return registry; } @@ -39,7 +39,7 @@ public class StarterCdsHooksConfig { public ICdsCrServiceRegistry cdsCrServiceRegistry() { CdsCrServiceRegistry registry = new CdsCrServiceRegistry(); registry.unregister(FhirVersionEnum.R4); - registry.register(FhirVersionEnum.R4, UpdatedCdsCrServiceR4.class); + registry.register(FhirVersionEnum.R4, UpdatedCdsCrService.class); return registry; } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrServiceR4.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrService.java similarity index 81% rename from src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrServiceR4.java rename to src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrService.java index e821ce9..e81fcfb 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrServiceR4.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrService.java @@ -6,20 +6,20 @@ import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService; import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.Parameters; import org.opencds.cqf.fhir.api.Repository; -import org.opencds.cqf.fhir.cr.hapi.cdshooks.CdsCrServiceR4; +import org.opencds.cqf.fhir.cr.hapi.cdshooks.CdsCrService; import static org.opencds.cqf.fhir.utility.Constants.APPLY_PARAMETER_DATA; import static org.opencds.cqf.fhir.utility.r4.Parameters.part; -public class UpdatedCdsCrServiceR4 extends CdsCrServiceR4 { - public UpdatedCdsCrServiceR4( +public class UpdatedCdsCrService extends CdsCrService { + public UpdatedCdsCrService( RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) { super(theRequestDetails, theRepository, theCdsConfigService); } @Override public Parameters encodeParams(CdsServiceRequestJson theJson) { - Parameters parameters = super.encodeParams(theJson); + var parameters = (Parameters) super.encodeParams(theJson); if (parameters.hasParameter(APPLY_PARAMETER_DATA)) { parameters.addParameter(part("useServerData", new BooleanType(false))); } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryServiceR4.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryService.java similarity index 60% rename from src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryServiceR4.java rename to src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryService.java index 50676fa..f01873e 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryServiceR4.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCrDiscoveryService.java @@ -2,10 +2,10 @@ package ca.uhn.fhir.jpa.starter.cdshooks; import org.hl7.fhir.instance.model.api.IIdType; import org.opencds.cqf.fhir.api.Repository; -import org.opencds.cqf.fhir.cr.hapi.cdshooks.discovery.CrDiscoveryServiceR4; +import org.opencds.cqf.fhir.cr.hapi.cdshooks.discovery.CrDiscoveryService; -public class UpdatedCrDiscoveryServiceR4 extends CrDiscoveryServiceR4 { - public UpdatedCrDiscoveryServiceR4(IIdType thePlanDefinitionId, Repository theRepository) { +public class UpdatedCrDiscoveryService extends CrDiscoveryService { + public UpdatedCrDiscoveryService(IIdType thePlanDefinitionId, Repository theRepository) { super(thePlanDefinitionId, theRepository); maxUriLength = 6000; } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 30953c6..a0756d6 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -123,7 +123,7 @@ hapi: data: search_parameter_mode: USE_SEARCH_PARAMETERS # AUTO, USE_SEARCH_PARAMETERS, FILTER_IN_MEMORY terminology_parameter_mode: FILTER_IN_MEMORY # AUTO, USE_VALUE_SET_URL, USE_INLINE_CODES, FILTER_IN_MEMORY - profile_mode: OFF # ENFORCED, DECLARED, OPTIONAL, TRUST, OFF + profile_mode: DECLARED # ENFORCED, DECLARED, OPTIONAL, TRUST, OFF cdshooks: enabled: false diff --git a/src/main/resources/cds.application.yaml b/src/main/resources/cds.application.yaml index caa1e4b..8a734ae 100644 --- a/src/main/resources/cds.application.yaml +++ b/src/main/resources/cds.application.yaml @@ -124,7 +124,7 @@ hapi: data: search_parameter_mode: USE_SEARCH_PARAMETERS # AUTO, USE_SEARCH_PARAMETERS, FILTER_IN_MEMORY terminology_parameter_mode: FILTER_IN_MEMORY # AUTO, USE_VALUE_SET_URL, USE_INLINE_CODES, FILTER_IN_MEMORY - profile_mode: OFF # ENFORCED, DECLARED, OPTIONAL, TRUST, OFF + profile_mode: DECLARED # ENFORCED, DECLARED, OPTIONAL, TRUST, OFF cdshooks: enabled: true From c9452bcfd6e50320b3f2ccd81eb41093e865954f Mon Sep 17 00:00:00 2001 From: Brenin Rhodes Date: Fri, 4 Apr 2025 09:46:12 -0600 Subject: [PATCH 8/9] update to release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0279982..1ffbf93 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 17 1 - 3.19.0-SNAPSHOT + 3.19.0 From 5ba6ab133e6a2f6d852982dca8d1170801387b50 Mon Sep 17 00:00:00 2001 From: Brenin Rhodes Date: Fri, 4 Apr 2025 11:22:02 -0600 Subject: [PATCH 9/9] Remove use of version specific model --- .../starter/cdshooks/UpdatedCdsCrService.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrService.java b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrService.java index e81fcfb..414993c 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrService.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/cdshooks/UpdatedCdsCrService.java @@ -1,28 +1,44 @@ package ca.uhn.fhir.jpa.starter.cdshooks; +import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.cdshooks.CdsServiceRequestJson; import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService; -import org.hl7.fhir.r4.model.BooleanType; -import org.hl7.fhir.r4.model.Parameters; +import org.hl7.fhir.instance.model.api.IBaseParameters; +import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.opencds.cqf.fhir.api.Repository; import org.opencds.cqf.fhir.cr.hapi.cdshooks.CdsCrService; +import org.opencds.cqf.fhir.utility.adapter.IAdapterFactory; import static org.opencds.cqf.fhir.utility.Constants.APPLY_PARAMETER_DATA; -import static org.opencds.cqf.fhir.utility.r4.Parameters.part; public class UpdatedCdsCrService extends CdsCrService { + private final IAdapterFactory adapterFactory; + public UpdatedCdsCrService( RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) { super(theRequestDetails, theRepository, theCdsConfigService); + adapterFactory = IAdapterFactory.forFhirContext(theRepository.fhirContext()); } @Override - public Parameters encodeParams(CdsServiceRequestJson theJson) { - var parameters = (Parameters) super.encodeParams(theJson); + public IBaseParameters encodeParams(CdsServiceRequestJson theJson) { + var parameters = adapterFactory.createParameters(super.encodeParams(theJson)); if (parameters.hasParameter(APPLY_PARAMETER_DATA)) { - parameters.addParameter(part("useServerData", new BooleanType(false))); + parameters.addParameter( + "useServerData", + booleanTypeForVersion(parameters.fhirContext().getVersion().getVersion(), false)); } - return parameters; + return (IBaseParameters) parameters.get(); + } + + private IPrimitiveType booleanTypeForVersion(FhirVersionEnum fhirVersion, boolean value) { + return switch (fhirVersion) { + case DSTU2 -> new org.hl7.fhir.dstu2.model.BooleanType(value); + case DSTU3 -> new org.hl7.fhir.dstu3.model.BooleanType(value); + case R4 -> new org.hl7.fhir.r4.model.BooleanType(value); + case R5 -> new org.hl7.fhir.r5.model.BooleanType(value); + default -> throw new IllegalArgumentException("unknown or unsupported FHIR version"); + }; } }