Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Clinical Reasoning plugin #692

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ea58766
Reproducing issues with CR/HAPI cds-hooks processing
c-schuler Mar 4, 2024
b3aa943
Add new $questionnaire operation
barhodes Feb 12, 2024
1c58e4d
Update StarterIpsConfig.java
barhodes Feb 13, 2024
fc708df
Update pom.xml
barhodes Mar 4, 2024
2ff9983
Merge remote-tracking branch 'origin/cds-hooks-issue-repro' into br-2…
JPercival Mar 7, 2024
4ecc7ca
Fixes for configuration properties
JPercival Mar 12, 2024
a7bc396
Update VS Code launch properties
JPercival Mar 12, 2024
e43bfab
Merge remote-tracking branch 'origin/master' into br-cs-merged
JPercival Mar 12, 2024
6217261
Fixes for CQL logging
JPercival Mar 15, 2024
9d7a930
Update pom.xml
barhodes Mar 20, 2024
9c4fe1d
Remove unused threaded option
barhodes Mar 20, 2024
b3a68a6
Update to 7.1.7
barhodes Mar 28, 2024
4eedff7
Fix some CR defaults
JPercival Apr 3, 2024
1de364c
Update to new snapshot
JPercival Apr 11, 2024
c1f5046
Merge branch 'rel_7_1_tracking' into br-cs-merged
barhodes May 8, 2024
69e3ad6
Update pom.xml
barhodes May 8, 2024
da03ef9
Fix test settings
barhodes May 8, 2024
a0ad815
Do not make prefetch calls if all items are present
barhodes May 14, 2024
4a40970
Add alternative application.yaml for CDS settings.
barhodes May 15, 2024
69839e6
Add CdsHook tests and documentation
barhodes May 17, 2024
3badb7d
Merge branch 'master' into br-cs-merged
barhodes Jun 3, 2024
9953703
Comment out custom prefetch until it is more mature
barhodes Jun 3, 2024
efcea5c
Removal of DataEndpoint parameter is not longer needed
barhodes Jun 3, 2024
db48699
Fix debug logging setting being overwritten
barhodes Jun 7, 2024
c34f04d
Revert change
barhodes Jun 7, 2024
bf83fa1
Remove unused class
barhodes Jun 7, 2024
87ffa01
Adding Rec10 Test
c-schuler Jun 10, 2024
6a8a0cf
Disable test until fixed
barhodes Jun 11, 2024
e5bb1dd
fix tests
barhodes Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@
"cwd": "${workspaceFolder}",
"mainClass": "ca.uhn.fhir.jpa.starter.Application",
"projectName": "hapi-fhir-jpaserver-starter",
"args": "",
"vmArgs": [
"-XX:TieredStopAtLevel=1",
// "-Ddebug=true",
// "-Dloader.debug=true",
"-Dhapi.fhir.bulk_export_enabled=false",
"-Dspring.batch.job.enabled=false",
"-Dspring.main.allow-bean-definition-overriding=true",
"-Dhapi.fhir.cdshooks.enabled=true",
"-Dhapi.fhir.cr.enabled=true",
"-Dspring.main.allow-bean-definition-overriding=true"

],
"envFile": "${workspaceFolder}/.env"
}
]
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"**/.settings": true,
"**/.factorypath": true
},
"java.compile.nullAnalysis.mode": "disabled"
"java.compile.nullAnalysis.mode": "disabled",
"java.configuration.updateBuildConfiguration": "automatic"
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,11 @@ The server may be configured with subscription support by enabling properties in

## Enabling Clinical Reasoning

Set `hapi.fhir.cr_enabled=true` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file to enable [Clinical Quality Language](https://cql.hl7.org/) on this server.
Set `hapi.fhir.cr_enabled=true` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file to enable [Clinical Quality Language](https://cql.hl7.org/) on this server. An alternate settings file, [cds.application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/cds.application.yaml), exists with the Clinical Reasoning module enabled and default settings that have been found to work with most CDS and dQM test cases.

## Enabling CDS Hooks

Set `hapi.fhir.cdshooks.enabled=true` in the [application.yaml](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/application.yaml) file to enable [CDS Hooks](https://cds-hooks.org/) on this server. The Clinical Reasoning module must also be enabled because this implementation of CDS Hooks includes [CDS on FHIR](https://build.fhir.org/clinicalreasoning-cds-on-fhir.html). An example CDS Service using CDS on FHIR is available in the CdsHooksServletIT test class.

## Enabling MDM (EMPI)

Expand Down
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@

<dependencyManagement>
<dependencies>

<!-- Temporarily override CR depedencies for debugging -->
<!-- <dependency>-->
<!-- <groupId>org.opencds.cqf.fhir</groupId>-->
<!-- <artifactId>cqf-fhir-bom</artifactId>-->
<!-- <version>3.4.0</version>-->
<!-- <type>pom</type>-->
<!-- <scope>import</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
import ca.uhn.fhir.jpa.starter.cr.CrProperties;

public class ProviderConfiguration {

public static final ProviderConfiguration DEFAULT_PROVIDER_CONFIGURATION =
new ProviderConfiguration(false, "client_id");

private final String clientIdHeaderName;
private final boolean cqlLoggingEnabled;

Expand All @@ -16,8 +12,7 @@ public ProviderConfiguration(boolean cqlLoggingEnabled, String clientIdHeaderNam
}

public ProviderConfiguration(CdsHooksProperties cdsProperties, CrProperties crProperties) {
this.clientIdHeaderName = cdsProperties.getClientIdHeaderName();
this.cqlLoggingEnabled = crProperties.isCqlRuntimeDebugLoggingEnabled();
this(crProperties.getCql().getRuntime().isDebugLoggingEnabled(), cdsProperties.getClientIdHeaderName());
}

public String getClientIdHeaderName() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
package ca.uhn.fhir.jpa.starter.cdshooks;

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.CdsCrSettings;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrServiceRegistry;
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 ca.uhn.hapi.fhir.cdshooks.svc.prefetch.CdsPrefetchDaoSvc;
import ca.uhn.hapi.fhir.cdshooks.svc.prefetch.CdsPrefetchFhirClientSvc;
import ca.uhn.hapi.fhir.cdshooks.svc.prefetch.CdsPrefetchSvc;
import ca.uhn.hapi.fhir.cdshooks.svc.prefetch.CdsResolutionStrategySvc;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
Expand All @@ -16,8 +26,38 @@

@Configuration
@Conditional({CdsHooksConfigCondition.class, CrConfigCondition.class})
@Import(CdsHooksConfig.class)
@Import({CdsHooksConfig.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();
registry.unregister(FhirVersionEnum.R4);
registry.register(FhirVersionEnum.R4, UpdatedCrDiscoveryServiceR4.class);
return registry;
}

@Bean
public ICdsCrServiceRegistry cdsCrServiceRegistry() {
CdsCrServiceRegistry registry = new CdsCrServiceRegistry();
registry.unregister(FhirVersionEnum.R4);
registry.register(FhirVersionEnum.R4, UpdatedCdsCrServiceR4.class);
return registry;
}

@Bean
public CdsHooksProperties cdsHooksProperties() {
return new CdsHooksProperties();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package ca.uhn.fhir.jpa.starter.cdshooks;

import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceRequestJson;
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 java.util.stream.Collectors;

import static ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrConstants.APPLY_PARAMETER_DATA;
import static ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrConstants.APPLY_PARAMETER_DATA_ENDPOINT;
import static org.opencds.cqf.fhir.utility.r4.Parameters.part;

public class UpdatedCdsCrServiceR4 extends CdsCrServiceR4 {
public UpdatedCdsCrServiceR4(RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) {
super(theRequestDetails, theRepository, theCdsConfigService);
}

@Override
public Parameters encodeParams(CdsServiceRequestJson theJson) {
Parameters parameters = super.encodeParams(theJson);
if (parameters.hasParameter(APPLY_PARAMETER_DATA)) {
parameters.addParameter(part("useServerData", new BooleanType(false)));
}
return parameters;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +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;

public class UpdatedCrDiscoveryServiceR4 extends CrDiscoveryServiceR4 {
public UpdatedCrDiscoveryServiceR4(IIdType thePlanDefinitionId, Repository theRepository) {
super(thePlanDefinitionId, theRepository);
myMaxUriLength = 6000;
}
}
22 changes: 22 additions & 0 deletions src/main/java/ca/uhn/fhir/jpa/starter/cr/CareGapsProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ca.uhn.fhir.jpa.starter.cr;

public class CareGapsProperties {
private String reporter = "default";
private String section_author = "default";

public String getReporter() {
return reporter;
}

public void setReporter(String reporter) {
this.reporter = reporter;
}

public String getSection_author() {
return section_author;
}

public void setSection_author(String section_author) {
this.section_author = section_author;
}
}