Search in sources :

Example 11 with CanonicalType

use of org.hl7.fhir.r4b.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;
}
Also used : Measure(org.hl7.fhir.r4.model.Measure) CanonicalType(org.hl7.fhir.r4.model.CanonicalType)

Example 12 with CanonicalType

use of org.hl7.fhir.r4b.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;
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) IntegerType(org.hl7.fhir.r4.model.IntegerType) Coding(org.hl7.fhir.r4.model.Coding) StringType(org.hl7.fhir.r4.model.StringType) Reference(org.hl7.fhir.r4.model.Reference) ArrayList(java.util.ArrayList) Observation(org.hl7.fhir.r4.model.Observation) CanonicalType(org.hl7.fhir.r4.model.CanonicalType) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 13 with CanonicalType

use of org.hl7.fhir.r4b.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;
}
Also used : TypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent)

Example 14 with CanonicalType

use of org.hl7.fhir.r4b.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;
}
Also used : Reference(org.hl7.fhir.dstu2.model.Reference)

Example 15 with CanonicalType

use of org.hl7.fhir.r4b.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;
}
Also used : CanonicalType(org.hl7.fhir.r5.model.CanonicalType)

Aggregations

CanonicalType (org.hl7.fhir.r4.model.CanonicalType)45 CanonicalType (org.hl7.fhir.r5.model.CanonicalType)37 ArrayList (java.util.ArrayList)27 CanonicalType (org.hl7.fhir.r4b.model.CanonicalType)19 TypeRefComponent (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent)14 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)13 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)12 Test (org.junit.jupiter.api.Test)12 List (java.util.List)10 FHIRException (org.hl7.fhir.exceptions.FHIRException)9 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)9 HashMap (java.util.HashMap)7 HashSet (java.util.HashSet)7 Extension (org.hl7.fhir.r4.model.Extension)7 Library (org.hl7.fhir.r4.model.Library)7 StringType (org.hl7.fhir.r4.model.StringType)6 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)6 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)5 Bundle (org.hl7.fhir.r4.model.Bundle)5 IdType (org.hl7.fhir.r4.model.IdType)5