Skip to content

Commit

Permalink
Use evaluator utilities (#666)
Browse files Browse the repository at this point in the history
* Use evaluator utilities

* Disable R5 test due to fhir core mismatch
  • Loading branch information
JPercival authored Nov 18, 2022
1 parent d1bfd1f commit 4b21166
Show file tree
Hide file tree
Showing 100 changed files with 1,049 additions and 4,027 deletions.
8 changes: 7 additions & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opencds.cqf.ruler</groupId>
Expand All @@ -16,6 +17,11 @@
<version>0.9.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.opencds.cqf.cql</groupId>
<artifactId>evaluator.fhir</artifactId>
</dependency>

<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public default FhirContext getFhirContext() {
* Get the class of the given Resource. FHIR version aware. For example, if the
* server is running in DSTU3 mode
* this will return the DSTU3 Library class when invoked with "Library".
*
*
* @param <T> the type of resource to return
* @param theResourceName the name of the Resource to get the class for
* @return the class of the resource
Expand All @@ -52,7 +52,7 @@ public default <T extends IBaseResource> Class<T> getClass(String theResourceNam
* the Resource is not present
* <p>
* NOTE: Use {@code search} if a null result is preferred over an error.
*
*
* @param <T> the Resource type to read
* @param theId the id to read
* @return the FHIR Resource
Expand All @@ -69,7 +69,7 @@ default <T extends IBaseResource> T read(IIdType theId) {
* the Resource is not present
* <p>
* NOTE: Use {@code search} if a null result is preferred over an error.
*
*
* @param <T> the Resource type to read
* @param theId the id to read
* @param requestDetails multi-tenancy information
Expand All @@ -85,7 +85,7 @@ default <T extends IBaseResource> T read(IIdType theId, RequestDetails requestDe

/**
* Creates the given Resource on the local server
*
*
* @param <T> The Resource type
* @param theResource the resource to create
* @return the outcome of the creation
Expand All @@ -98,7 +98,7 @@ default <T extends IBaseResource> DaoMethodOutcome create(T theResource) {

/**
* Creates the given Resource on the local server
*
*
* @param <T> The Resource type
* @param theResource the resource to create
* @param requestDetails multi-tenancy information
Expand All @@ -114,7 +114,7 @@ default <T extends IBaseResource> DaoMethodOutcome create(T theResource, Request

/**
* Updates the given Resource on the local server
*
*
* @param <T> The Resource type
* @param theResource the resource to update
* @return the outcome of the creation
Expand All @@ -127,7 +127,7 @@ default <T extends IBaseResource> DaoMethodOutcome update(T theResource) {

/**
* Updates the given Resource on the local server
*
*
* @param <T> The Resource type
* @param theResource the resource to update
* @param requestDetails multi-tenancy information
Expand All @@ -143,7 +143,7 @@ default <T extends IBaseResource> DaoMethodOutcome update(T theResource, Request

/**
* Deletes the Resource with the given Id from the local server
*
*
* @param theIdType the Id of the Resource to delete.
* @return the outcome of the deletion
*/
Expand All @@ -155,7 +155,7 @@ default DaoMethodOutcome delete(IIdType theIdType) {

/**
* Deletes the Resource with the given Id from the local server
*
*
* @param theIdType the Id of the Resource to delete.
* @param requestDetails multi-tenancy information
* @return the outcome of the deletion
Expand All @@ -170,7 +170,7 @@ default DaoMethodOutcome delete(IIdType theIdType, RequestDetails requestDetails
* NOTE: This is untested as of the time I'm writing this so it may need to be
* reworked.
* Executes a given transaction Bundle on the local server
*
*
* @param <T> the type of Bundle
* @param theTransaction the transaction to process
* @return the transaction outcome
Expand All @@ -185,7 +185,7 @@ default <T extends IBaseBundle> T transaction(T theTransaction) {
* NOTE: This is untested as of the time I'm writing this so it may need to be
* reworked.
* Executes a given transaction Bundle on the local server
*
*
* @param <T> the type of Bundle
* @param theTransaction the transaction to process
* @param theRequestDetails multi-tenancy information
Expand All @@ -201,7 +201,7 @@ default <T extends IBaseBundle> T transaction(T theTransaction, RequestDetails t
/**
* Searches for a Resource on the local server using the Search Parameters
* specified
*
*
* @param <T> the type of Resource to return
* @param theResourceClass the class of the Resource
* @param theSearchMap the Search Parameters
Expand All @@ -218,7 +218,7 @@ default <T extends IBaseResource> TypedBundleProvider<T> search(Class<T> theReso
/**
* Searches for a Resource on the local server using the Search Parameters
* specified
*
*
* @param <T> the type of Resource to return
* @param theResourceClass the class of the Resource
* @param theSearchMap the Search Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import static com.google.common.base.Preconditions.checkNotNull;

import org.hl7.fhir.instance.model.api.IIdType;
import org.opencds.cqf.ruler.utility.Ids;

import org.opencds.cqf.cql.evaluator.fhir.util.Ids;

public interface IdCreator extends FhirContextUser {

Expand All @@ -17,7 +16,7 @@ default <T extends IIdType> T newId(String theResourceName, String theResourceId

default <T extends IIdType> T newId(String theResourceId) {
checkNotNull(theResourceId);

return Ids.newId(getFhirContext(), theResourceId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.opencds.cqf.ruler.utility.Ids;
import org.opencds.cqf.cql.evaluator.fhir.util.Ids;

public interface ResourceCreator extends FhirContextUser {
@SuppressWarnings("unchecked")
Expand All @@ -23,7 +23,7 @@ default <T extends IBaseResource> T newResource(Class<T> theResourceClass, Strin
checkNotNull(theIdPart);

T newResource = newResource(theResourceClass);
newResource.setId((IIdType)Ids.newId(getFhirContext(), newResource.fhirType(), theIdPart));
newResource.setId((IIdType) Ids.newId(getFhirContext(), newResource.fhirType(), theIdPart));

return newResource;
}
Expand All @@ -32,13 +32,13 @@ default <T extends IBaseResource> T newResource(Class<T> theResourceClass, Strin
default <T extends IBaseResource> T newResource(Class<T> theResourceClass) {
checkNotNull(theResourceClass);

return (T)this.getFhirContext().getResourceDefinition(theResourceClass).newInstance();
return (T) this.getFhirContext().getResourceDefinition(theResourceClass).newInstance();
}

@SuppressWarnings("unchecked")
default <T extends IBaseResource> T newResource(String theResourceType) {
checkNotNull(theResourceType);

return (T)this.getFhirContext().getResourceDefinition(theResourceType).newInstance();
return (T) this.getFhirContext().getResourceDefinition(theResourceType).newInstance();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.SearchParameter;
import org.hl7.fhir.r4.model.SearchParameter.XPathUsageType;
import org.opencds.cqf.cql.evaluator.fhir.util.Ids;
import org.opencds.cqf.ruler.behavior.DaoRegistryUser;
import org.opencds.cqf.ruler.behavior.IdCreator;
import org.opencds.cqf.ruler.utility.Ids;
import org.opencds.cqf.ruler.utility.Searches;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ default List<Measure> getMeasures(List<String> measureIds, List<String> measureI

if (hasMeasureIds) {
measureList
.addAll(search(Measure.class, Searches.byIds(measureIds), theRequestDetails).getAllResourcesTyped());
.addAll(search(Measure.class, Searches.byIds(measureIds), theRequestDetails)
.getAllResourcesTyped());
}

// TODO: implement searching by measure identifiers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import org.apache.commons.lang3.tuple.Pair;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import org.hl7.fhir.instance.model.api.IBaseExtension;
import org.opencds.cqf.ruler.utility.FhirVersions;
import org.opencds.cqf.ruler.utility.Resources;
import org.opencds.cqf.cql.evaluator.fhir.util.FhirVersions;
import org.opencds.cqf.cql.evaluator.fhir.util.Resources;

public abstract class BackboneElementBuilder<SELF, T extends IBaseBackboneElement> {
public abstract class BackboneElementBuilder<SELF extends BackboneElementBuilder<SELF, T>, T extends IBaseBackboneElement> {

private final Class<T> myResourceClass;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.apache.commons.lang3.tuple.Pair;
import org.elasticsearch.common.Strings;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.opencds.cqf.ruler.utility.Resources;
import org.opencds.cqf.cql.evaluator.fhir.util.Resources;

public abstract class ResourceBuilder<SELF, T extends IBaseResource> {

Expand Down

This file was deleted.

Loading

0 comments on commit 4b21166

Please sign in to comment.