Class AbstractCqlOperation
- java.lang.Object
-
- org.linuxforhealth.fhir.server.spi.operation.AbstractOperation
-
- org.linuxforhealth.fhir.operation.cpg.AbstractCqlOperation
-
- All Implemented Interfaces:
FHIROperation
- Direct Known Subclasses:
CqlOperation,LibraryEvaluateOperation
public abstract class AbstractCqlOperation extends AbstractOperation
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPARAM_IN_CONTENT_ENDPOINTstatic java.lang.StringPARAM_IN_DATAstatic java.lang.StringPARAM_IN_DATA_ENDPOINTstatic java.lang.StringPARAM_IN_DEBUGstatic java.lang.StringPARAM_IN_EXPRESSIONstatic java.lang.StringPARAM_IN_PARAMETERSstatic java.lang.StringPARAM_IN_PREFETCH_DATAstatic java.lang.StringPARAM_IN_SUBJECTstatic java.lang.StringPARAM_IN_TERMINOLOGY_ENDPOINTstatic java.lang.StringPARAM_IN_USE_SERVER_DATAstatic java.lang.StringPARAM_OUT_DEBUG_RESULTstatic java.lang.StringPARAM_OUT_RETURN-
Fields inherited from class org.linuxforhealth.fhir.server.spi.operation.AbstractOperation
definition
-
-
Constructor Summary
Constructors Constructor Description AbstractCqlOperation()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected OperationOutcome.IssuecheckUnsupportedParameter(ParameterMap paramMap, java.lang.String paramName)Check for a single unsupported parameter by nameprotected voidcheckUnsupportedParameters(ParameterMap paramMap)Check if the user provided any currently unsupported operation parameters.protected org.opencds.cqf.cql.engine.execution.LibraryLoadercreateLibraryLoader(java.util.List<Library> libraries)Create a CQL Library loader for the content of the provided FHIR Library resourcesprotected ParametersdoEvaluation(FHIRResourceHelpers resourceHelper, ParameterMap paramMap, SearchHelper searchHelper, java.util.List<Library> libraries)Evaluate the requested CQL from the provided Library resource.protected ParametersdoEvaluation(FHIRResourceHelpers resourceHelper, ParameterMap paramMap, SearchHelper searchHelper, Library primaryLibrary)Evaluate the requested CQL from the provided Library resource.protected org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.Object>getCqlContext(ParameterMap paramMap)Retrieve subject parameter from the operation inputprotected org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.Object>getCqlContext(Parameters.Parameter subjectParam)Retrieve subject parameter from the operation inputprotected java.util.Map<java.lang.String,java.lang.Object>getCqlEngineParameters(ParameterConverter converter, Parameters.Parameter parametersParam)Retrieve CQL parameters data from the operation input.protected abstract java.util.Set<java.lang.String>getCqlExpressionsToEvaluate(ParameterMap paramMap)Get the expression names to evaluate in the primary libraryprotected java.util.Map<java.lang.String,java.lang.Object>getCqlParameters(ParameterConverter converter, ParameterMap paramMap)Retrieve CQL parameters data from the operation input.protected org.opencds.cqf.cql.engine.debug.DebugMapgetDebugMap(ParameterMap paramMap)Create a CQL DebugMap object based on the configuation in the operation inputprotected voidthrowOperationException(java.lang.Exception ex)Construct a FHIROperationExcepiton from the provided exception.-
Methods inherited from class org.linuxforhealth.fhir.server.spi.operation.AbstractOperation
buildExceptionWithIssue, buildExceptionWithIssue, buildOperationDefinition, countParameters, doInvoke, findOpDefParameter, getDefinition, getName, getParameter, getParameterDefinitions, getParameters, getResourceTypeNames, invoke, isAbstractResourceTypesDisallowed, isAdditionalMethodAllowed, validateInputParameters, validateOperationContext, validateOutputParameters, validateParameters
-
-
-
-
Field Detail
-
PARAM_IN_EXPRESSION
public static final java.lang.String PARAM_IN_EXPRESSION
- See Also:
- Constant Field Values
-
PARAM_IN_PARAMETERS
public static final java.lang.String PARAM_IN_PARAMETERS
- See Also:
- Constant Field Values
-
PARAM_IN_SUBJECT
public static final java.lang.String PARAM_IN_SUBJECT
- See Also:
- Constant Field Values
-
PARAM_IN_DEBUG
public static final java.lang.String PARAM_IN_DEBUG
- See Also:
- Constant Field Values
-
PARAM_OUT_RETURN
public static final java.lang.String PARAM_OUT_RETURN
- See Also:
- Constant Field Values
-
PARAM_OUT_DEBUG_RESULT
public static final java.lang.String PARAM_OUT_DEBUG_RESULT
- See Also:
- Constant Field Values
-
PARAM_IN_USE_SERVER_DATA
public static final java.lang.String PARAM_IN_USE_SERVER_DATA
- See Also:
- Constant Field Values
-
PARAM_IN_DATA
public static final java.lang.String PARAM_IN_DATA
- See Also:
- Constant Field Values
-
PARAM_IN_PREFETCH_DATA
public static final java.lang.String PARAM_IN_PREFETCH_DATA
- See Also:
- Constant Field Values
-
PARAM_IN_DATA_ENDPOINT
public static final java.lang.String PARAM_IN_DATA_ENDPOINT
- See Also:
- Constant Field Values
-
PARAM_IN_CONTENT_ENDPOINT
public static final java.lang.String PARAM_IN_CONTENT_ENDPOINT
- See Also:
- Constant Field Values
-
PARAM_IN_TERMINOLOGY_ENDPOINT
public static final java.lang.String PARAM_IN_TERMINOLOGY_ENDPOINT
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkUnsupportedParameters
protected void checkUnsupportedParameters(ParameterMap paramMap) throws FHIROperationException
Check if the user provided any currently unsupported operation parameters.- Parameters:
paramMap- Operation input parameters- Throws:
FHIROperationException- when one or more unsupported parameters are found
-
checkUnsupportedParameter
protected OperationOutcome.Issue checkUnsupportedParameter(ParameterMap paramMap, java.lang.String paramName)
Check for a single unsupported parameter by name- Parameters:
paramMap- Operation input parametersparamName- Name of unsupported parameter- Returns:
- FHIR Issue data describing the error or null if no such parameter is found.
-
doEvaluation
protected Parameters doEvaluation(FHIRResourceHelpers resourceHelper, ParameterMap paramMap, SearchHelper searchHelper, Library primaryLibrary)
Evaluate the requested CQL from the provided Library resource.- Parameters:
resourceHelper- Resource operation provider for loading related Library resourcesparamMap- Parameters object that describes the operation to performprimaryLibrary- Library resource that is the entry point for the evaluation- Returns:
- Parameters describing the evaluation result
-
doEvaluation
protected Parameters doEvaluation(FHIRResourceHelpers resourceHelper, ParameterMap paramMap, SearchHelper searchHelper, java.util.List<Library> libraries)
Evaluate the requested CQL from the provided Library resource.- Parameters:
resourceHelper- Resource operation provider for loading related Library resourcesparamMap- Parameters object that describes the operation to performprimaryLibrary- Library resource that is the entry point for the evaluationsearchHelper- A helper class for working with FHIR search parameterslibraries- List of all necessary library resources. The first entry in the list is the primary library.- Returns:
- Parameters describing the evaluation result
-
getCqlContext
protected org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.Object> getCqlContext(ParameterMap paramMap)
Retrieve subject parameter from the operation input- Parameters:
paramMap- operation input- Returns:
- Pair of context name and value
-
getCqlContext
protected org.apache.commons.lang3.tuple.Pair<java.lang.String,java.lang.Object> getCqlContext(Parameters.Parameter subjectParam)
Retrieve subject parameter from the operation input- Parameters:
paramMap- operation input- Returns:
- Pair of context name and value
-
getCqlParameters
protected java.util.Map<java.lang.String,java.lang.Object> getCqlParameters(ParameterConverter converter, ParameterMap paramMap)
Retrieve CQL parameters data from the operation input. FHIR data types are automatically converted to CQL System data types.- Parameters:
converter- Converter logic for transforming FHIR data types to CQL input parameters.paramMap- operation input- Returns:
- Map of parameter name to parameter value where value objects are types in the CQL typesystem.
-
getCqlEngineParameters
protected java.util.Map<java.lang.String,java.lang.Object> getCqlEngineParameters(ParameterConverter converter, Parameters.Parameter parametersParam)
Retrieve CQL parameters data from the operation input. FHIR data types are automatically converted to CQL System data types.- Parameters:
converter- Converter logic for transforming FHIR data types to CQL input parameters.parametersParam- operation input- Returns:
- Map of parameter name to parameter value where value objects are types in the CQL typesystem.
-
getCqlExpressionsToEvaluate
protected abstract java.util.Set<java.lang.String> getCqlExpressionsToEvaluate(ParameterMap paramMap)
Get the expression names to evaluate in the primary library- Parameters:
paramMap- operation input- Returns:
- expression names to evaluate
-
createLibraryLoader
protected org.opencds.cqf.cql.engine.execution.LibraryLoader createLibraryLoader(java.util.List<Library> libraries)
Create a CQL Library loader for the content of the provided FHIR Library resources- Parameters:
libraries- FHIR Library resources containing CQL and/or ELM content- Returns:
- CQL Engine LibraryLoader
-
getDebugMap
protected org.opencds.cqf.cql.engine.debug.DebugMap getDebugMap(ParameterMap paramMap)
Create a CQL DebugMap object based on the configuation in the operation input- Parameters:
paramMap- operation input- Returns:
- DebugMap
-
throwOperationException
protected void throwOperationException(java.lang.Exception ex) throws FHIROperationExceptionConstruct a FHIROperationExcepiton from the provided exception. This allows commonality of error handling between related operations.- Throws:
FHIROperationException
-
-