Br 20231019 add cr settings for cds hooks (#5394)
* Add settings used in CR CDS Services. Remove config dependency on Spring Boot. * Add changelog * Use String.format rather than concat strings * spotless apply * Add javadoc
This commit is contained in:
parent
a40adab882
commit
69780a3445
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
type: add
|
||||
issue: 5375
|
||||
title: "Add settings for CDS Services using CDS on FHIR. Also removed the dependency on Spring Boot from the CR configs used by CDS Hooks."
|
|
@ -26,6 +26,7 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
|
|||
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.SystemRestfulResponse;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrSettings;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.opencds.cqf.fhir.utility.Ids;
|
||||
|
||||
|
@ -39,6 +40,9 @@ public interface ICdsConfigService {
|
|||
@Nonnull
|
||||
ObjectMapper getObjectMapper();
|
||||
|
||||
@Nonnull
|
||||
CdsCrSettings getCdsCrSettings();
|
||||
|
||||
@Nullable
|
||||
default DaoRegistry getDaoRegistry() {
|
||||
return null;
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - CDS Hooks
|
||||
* %%
|
||||
* 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.hapi.fhir.cdshooks.config;
|
||||
|
||||
import ca.uhn.fhir.cr.config.CrConfigCondition;
|
||||
import ca.uhn.fhir.cr.config.RepositoryConfig;
|
||||
import ca.uhn.fhir.cr.config.r4.ApplyOperationConfig;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* This class exists as a wrapper for the CR configs required for CDS on FHIR to be loaded only when dependencies are met.
|
||||
* Adding the condition to the configs themselves causes issues with downstream projects.
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@Conditional(CrConfigCondition.class)
|
||||
@Import({RepositoryConfig.class, ApplyOperationConfig.class})
|
||||
public class CdsCrConfig {}
|
|
@ -35,6 +35,7 @@ import ca.uhn.hapi.fhir.cdshooks.svc.CdsConfigServiceImpl;
|
|||
import ca.uhn.hapi.fhir.cdshooks.svc.CdsHooksContextBooter;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.CdsServiceRegistryImpl;
|
||||
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.CdsServiceInterceptor;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.ICdsCrService;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.ICdsCrServiceFactory;
|
||||
|
@ -56,12 +57,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Optional;
|
||||
|
||||
@Configuration
|
||||
@Import(CdsCrConfig.class)
|
||||
public class CdsHooksConfig {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(CdsHooksConfig.class);
|
||||
|
||||
|
@ -128,8 +131,8 @@ public class CdsHooksConfig {
|
|||
}
|
||||
try {
|
||||
Constructor<? extends ICdsCrService> constructor =
|
||||
clazz.get().getConstructor(RequestDetails.class, Repository.class);
|
||||
return constructor.newInstance(rd, repository);
|
||||
clazz.get().getConstructor(RequestDetails.class, Repository.class, ICdsConfigService.class);
|
||||
return constructor.newInstance(rd, repository, theCdsConfigService);
|
||||
} catch (NoSuchMethodException
|
||||
| InvocationTargetException
|
||||
| InstantiationException
|
||||
|
@ -189,9 +192,11 @@ public class CdsHooksConfig {
|
|||
|
||||
@Bean
|
||||
public ICdsConfigService cdsConfigService(
|
||||
FhirContext theFhirContext, @Qualifier(CDS_HOOKS_OBJECT_MAPPER_FACTORY) ObjectMapper theObjectMapper) {
|
||||
FhirContext theFhirContext,
|
||||
@Qualifier(CDS_HOOKS_OBJECT_MAPPER_FACTORY) ObjectMapper theObjectMapper,
|
||||
CdsCrSettings theCdsCrSettings) {
|
||||
return new CdsConfigServiceImpl(
|
||||
theFhirContext, theObjectMapper, myDaoRegistry, myRepositoryFactory, myRestfulServer);
|
||||
theFhirContext, theObjectMapper, theCdsCrSettings, myDaoRegistry, myRepositoryFactory, myRestfulServer);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -24,6 +24,7 @@ import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
|||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrSettings;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
@ -32,6 +33,7 @@ import javax.annotation.Nullable;
|
|||
public class CdsConfigServiceImpl implements ICdsConfigService {
|
||||
private final FhirContext myFhirContext;
|
||||
private final ObjectMapper myObjectMapper;
|
||||
private final CdsCrSettings myCdsCrSettings;
|
||||
private final DaoRegistry myDaoRegistry;
|
||||
private final IRepositoryFactory myRepositoryFactory;
|
||||
private final RestfulServer myRestfulServer;
|
||||
|
@ -39,11 +41,13 @@ public class CdsConfigServiceImpl implements ICdsConfigService {
|
|||
public CdsConfigServiceImpl(
|
||||
@Nonnull FhirContext theFhirContext,
|
||||
@Nonnull ObjectMapper theObjectMapper,
|
||||
@Nonnull CdsCrSettings theCdsCrSettings,
|
||||
@Nullable DaoRegistry theDaoRegistry,
|
||||
@Nullable IRepositoryFactory theRepositoryFactory,
|
||||
@Nullable RestfulServer theRestfulServer) {
|
||||
myFhirContext = theFhirContext;
|
||||
myObjectMapper = theObjectMapper;
|
||||
myCdsCrSettings = theCdsCrSettings;
|
||||
myDaoRegistry = theDaoRegistry;
|
||||
myRepositoryFactory = theRepositoryFactory;
|
||||
myRestfulServer = theRestfulServer;
|
||||
|
@ -61,6 +65,12 @@ public class CdsConfigServiceImpl implements ICdsConfigService {
|
|||
return myObjectMapper;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public CdsCrSettings getCdsCrSettings() {
|
||||
return myCdsCrSettings;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DaoRegistry getDaoRegistry() {
|
||||
|
|
|
@ -21,7 +21,16 @@ package ca.uhn.hapi.fhir.cdshooks.svc.cr;
|
|||
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.*;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceRequestAuthorizationJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceRequestJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseCardJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseCardSourceJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseLinkJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseSuggestionActionJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseSuggestionJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseSystemActionJson;
|
||||
import org.hl7.fhir.dstu3.model.Bundle;
|
||||
import org.hl7.fhir.dstu3.model.CarePlan;
|
||||
import org.hl7.fhir.dstu3.model.Endpoint;
|
||||
|
@ -60,10 +69,13 @@ import static org.opencds.cqf.fhir.utility.dstu3.Parameters.part;
|
|||
public class CdsCrServiceDstu3 implements ICdsCrService {
|
||||
protected final RequestDetails myRequestDetails;
|
||||
protected final Repository myRepository;
|
||||
protected final ICdsConfigService myCdsConfigService;
|
||||
protected CarePlan myResponse;
|
||||
protected CdsServiceResponseJson myServiceResponse;
|
||||
|
||||
public CdsCrServiceDstu3(RequestDetails theRequestDetails, Repository theRepository) {
|
||||
public CdsCrServiceDstu3(
|
||||
RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) {
|
||||
myCdsConfigService = theCdsConfigService;
|
||||
myRequestDetails = theRequestDetails;
|
||||
myRepository = theRepository;
|
||||
}
|
||||
|
@ -108,6 +120,12 @@ public class CdsCrServiceDstu3 implements ICdsCrService {
|
|||
endpoint.addHeader(String.format(
|
||||
"Authorization: %s %s",
|
||||
tokenType, theJson.getServiceRequestAuthorizationJson().getAccessToken()));
|
||||
if (theJson.getServiceRequestAuthorizationJson().getSubject() != null) {
|
||||
endpoint.addHeader(String.format(
|
||||
"%s: %s",
|
||||
myCdsConfigService.getCdsCrSettings().getClientIdHeaderName(),
|
||||
theJson.getServiceRequestAuthorizationJson().getSubject()));
|
||||
}
|
||||
}
|
||||
parameters.addParameter(part(APPLY_PARAMETER_DATA_ENDPOINT, endpoint));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,17 @@ package ca.uhn.hapi.fhir.cdshooks.svc.cr;
|
|||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.*;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceIndicatorEnum;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceRequestAuthorizationJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceRequestJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseCardJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseCardSourceJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseLinkJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseSuggestionActionJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseSuggestionJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseSystemActionJson;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.hl7.fhir.r4.model.CanonicalType;
|
||||
|
@ -61,10 +71,13 @@ import static org.opencds.cqf.fhir.utility.r4.Parameters.part;
|
|||
public class CdsCrServiceR4 implements ICdsCrService {
|
||||
protected final RequestDetails myRequestDetails;
|
||||
protected final Repository myRepository;
|
||||
protected final ICdsConfigService myCdsConfigService;
|
||||
protected Bundle myResponseBundle;
|
||||
protected CdsServiceResponseJson myServiceResponse;
|
||||
|
||||
public CdsCrServiceR4(RequestDetails theRequestDetails, Repository theRepository) {
|
||||
public CdsCrServiceR4(
|
||||
RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) {
|
||||
myCdsConfigService = theCdsConfigService;
|
||||
myRequestDetails = theRequestDetails;
|
||||
myRepository = theRepository;
|
||||
}
|
||||
|
@ -109,8 +122,13 @@ public class CdsCrServiceR4 implements ICdsCrService {
|
|||
endpoint.addHeader(String.format(
|
||||
"Authorization: %s %s",
|
||||
tokenType, theJson.getServiceRequestAuthorizationJson().getAccessToken()));
|
||||
if (theJson.getServiceRequestAuthorizationJson().getSubject() != null) {
|
||||
endpoint.addHeader(String.format(
|
||||
"%s: %s",
|
||||
myCdsConfigService.getCdsCrSettings().getClientIdHeaderName(),
|
||||
theJson.getServiceRequestAuthorizationJson().getSubject()));
|
||||
}
|
||||
}
|
||||
endpoint.addHeader("Epic-Client-ID: 2cb5af9f-f483-4e2a-aedc-54c3a31cb153");
|
||||
parameters.addParameter(part(APPLY_PARAMETER_DATA_ENDPOINT, endpoint));
|
||||
}
|
||||
return parameters;
|
||||
|
|
|
@ -22,7 +22,17 @@ package ca.uhn.hapi.fhir.cdshooks.svc.cr;
|
|||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.*;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceIndicatorEnum;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceRequestAuthorizationJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceRequestJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseCardJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseCardSourceJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseLinkJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseSuggestionActionJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseSuggestionJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseSystemActionJson;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r5.model.Bundle;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
|
@ -61,10 +71,13 @@ import static org.opencds.cqf.fhir.utility.r5.Parameters.part;
|
|||
public class CdsCrServiceR5 implements ICdsCrService {
|
||||
protected final RequestDetails myRequestDetails;
|
||||
protected final Repository myRepository;
|
||||
protected final ICdsConfigService myCdsConfigService;
|
||||
protected Bundle myResponseBundle;
|
||||
protected CdsServiceResponseJson myServiceResponse;
|
||||
|
||||
public CdsCrServiceR5(RequestDetails theRequestDetails, Repository theRepository) {
|
||||
public CdsCrServiceR5(
|
||||
RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) {
|
||||
myCdsConfigService = theCdsConfigService;
|
||||
myRequestDetails = theRequestDetails;
|
||||
myRepository = theRepository;
|
||||
}
|
||||
|
@ -109,6 +122,12 @@ public class CdsCrServiceR5 implements ICdsCrService {
|
|||
endpoint.addHeader(String.format(
|
||||
"Authorization: %s %s",
|
||||
tokenType, theJson.getServiceRequestAuthorizationJson().getAccessToken()));
|
||||
if (theJson.getServiceRequestAuthorizationJson().getSubject() != null) {
|
||||
endpoint.addHeader(String.format(
|
||||
"%s: %s",
|
||||
myCdsConfigService.getCdsCrSettings().getClientIdHeaderName(),
|
||||
theJson.getServiceRequestAuthorizationJson().getSubject()));
|
||||
}
|
||||
}
|
||||
parameters.addParameter(part(APPLY_PARAMETER_DATA_ENDPOINT, endpoint));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR - CDS Hooks
|
||||
* %%
|
||||
* 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.hapi.fhir.cdshooks.svc.cr;
|
||||
|
||||
public class CdsCrSettings {
|
||||
private final String DEFAULT_CLIENT_ID_HEADER_NAME = "client_id";
|
||||
private String myClientIdHeaderName;
|
||||
|
||||
public static CdsCrSettings getDefault() {
|
||||
CdsCrSettings settings = new CdsCrSettings();
|
||||
settings.setClientIdHeaderName(settings.DEFAULT_CLIENT_ID_HEADER_NAME);
|
||||
return settings;
|
||||
}
|
||||
|
||||
public void setClientIdHeaderName(String theName) {
|
||||
myClientIdHeaderName = theName;
|
||||
}
|
||||
|
||||
public String getClientIdHeaderName() {
|
||||
return myClientIdHeaderName;
|
||||
}
|
||||
|
||||
public CdsCrSettings withClientIdHeaderName(String theName) {
|
||||
myClientIdHeaderName = theName;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
|||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsHooksDaoAuthorizationSvc;
|
||||
import ca.uhn.hapi.fhir.cdshooks.controller.TestServerAppCtx;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.CdsHooksContextBooter;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrSettings;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -16,6 +17,9 @@ public class TestCdsHooksConfig {
|
|||
return FhirContext.forR4Cached();
|
||||
}
|
||||
|
||||
@Bean
|
||||
CdsCrSettings cdsCrSettings() { return CdsCrSettings.getDefault(); }
|
||||
|
||||
@Bean
|
||||
public CdsHooksContextBooter cdsHooksContextBooter() {
|
||||
CdsHooksContextBooter retVal = new CdsHooksContextBooter();
|
||||
|
|
|
@ -14,4 +14,6 @@ public abstract class BaseCrTest {
|
|||
|
||||
@Autowired
|
||||
protected FhirContext myFhirContext;
|
||||
@Autowired
|
||||
protected CdsCrSettings myCdsCrSettings;
|
||||
}
|
||||
|
|
|
@ -2,13 +2,37 @@ package ca.uhn.hapi.fhir.cdshooks.svc.cr;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
||||
import ca.uhn.hapi.fhir.cdshooks.module.CdsHooksObjectMapperFactory;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.CdsConfigServiceImpl;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import static ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig.CDS_HOOKS_OBJECT_MAPPER_FACTORY;
|
||||
|
||||
@Configuration
|
||||
public class TestCrConfig {
|
||||
@Bean
|
||||
FhirContext fhirContext() {
|
||||
return FhirContext.forR4Cached();
|
||||
}
|
||||
|
||||
@Bean(name = CDS_HOOKS_OBJECT_MAPPER_FACTORY)
|
||||
public ObjectMapper objectMapper(FhirContext theFhirContext) {
|
||||
return new CdsHooksObjectMapperFactory(theFhirContext).newMapper();
|
||||
}
|
||||
|
||||
@Bean
|
||||
CdsCrSettings cdsCrSettings() { return CdsCrSettings.getDefault(); }
|
||||
|
||||
@Bean
|
||||
public ICdsConfigService cdsConfigService(
|
||||
FhirContext theFhirContext,
|
||||
@Qualifier(CDS_HOOKS_OBJECT_MAPPER_FACTORY) ObjectMapper theObjectMapper,
|
||||
CdsCrSettings theCdsCrSettings) {
|
||||
return new CdsConfigServiceImpl(
|
||||
theFhirContext, theObjectMapper, theCdsCrSettings, null, null, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package ca.uhn.hapi.fhir.cdshooks.svc.cr.resolution;
|
|||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
|
||||
import ca.uhn.fhir.util.ClasspathUtil;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceRequestJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.module.CdsHooksObjectMapperFactory;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.CdsConfigServiceImpl;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.BaseCrTest;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrServiceR4;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
@ -25,9 +27,13 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class CdsCrServiceR4Test extends BaseCrTest {
|
||||
private ObjectMapper myObjectMapper;@BeforeEach
|
||||
private ObjectMapper myObjectMapper;
|
||||
private ICdsConfigService myCdsConfigService;
|
||||
|
||||
@BeforeEach
|
||||
public void loadJson() throws IOException {
|
||||
myObjectMapper = new CdsHooksObjectMapperFactory(myFhirContext).newMapper();
|
||||
myCdsConfigService = new CdsConfigServiceImpl(myFhirContext, myObjectMapper, myCdsCrSettings, null, null, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -39,7 +45,7 @@ public class CdsCrServiceR4Test extends BaseCrTest {
|
|||
final RequestDetails requestDetails = new SystemRequestDetails();
|
||||
final IdType planDefinitionId = new IdType(PLAN_DEFINITION_RESOURCE_NAME, "ASLPCrd");
|
||||
requestDetails.setId(planDefinitionId);
|
||||
final Parameters params = new CdsCrServiceR4(requestDetails, repository).encodeParams(cdsServiceRequestJson);
|
||||
final Parameters params = new CdsCrServiceR4(requestDetails, repository, myCdsConfigService).encodeParams(cdsServiceRequestJson);
|
||||
|
||||
assertTrue(params.getParameter().size() == 3);
|
||||
assertTrue(params.getParameter("parameters").hasResource());
|
||||
|
@ -53,7 +59,7 @@ public class CdsCrServiceR4Test extends BaseCrTest {
|
|||
final RequestDetails requestDetails = new SystemRequestDetails();
|
||||
final IdType planDefinitionId = new IdType(PLAN_DEFINITION_RESOURCE_NAME, "ASLPCrd");
|
||||
requestDetails.setId(planDefinitionId);
|
||||
final CdsServiceResponseJson cdsServiceResponseJson = new CdsCrServiceR4(requestDetails, repository).encodeResponse(responseBundle);
|
||||
final CdsServiceResponseJson cdsServiceResponseJson = new CdsCrServiceR4(requestDetails, repository, myCdsConfigService).encodeResponse(responseBundle);
|
||||
|
||||
assertTrue(cdsServiceResponseJson.getCards().size() == 1);
|
||||
assertTrue(!cdsServiceResponseJson.getCards().get(0).getSummary().isEmpty());
|
||||
|
@ -69,7 +75,7 @@ public class CdsCrServiceR4Test extends BaseCrTest {
|
|||
final RequestDetails requestDetails = new SystemRequestDetails();
|
||||
final IdType planDefinitionId = new IdType(PLAN_DEFINITION_RESOURCE_NAME, "DischargeInstructionsPlan");
|
||||
requestDetails.setId(planDefinitionId);
|
||||
final CdsServiceResponseJson cdsServiceResponseJson = new CdsCrServiceR4(requestDetails, repository).encodeResponse(responseBundle);
|
||||
final CdsServiceResponseJson cdsServiceResponseJson = new CdsCrServiceR4(requestDetails, repository, myCdsConfigService).encodeResponse(responseBundle);
|
||||
|
||||
assertTrue(cdsServiceResponseJson.getServiceActions().size() == 1);
|
||||
assertTrue(cdsServiceResponseJson.getServiceActions().get(0).getType().equals(ActionType.CREATE.toCode()));
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
"hook" : "order-sign",
|
||||
"hookInstance": "randomGUIDforthehookevent",
|
||||
"fhirServer" : "https://localhost:8000",
|
||||
"fhirAuthorization": {
|
||||
"access_token": "sometoken",
|
||||
"token_type": "Bearer",
|
||||
"expires_in": 300000,
|
||||
"scope": "",
|
||||
"subject": "clientIdHeaderTest"
|
||||
},
|
||||
"context" : {
|
||||
"patientId" : "Patient/123",
|
||||
"draftOrders" : {
|
||||
|
|
|
@ -139,12 +139,6 @@
|
|||
<version>${spring-security-core.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||
<version>${spring_boot_version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This is needed for the CqlExceptionHandlingInterceptor -->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/*-
|
||||
* #%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.config;
|
||||
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
||||
/**
|
||||
* The purpose of this Condition is to verify that the CR dependent beans RestfulServer and EvaluationSettings exist.
|
||||
*/
|
||||
public class CrConfigCondition implements Condition {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(CrConfigCondition.class);
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext theConditionContext, AnnotatedTypeMetadata theAnnotatedTypeMetadata) {
|
||||
ConfigurableListableBeanFactory beanFactory = theConditionContext.getBeanFactory();
|
||||
try {
|
||||
RestfulServer bean = beanFactory.getBean(RestfulServer.class);
|
||||
if (bean == null) {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ourLog.warn("CrConfigCondition not met: Missing RestfulServer bean");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
EvaluationSettings bean = beanFactory.getBean(EvaluationSettings.class);
|
||||
if (bean == null) {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ourLog.warn("CrConfigCondition not met: Missing EvaluationSettings bean");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -23,12 +23,10 @@ import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
|||
import ca.uhn.fhir.cr.repo.HapiFhirRepository;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean(RestfulServer.class)
|
||||
public class RepositoryConfig {
|
||||
@Bean
|
||||
IRepositoryFactory repositoryFactory(DaoRegistry theDaoRegistry, RestfulServer theRestfulServer) {
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*-
|
||||
* #%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.config;
|
||||
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
|
||||
public class RepositoryConfigCondition implements Condition {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(RepositoryConfigCondition.class);
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext theConditionContext, AnnotatedTypeMetadata theAnnotatedTypeMetadata) {
|
||||
ConfigurableListableBeanFactory beanFactory = theConditionContext.getBeanFactory();
|
||||
try {
|
||||
RestfulServer bean = beanFactory.getBean(RestfulServer.class);
|
||||
if (bean == null) {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ourLog.warn("Unable to create bean IRepositoryFactory: Missing RestfulServer");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -21,36 +21,20 @@ package ca.uhn.fhir.cr.config.dstu3;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean({IRepositoryFactory.class, RestfulServer.class, EvaluationSettings.class})
|
||||
@Import(CrProcessorConfig.class)
|
||||
public class ApplyOperationConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IActivityDefinitionProcessorFactory dstu3ActivityDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.activitydefinition.dstu3.ActivityDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IPlanDefinitionProcessorFactory dstu3PlanDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.dstu3.PlanDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.activitydefinition.ActivityDefinitionApplyProvider dstu3ActivityDefinitionApplyProvider() {
|
||||
return new ca.uhn.fhir.cr.dstu3.activitydefinition.ActivityDefinitionApplyProvider();
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*-
|
||||
* #%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.config.dstu3;
|
||||
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class CrProcessorConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IActivityDefinitionProcessorFactory dstu3ActivityDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.activitydefinition.dstu3.ActivityDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IPlanDefinitionProcessorFactory dstu3PlanDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.dstu3.PlanDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IQuestionnaireProcessorFactory dstu3QuestionnaireProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.dstu3.QuestionnaireProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IQuestionnaireResponseProcessorFactory dstu3QuestionnaireResponseProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaireresponse.dstu3.QuestionnaireResponseProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
}
|
|
@ -21,29 +21,20 @@ package ca.uhn.fhir.cr.config.dstu3;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean({IRepositoryFactory.class, RestfulServer.class, EvaluationSettings.class})
|
||||
@Import(CrProcessorConfig.class)
|
||||
public class ExtractOperationConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IQuestionnaireResponseProcessorFactory dstu3QuestionnaireResponseProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaireresponse.dstu3.QuestionnaireResponseProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.questionnaireresponse.QuestionnaireResponseExtractProvider
|
||||
dstu3QuestionnaireResponseExtractProvider() {
|
||||
|
|
|
@ -21,41 +21,25 @@ package ca.uhn.fhir.cr.config.dstu3;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean({IRepositoryFactory.class, RestfulServer.class, EvaluationSettings.class})
|
||||
@Import(CrProcessorConfig.class)
|
||||
public class PackageOperationConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IPlanDefinitionProcessorFactory dstu3PlanDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.dstu3.PlanDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.plandefinition.PlanDefinitionPackageProvider dstu3PlanDefinitionPackageProvider() {
|
||||
return new ca.uhn.fhir.cr.dstu3.plandefinition.PlanDefinitionPackageProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IQuestionnaireProcessorFactory dstu3QuestionnaireProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.dstu3.QuestionnaireProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePackageProvider dstu3QuestionnairePackageProvider() {
|
||||
return new ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePackageProvider();
|
||||
|
|
|
@ -21,29 +21,20 @@ package ca.uhn.fhir.cr.config.dstu3;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean({IRepositoryFactory.class, RestfulServer.class, EvaluationSettings.class})
|
||||
@Import(CrProcessorConfig.class)
|
||||
public class PopulateOperationConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.IQuestionnaireProcessorFactory dstu3QuestionnaireProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.dstu3.QuestionnaireProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePopulateProvider dstu3QuestionnairePopulateProvider() {
|
||||
return new ca.uhn.fhir.cr.dstu3.questionnaire.QuestionnairePopulateProvider();
|
||||
|
|
|
@ -21,36 +21,20 @@ package ca.uhn.fhir.cr.config.r4;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean({IRepositoryFactory.class, RestfulServer.class, EvaluationSettings.class})
|
||||
@Import(CrProcessorConfig.class)
|
||||
public class ApplyOperationConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IActivityDefinitionProcessorFactory r4ActivityDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.activitydefinition.r4.ActivityDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IPlanDefinitionProcessorFactory r4PlanDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.r4.PlanDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.activitydefinition.ActivityDefinitionApplyProvider r4ActivityDefinitionApplyProvider() {
|
||||
return new ca.uhn.fhir.cr.r4.activitydefinition.ActivityDefinitionApplyProvider();
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*-
|
||||
* #%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.config.r4;
|
||||
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class CrProcessorConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IActivityDefinitionProcessorFactory r4ActivityDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.activitydefinition.r4.ActivityDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IPlanDefinitionProcessorFactory r4PlanDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.r4.PlanDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IQuestionnaireProcessorFactory r4QuestionnaireProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.r4.QuestionnaireProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IQuestionnaireResponseProcessorFactory r4QuestionnaireResponseProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaireresponse.r4.QuestionnaireResponseProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
}
|
|
@ -21,29 +21,20 @@ package ca.uhn.fhir.cr.config.r4;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean({IRepositoryFactory.class, RestfulServer.class, EvaluationSettings.class})
|
||||
@Import(CrProcessorConfig.class)
|
||||
public class ExtractOperationConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IQuestionnaireResponseProcessorFactory r4QuestionnaireResponseProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaireresponse.r4.QuestionnaireResponseProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.questionnaireresponse.QuestionnaireResponseExtractProvider
|
||||
r4QuestionnaireResponseExtractProvider() {
|
||||
|
|
|
@ -21,41 +21,25 @@ package ca.uhn.fhir.cr.config.r4;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean({IRepositoryFactory.class, RestfulServer.class, EvaluationSettings.class})
|
||||
@Import(CrProcessorConfig.class)
|
||||
public class PackageOperationConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IPlanDefinitionProcessorFactory r4PlanDefinitionProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.plandefinition.r4.PlanDefinitionProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.plandefinition.PlanDefinitionPackageProvider r4PlanDefinitionPackageProvider() {
|
||||
return new ca.uhn.fhir.cr.r4.plandefinition.PlanDefinitionPackageProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IQuestionnaireProcessorFactory r4QuestionnaireProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.r4.QuestionnaireProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePackageProvider r4QuestionnairePackageProvider() {
|
||||
return new ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePackageProvider();
|
||||
|
|
|
@ -21,29 +21,20 @@ package ca.uhn.fhir.cr.config.r4;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean({IRepositoryFactory.class, RestfulServer.class, EvaluationSettings.class})
|
||||
@Import(CrProcessorConfig.class)
|
||||
public class PopulateOperationConfig {
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.IQuestionnaireProcessorFactory r4QuestionnaireProcessorFactory(
|
||||
IRepositoryFactory theRepositoryFactory, EvaluationSettings theEvaluationSettings) {
|
||||
return rd -> new org.opencds.cqf.fhir.cr.questionnaire.r4.QuestionnaireProcessor(
|
||||
theRepositoryFactory.create(rd), theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePopulateProvider r4QuestionnairePopulateProvider() {
|
||||
return new ca.uhn.fhir.cr.r4.questionnaire.QuestionnairePopulateProvider();
|
||||
|
|
Loading…
Reference in New Issue