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

$cql OperationProvider and Tests #458

Merged
merged 4 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion plugin/cpg/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# CPG Plugin

This plugin holds operation on library evaluate.
This plugin provides the following Operations:

Library
$evaluate

System
$cql

$cql is defined in the CPG Implementation Guide here: http://build.fhir.org/ig/HL7/cqf-recommendations/OperationDefinition-cpg-cql.html

*Note* prefetchData is not yet implemented
*Note* subject only supports Patient references as of now
7 changes: 7 additions & 0 deletions plugin/cpg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
<version>0.5.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<version>2.31.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.opencds.cqf.ruler</groupId>
<artifactId>cqf-ruler-test</artifactId>
Expand Down
32 changes: 32 additions & 0 deletions plugin/cpg/src/main/java/org/opencds/cqf/ruler/cpg/CpgConfig.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package org.opencds.cqf.ruler.cpg;

import org.opencds.cqf.cql.evaluator.builder.library.FhirRestLibraryContentProviderFactory;
import org.opencds.cqf.cql.evaluator.cql2elm.util.LibraryVersionSelector;
import org.opencds.cqf.cql.evaluator.fhir.ClientFactory;
import org.opencds.cqf.ruler.api.OperationProvider;
import org.opencds.cqf.ruler.cql.CqlConfig;
import org.opencds.cqf.ruler.external.annotations.OnDSTU3Condition;
import org.opencds.cqf.ruler.external.annotations.OnR4Condition;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import ca.uhn.fhir.context.FhirContext;

@Configuration
@ConditionalOnProperty(prefix = "hapi.fhir.cpg", name ="enabled", havingValue = "true", matchIfMissing=true)
@Import({CqlConfig.class})
Expand All @@ -24,4 +30,30 @@ public CpgProperties cpgProperties() {
public OperationProvider r4LibraryEvaluationProvider() {
return new org.opencds.cqf.ruler.cpg.r4.provider.LibraryEvaluationProvider();
}

@Bean
@Conditional(OnR4Condition.class)
public OperationProvider r4CqlExecutionProvider() {
return new org.opencds.cqf.ruler.cpg.r4.provider.CqlExecutionProvider();
}

@Bean
@Conditional(OnDSTU3Condition.class)
public OperationProvider dstu3CqlExecutionProvider() {
return new org.opencds.cqf.ruler.cpg.dstu3.provider.CqlExecutionProvider();
}

@Bean
@Conditional(OnR4Condition.class)
public FhirRestLibraryContentProviderFactory r4FhirRestibraryContentProviderFactory() {
org.opencds.cqf.cql.evaluator.fhir.adapter.r4.AdapterFactory r4AdapterFactory = new org.opencds.cqf.cql.evaluator.fhir.adapter.r4.AdapterFactory();
return new FhirRestLibraryContentProviderFactory(new ClientFactory(FhirContext.forR4Cached()), r4AdapterFactory, new LibraryVersionSelector(r4AdapterFactory));
}

@Bean
@Conditional(OnDSTU3Condition.class)
public FhirRestLibraryContentProviderFactory dstu3FhirRestibraryContentProviderFactory() {
org.opencds.cqf.cql.evaluator.fhir.adapter.dstu3.AdapterFactory r4AdapterFactory = new org.opencds.cqf.cql.evaluator.fhir.adapter.dstu3.AdapterFactory();
return new FhirRestLibraryContentProviderFactory(new ClientFactory(FhirContext.forDstu3Cached()), r4AdapterFactory, new LibraryVersionSelector(r4AdapterFactory));
}
}
Loading