Search in sources :

Example 1 with MeasureEvaluationSeeder

use of com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder in project quality-measure-and-cohort-service by Alvearie.

the class FHIRRestUtils method toMeasureParameterInfo.

private static MeasureParameterInfo toMeasureParameterInfo(ParameterDefinition parameterDefinition) {
    MeasureParameterInfo retVal = new MeasureParameterInfo();
    String defaultValue = complicatedTypes.contains(parameterDefinition.getType()) ? complicatedTypeValueConstructor(parameterDefinition) : null;
    retVal.name(parameterDefinition.getName()).type(parameterDefinition.getType()).min(parameterDefinition.getMin()).max(parameterDefinition.getMax()).documentation(parameterDefinition.getDocumentation());
    Optional.ofNullable(parameterDefinition.getUse()).map(ParameterUse::getDisplay).ifPresent(retVal::setUse);
    parameterDefinition.getExtension().stream().filter(MeasureEvaluationSeeder::isDefaultValue).findFirst().map(Extension::getValue).map(x -> {
        if (defaultValue != null) {
            return defaultValue;
        } else
            return x.toString();
    }).ifPresent(retVal::setDefaultValue);
    return retVal;
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) Identifier(org.hl7.fhir.r4.model.Identifier) IBMFhirServerConfig(com.ibm.cohort.fhir.client.config.IBMFhirServerConfig) Range(org.hl7.fhir.r4.model.Range) Measure(org.hl7.fhir.r4.model.Measure) ArrayList(java.util.ArrayList) FhirContext(ca.uhn.fhir.context.FhirContext) FhirVersionEnum(ca.uhn.fhir.context.FhirVersionEnum) JsonNode(com.fasterxml.jackson.databind.JsonNode) Quantity(org.hl7.fhir.r4.model.Quantity) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) MeasureParameterInfo(com.ibm.cohort.engine.api.service.model.MeasureParameterInfo) FhirResourceResolver(com.ibm.cohort.cql.fhir.resolver.FhirResourceResolver) Patient(org.hl7.fhir.r4.model.Patient) IParser(ca.uhn.fhir.parser.IParser) ParameterUse(org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse) Period(org.hl7.fhir.r4.model.Period) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultFhirClientBuilder(com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Collectors(java.util.stream.Collectors) Base64(java.util.Base64) List(java.util.List) HttpHeaders(javax.ws.rs.core.HttpHeaders) Optional(java.util.Optional) MeasureEvaluationSeeder(com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder) Extension(org.hl7.fhir.r4.model.Extension) MeasureParameterInfo(com.ibm.cohort.engine.api.service.model.MeasureParameterInfo) MeasureEvaluationSeeder(com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder)

Example 2 with MeasureEvaluationSeeder

use of com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder in project quality-measure-and-cohort-service by Alvearie.

the class MeasureEvaluator method evaluatePatientMeasure.

/**
 * Evaluate a FHIR Quality Measure for a given Patient.
 *
 * The evaluate operation creates a default parameter for the CQL engine named
 * "Measurement Period" that is populated with Interval[periodStart, true,
 * periodEnd, true]. The <a href=
 * "https://www.hl7.org/fhir/measure-operation-evaluate-measure.html">FHIR
 * evaluate operation</a> defines these values as the FHIR
 * <a href="https://www.hl7.org/fhir/datatypes.html#date">date</a> type which is
 * a human readable expression that can be a partial date (e.g. YEAR,
 * YEAR-MONTH, or YEAR-MONTH-DAY format). FHIR dates do not include a timezone,
 * so the periodStart and periodEnd are interpreted as occurring in the timezone
 * of the server evaluating the request.
 *
 * @param measure         FHIR Measure resource
 * @param patientId       FHIR resource ID of the Patient resource to use as the
 *                        subject of the evaluation
 * @param periodStart     FHIR date string representing the start of the
 *                        Measurement Period.
 * @param periodEnd       FHIR date string representing the end of the
 *                        Measurement Period.
 * @param parameters      override values for parameters defined in the CQL
 *                        libraries used to evaluate the measure
 * @param evidenceOptions Settings that control what evidence will be written
 *                        into the MeasureReport
 * @return FHIR MeasureReport
 */
public MeasureReport evaluatePatientMeasure(Measure measure, String patientId, String periodStart, String periodEnd, Map<String, Parameter> parameters, MeasureEvidenceOptions evidenceOptions) {
    MeasureEvaluationSeeder seeder = new MeasureEvaluationSeeder(terminologyProvider, dataProviders, libraryDependencyGatherer, libraryResolver);
    seeder.disableDebugLogging();
    IMeasureEvaluationSeed seed = seeder.create(measure, periodStart, periodEnd, "ProductLine", parameters);
    CDMMeasureEvaluation evaluation = new CDMMeasureEvaluation(seed.getDataProvider(), seed.getMeasurementPeriod());
    return evaluation.evaluatePatientMeasure(measure, seed.getContext(), Collections.singletonList(patientId), evidenceOptions, parameters, MeasureReport.MeasureReportType.INDIVIDUAL);
}
Also used : IMeasureEvaluationSeed(com.ibm.cohort.engine.measure.seed.IMeasureEvaluationSeed) MeasureEvaluationSeeder(com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder)

Example 3 with MeasureEvaluationSeeder

use of com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder in project quality-measure-and-cohort-service by Alvearie.

the class MeasureEvaluator method evaluatePatientListMeasure.

public MeasureReport evaluatePatientListMeasure(List<String> patientIds, Measure measure, Map<String, Parameter> parameters, MeasureEvidenceOptions evidenceOptions) {
    MeasureEvaluationSeeder seeder = new MeasureEvaluationSeeder(terminologyProvider, dataProviders, libraryDependencyGatherer, libraryResolver);
    seeder.disableDebugLogging();
    Pair<String, String> period = getMeasurementPeriodStrategy().getMeasurementPeriod(measure, parameters);
    IMeasureEvaluationSeed seed = seeder.create(measure, period.getLeft(), period.getRight(), "ProductLine", parameters);
    CDMMeasureEvaluation evaluation = new CDMMeasureEvaluation(seed.getDataProvider(), seed.getMeasurementPeriod());
    return evaluation.evaluatePatientMeasure(measure, seed.getContext(), patientIds, evidenceOptions, parameters, MeasureReport.MeasureReportType.SUBJECTLIST);
}
Also used : IMeasureEvaluationSeed(com.ibm.cohort.engine.measure.seed.IMeasureEvaluationSeed) MeasureEvaluationSeeder(com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder)

Aggregations

MeasureEvaluationSeeder (com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder)3 IMeasureEvaluationSeed (com.ibm.cohort.engine.measure.seed.IMeasureEvaluationSeed)2 FhirContext (ca.uhn.fhir.context.FhirContext)1 FhirVersionEnum (ca.uhn.fhir.context.FhirVersionEnum)1 IParser (ca.uhn.fhir.parser.IParser)1 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)1 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 FhirResourceResolver (com.ibm.cohort.cql.fhir.resolver.FhirResourceResolver)1 MeasureParameterInfo (com.ibm.cohort.engine.api.service.model.MeasureParameterInfo)1 DefaultFhirClientBuilder (com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder)1 IBMFhirServerConfig (com.ibm.cohort.fhir.client.config.IBMFhirServerConfig)1 ArrayList (java.util.ArrayList)1 Base64 (java.util.Base64)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 HttpHeaders (javax.ws.rs.core.HttpHeaders)1