Search in sources :

Example 1 with MeasureGroupPopulationComponent

use of org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent in project cqf-ruler by DBCG.

the class MeasureBuilder method addPopulation.

private MeasureBuilder addPopulation(MeasurePopulationType measurePopulationType, String expression) {
    MeasureGroupPopulationComponent mgpc = this.measure.getGroupFirstRep().addPopulation();
    mgpc.getCode().getCodingFirstRep().setCode(measurePopulationType.toCode());
    mgpc.setCriteria(expression);
    return this;
}
Also used : MeasureGroupPopulationComponent(org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent)

Example 2 with MeasureGroupPopulationComponent

use of org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent in project cqf-ruler by DBCG.

the class MeasureBuilder method addPopulation.

private MeasureBuilder addPopulation(MeasurePopulationType measurePopulationType, String expression) {
    MeasureGroupPopulationComponent mgpc = this.measure.getGroupFirstRep().addPopulation();
    mgpc.getCode().getCodingFirstRep().setCode(measurePopulationType.toCode());
    mgpc.getCriteria().setExpression(expression);
    return this;
}
Also used : MeasureGroupPopulationComponent(org.hl7.fhir.r4.model.Measure.MeasureGroupPopulationComponent)

Example 3 with MeasureGroupPopulationComponent

use of org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent in project org.hl7.fhir.core by hapifhir.

the class MeasureValidator method validateMeasureReportGroupPopulations.

private void validateMeasureReportGroupPopulations(ValidatorHostContext hostContext, MeasureContext m, MeasureGroupComponent mg, List<ValidationMessage> errors, Element mrg, NodeStack stack, boolean inProgress) {
    // there must be a population for each population defined in the measure, and no 4others.
    List<MeasureGroupPopulationComponent> pops = new ArrayList<MeasureGroupPopulationComponent>();
    List<Element> plist = mrg.getChildrenByName("population");
    int i = 0;
    for (Element mrgp : plist) {
        NodeStack ns = stack.push(mrgp, i, mrgp.getProperty().getDefinition(), mrgp.getProperty().getDefinition());
        CodeableConcept cc = ObjectConverter.readAsCodeableConcept(mrgp.getNamedChild("code"));
        if (rule(errors, IssueType.BUSINESSRULE, mrgp.line(), mrgp.col(), ns.getLiteralPath(), cc != null, I18nConstants.MEASURE_MR_GRP_POP_NO_CODE)) {
            MeasureGroupPopulationComponent mgp = getGroupPopForCode(cc, mg);
            if (rule(errors, IssueType.BUSINESSRULE, mrg.line(), mrg.col(), ns.getLiteralPath(), mgp != null, I18nConstants.MEASURE_MR_GRP_POP_UNK_CODE)) {
                if (rule(errors, IssueType.BUSINESSRULE, mrg.line(), mrg.col(), ns.getLiteralPath(), !pops.contains(mgp), I18nConstants.MEASURE_MR_GRP_POP_DUPL_CODE)) {
                    pops.add(mgp);
                    validateMeasureReportGroupPopulation(hostContext, m, mgp, errors, mrgp, ns, inProgress);
                }
            }
        }
        i++;
    }
    for (MeasureGroupPopulationComponent mgp : mg.getPopulation()) {
        if (!pops.contains(mgp) && !mgp.getCode().hasCoding("http://terminology.hl7.org/CodeSystem/measure-population", "measure-observation")) {
            rule(errors, IssueType.BUSINESSRULE, mrg.line(), mrg.col(), stack.getLiteralPath(), pops.contains(mg), I18nConstants.MEASURE_MR_GRP_MISSING_BY_CODE, DataRenderer.display(context, mgp.getCode()));
        }
    }
}
Also used : Element(org.hl7.fhir.r5.elementmodel.Element) ArrayList(java.util.ArrayList) NodeStack(org.hl7.fhir.validation.instance.utils.NodeStack) MeasureGroupPopulationComponent(org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent) CodeableConcept(org.hl7.fhir.r5.model.CodeableConcept)

Aggregations

ArrayList (java.util.ArrayList)1 MeasureGroupPopulationComponent (org.hl7.fhir.dstu3.model.Measure.MeasureGroupPopulationComponent)1 MeasureGroupPopulationComponent (org.hl7.fhir.r4.model.Measure.MeasureGroupPopulationComponent)1 Element (org.hl7.fhir.r5.elementmodel.Element)1 CodeableConcept (org.hl7.fhir.r5.model.CodeableConcept)1 MeasureGroupPopulationComponent (org.hl7.fhir.r5.model.Measure.MeasureGroupPopulationComponent)1 NodeStack (org.hl7.fhir.validation.instance.utils.NodeStack)1