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;
}
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;
}
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()));
}
}
}
Aggregations