use of org.hl7.fhir.r4.model.CanonicalType in project quality-measure-and-cohort-service by Alvearie.
the class MeasureEvaluationSeederTest method createMeasure.
private Measure createMeasure() {
CanonicalType libraryRef = new CanonicalType();
libraryRef.setValue(libraryUrl);
Measure measure = new Measure();
measure.setLibrary(Collections.singletonList(libraryRef));
return measure;
}
use of org.hl7.fhir.r4.model.CanonicalType in project quality-measure-and-cohort-service by Alvearie.
the class MeasureSupplementalDataEvaluation method processAccumulators.
public static MeasureReport processAccumulators(MeasureReport report, Map<String, Map<String, Integer>> sdeAccumulators, boolean isSingle, List<Patient> patients) {
List<Reference> newRefList = new ArrayList<>();
sdeAccumulators.forEach((sdeKey, sdeAccumulator) -> {
sdeAccumulator.forEach((sdeAccumulatorKey, sdeAccumulatorValue) -> {
Observation obs = new Observation();
obs.setStatus(Observation.ObservationStatus.FINAL);
obs.setId(UUID.randomUUID().toString());
Coding valueCoding = new Coding();
if (sdeKey.equalsIgnoreCase(SDE_SEX)) {
valueCoding.setCode(sdeAccumulatorKey);
} else {
String coreCategory = sdeKey.substring(sdeKey.lastIndexOf('-'));
patients.forEach((pt) -> {
pt.getExtension().forEach((ptExt) -> {
if (ptExt.getUrl().contains(coreCategory)) {
String code = ((Coding) ptExt.getExtension().get(0).getValue()).getCode();
if (code.equalsIgnoreCase(sdeAccumulatorKey)) {
valueCoding.setSystem(((Coding) ptExt.getExtension().get(0).getValue()).getSystem());
valueCoding.setCode(code);
valueCoding.setDisplay(((Coding) ptExt.getExtension().get(0).getValue()).getDisplay());
}
}
});
});
}
CodeableConcept obsCodeableConcept = new CodeableConcept();
Extension obsExtension = new Extension().setUrl(CQF_MEASUREINFO_URL);
Extension extExtMeasure = new Extension().setUrl(MEASURE).setValue(new CanonicalType(CQFMEASURES_URL + report.getMeasure()));
obsExtension.addExtension(extExtMeasure);
Extension extExtPop = new Extension().setUrl(POPULATION_ID).setValue(new StringType(sdeKey));
obsExtension.addExtension(extExtPop);
obs.addExtension(obsExtension);
obs.setValue(new IntegerType(sdeAccumulatorValue));
if (!isSingle) {
valueCoding.setCode(sdeAccumulatorKey);
obsCodeableConcept.setCoding(Collections.singletonList(valueCoding));
obs.setCode(obsCodeableConcept);
} else {
obs.setCode(new CodeableConcept().setText(sdeKey));
obsCodeableConcept.setCoding(Collections.singletonList(valueCoding));
obs.setValue(obsCodeableConcept);
}
newRefList.add(new Reference("#" + obs.getId()));
report.addContained(obs);
});
});
newRefList.addAll(report.getEvaluatedResource());
report.setEvaluatedResource(newRefList);
return report;
}
use of org.hl7.fhir.r4.model.CanonicalType in project org.hl7.fhir.core by hapifhir.
the class SpecDifferenceEvaluator method hasType.
private boolean hasType(List<TypeRefComponent> types, TypeRefComponent tr) {
for (TypeRefComponent t : types) {
if (t.getWorkingCode().equals(tr.getWorkingCode())) {
if ((!t.hasProfile() && !tr.hasProfile())) {
return true;
}
boolean found = true;
for (CanonicalType t1 : tr.getProfile()) {
boolean ok = false;
for (CanonicalType t2 : t.getProfile()) {
ok = ok || t2.getValue().equals(t1.getValue());
}
found = found && ok;
}
return found;
}
}
return false;
}
use of org.hl7.fhir.r4.model.CanonicalType in project org.hl7.fhir.core by hapifhir.
the class Reference10_50 method convertCanonicalToReference.
public static Reference convertCanonicalToReference(CanonicalType src) throws FHIRException {
Reference dst = new Reference(src.getValue());
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, dst);
return dst;
}
use of org.hl7.fhir.r4.model.CanonicalType in project org.hl7.fhir.core by hapifhir.
the class Reference10_50 method convertReferenceToCanonical.
public static CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException {
CanonicalType dst = new CanonicalType(src.getReference());
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, dst);
return dst;
}
Aggregations