Search in sources :

Example 1 with Base64BinaryType

use of org.hl7.fhir.r4b.model.Base64BinaryType in project quality-measure-and-cohort-service by Alvearie.

the class MeasureEvaluatorTest method measure_report_generated___FHIR_measure_parameters_on_measure_report.

@Test
public void measure_report_generated___FHIR_measure_parameters_on_measure_report() throws Exception {
    CapabilityStatement metadata = getCapabilityStatement();
    mockFhirResourceRetrieval("/metadata?_format=json", metadata);
    Patient patient = getPatient("123", AdministrativeGender.MALE, "1970-10-10");
    mockFhirResourceRetrieval(patient);
    Library library = mockLibraryRetrieval("TestDummyPopulations", DEFAULT_VERSION, "cql/fhir-measure/test-dummy-populations.xml", ELM_MIME_TYPE);
    Measure measure = getCohortMeasure("CohortMeasureName", library, INITIAL_POPULATION);
    Map<String, Type> measureParameters = new HashMap<>();
    measureParameters.put("base64Param", new Base64BinaryType("AAA"));
    measureParameters.put("booleanParam", new BooleanType(false));
    measureParameters.put("dateParam", new DateType("2020-01-01"));
    measureParameters.put("dateTimeParam", new DateTimeType("2020-01-01T12:00:00"));
    measureParameters.put("decimalParam", new DecimalType(12.0));
    measureParameters.put("instantParam", new InstantType("2020-01-01T12:00:00-04:00"));
    measureParameters.put("integerParam", new IntegerType(1));
    measureParameters.put("stringParam", new StringType("str"));
    measureParameters.put("timeParam", new TimeType("05:30:00"));
    measureParameters.put("uriParam", new UriType("abcde"));
    measureParameters.put("codeableConceptParam", new CodeableConcept().setText("display").addCoding(new Coding().setCode("val").setSystem("sys").setDisplay("display")));
    measureParameters.put("codingParam", new Coding().setCode("v").setSystem("s").setDisplay("d"));
    measureParameters.put("periodParam", new Period().setStart(new Date(1)).setEnd(new Date(2)));
    measureParameters.put("quantityParam", new Quantity().setValue(1).setUnit("g"));
    measureParameters.put("rangeParam", new Range().setLow(new Quantity().setUnit("g").setValue(1)).setHigh(new Quantity().setUnit("g").setValue(5)));
    measureParameters.put("ratioParam", new Ratio().setNumerator(new Quantity().setUnit("g").setValue(1)).setDenominator(new Quantity().setUnit("g").setValue(5)));
    List<Extension> parameterExtensions = measureParameters.entrySet().stream().map(x -> createMeasureParameter(x.getKey(), x.getValue())).collect(Collectors.toList());
    measure.setExtension(parameterExtensions);
    mockFhirResourceRetrieval(measure);
    MeasureReport report = evaluator.evaluatePatientMeasure(measure.getId(), patient.getId(), null);
    assertNotNull(report);
    List<String> parameterNames = report.getExtension().stream().filter(x -> x.getUrl().equals(MEASURE_PARAMETER_VALUE_URL)).map(x -> (ParameterDefinition) x.getValue()).map(ParameterDefinition::getName).collect(Collectors.toList());
    // Expected parameters are the ones listed above, plus the special parameters
    // measurement period and product line
    assertEquals(measureParameters.size() + 2, parameterNames.size());
    assertTrue(parameterNames.containsAll(measureParameters.keySet()));
    assertTrue(parameterNames.contains(CDMConstants.MEASUREMENT_PERIOD));
    assertTrue(parameterNames.contains(CDMConstants.PRODUCT_LINE));
}
Also used : Arrays(java.util.Arrays) Date(java.util.Date) PARAMETER_VALUE_URL(com.ibm.cohort.engine.cdm.CDMConstants.PARAMETER_VALUE_URL) Range(org.hl7.fhir.r4.model.Range) StringUtils(org.apache.commons.lang3.StringUtils) ConceptParameter(com.ibm.cohort.cql.evaluation.parameters.ConceptParameter) InvalidOperatorArgument(org.opencds.cqf.cql.engine.exception.InvalidOperatorArgument) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) HumanName(org.hl7.fhir.r4.model.HumanName) RatioParameter(com.ibm.cohort.cql.evaluation.parameters.RatioParameter) Map(java.util.Map) StringType(org.hl7.fhir.r4.model.StringType) Assert.fail(org.junit.Assert.fail) ParseException(java.text.ParseException) IntegerType(org.hl7.fhir.r4.model.IntegerType) Patient(org.hl7.fhir.r4.model.Patient) DefineReturnOptions(com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions.DefineReturnOptions) IntegerParameter(com.ibm.cohort.cql.evaluation.parameters.IntegerParameter) DateParameter(com.ibm.cohort.cql.evaluation.parameters.DateParameter) DateType(org.hl7.fhir.r4.model.DateType) TimeZone(java.util.TimeZone) CodeParameter(com.ibm.cohort.cql.evaluation.parameters.CodeParameter) Period(org.hl7.fhir.r4.model.Period) MEASURE_PARAMETER_URL(com.ibm.cohort.engine.cdm.CDMConstants.MEASURE_PARAMETER_URL) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Collectors(java.util.stream.Collectors) PARAMETER_DEFAULT_URL(com.ibm.cohort.engine.cdm.CDMConstants.PARAMETER_DEFAULT_URL) TimeType(org.hl7.fhir.r4.model.TimeType) List(java.util.List) BooleanType(org.hl7.fhir.r4.model.BooleanType) Assert.assertFalse(org.junit.Assert.assertFalse) Coding(org.hl7.fhir.r4.model.Coding) WireMock.getRequestedFor(com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor) Extension(org.hl7.fhir.r4.model.Extension) UriType(org.hl7.fhir.r4.model.UriType) Parameter(com.ibm.cohort.cql.evaluation.parameters.Parameter) UnsupportedFhirTypeException(com.ibm.cohort.engine.measure.parameter.UnsupportedFhirTypeException) DatetimeParameter(com.ibm.cohort.cql.evaluation.parameters.DatetimeParameter) Type(org.hl7.fhir.r4.model.Type) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) HashMap(java.util.HashMap) IntervalParameter(com.ibm.cohort.cql.evaluation.parameters.IntervalParameter) DecimalParameter(com.ibm.cohort.cql.evaluation.parameters.DecimalParameter) Measure(org.hl7.fhir.r4.model.Measure) ArrayList(java.util.ArrayList) Address(org.hl7.fhir.r4.model.Address) Base64BinaryType(org.hl7.fhir.r4.model.Base64BinaryType) QuantityParameter(com.ibm.cohort.cql.evaluation.parameters.QuantityParameter) MEASURE_PARAMETER_VALUE_URL(com.ibm.cohort.engine.cdm.CDMConstants.MEASURE_PARAMETER_VALUE_URL) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Quantity(org.hl7.fhir.r4.model.Quantity) Ratio(org.hl7.fhir.r4.model.Ratio) MeasureSupplementalDataEvaluation(com.ibm.cohort.engine.cqfruler.MeasureSupplementalDataEvaluation) DecimalType(org.hl7.fhir.r4.model.DecimalType) Before(org.junit.Before) MeasureEvidenceOptions(com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions) StringParameter(com.ibm.cohort.cql.evaluation.parameters.StringParameter) Assert.assertNotNull(org.junit.Assert.assertNotNull) ListResource(org.hl7.fhir.r4.model.ListResource) Library(org.hl7.fhir.r4.model.Library) Assert.assertTrue(org.junit.Assert.assertTrue) Matchers(org.hamcrest.Matchers) CanonicalType(org.hl7.fhir.r4.model.CanonicalType) Test(org.junit.Test) TimeParameter(com.ibm.cohort.cql.evaluation.parameters.TimeParameter) WireMock.verify(com.github.tomakehurst.wiremock.client.WireMock.verify) WireMock.urlMatching(com.github.tomakehurst.wiremock.client.WireMock.urlMatching) Assert.assertNotEquals(org.junit.Assert.assertNotEquals) CDMConstants(com.ibm.cohort.engine.cdm.CDMConstants) MeasurePopulationType(org.opencds.cqf.common.evaluation.MeasurePopulationType) InstantType(org.hl7.fhir.r4.model.InstantType) AdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender) BooleanParameter(com.ibm.cohort.cql.evaluation.parameters.BooleanParameter) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) WireMock.urlEqualTo(com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo) Assert.assertEquals(org.junit.Assert.assertEquals) HashMap(java.util.HashMap) StringType(org.hl7.fhir.r4.model.StringType) TimeType(org.hl7.fhir.r4.model.TimeType) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) UriType(org.hl7.fhir.r4.model.UriType) Coding(org.hl7.fhir.r4.model.Coding) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) Measure(org.hl7.fhir.r4.model.Measure) Ratio(org.hl7.fhir.r4.model.Ratio) InstantType(org.hl7.fhir.r4.model.InstantType) DateType(org.hl7.fhir.r4.model.DateType) BooleanType(org.hl7.fhir.r4.model.BooleanType) Patient(org.hl7.fhir.r4.model.Patient) Period(org.hl7.fhir.r4.model.Period) Quantity(org.hl7.fhir.r4.model.Quantity) MeasureReport(org.hl7.fhir.r4.model.MeasureReport) Range(org.hl7.fhir.r4.model.Range) Date(java.util.Date) IntegerType(org.hl7.fhir.r4.model.IntegerType) Extension(org.hl7.fhir.r4.model.Extension) StringType(org.hl7.fhir.r4.model.StringType) IntegerType(org.hl7.fhir.r4.model.IntegerType) DateType(org.hl7.fhir.r4.model.DateType) TimeType(org.hl7.fhir.r4.model.TimeType) BooleanType(org.hl7.fhir.r4.model.BooleanType) UriType(org.hl7.fhir.r4.model.UriType) Type(org.hl7.fhir.r4.model.Type) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Base64BinaryType(org.hl7.fhir.r4.model.Base64BinaryType) DecimalType(org.hl7.fhir.r4.model.DecimalType) CanonicalType(org.hl7.fhir.r4.model.CanonicalType) MeasurePopulationType(org.opencds.cqf.common.evaluation.MeasurePopulationType) InstantType(org.hl7.fhir.r4.model.InstantType) DateTimeType(org.hl7.fhir.r4.model.DateTimeType) DecimalType(org.hl7.fhir.r4.model.DecimalType) Library(org.hl7.fhir.r4.model.Library) Base64BinaryType(org.hl7.fhir.r4.model.Base64BinaryType) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.Test)

Example 2 with Base64BinaryType

use of org.hl7.fhir.r4b.model.Base64BinaryType in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method renderLeaf.

private void renderLeaf(ResourceWrapper res, BaseWrapper ew, ElementDefinition defn, XhtmlNode x, boolean title, boolean showCodeDetails, Map<String, String> displayHints) throws FHIRException, UnsupportedEncodingException, IOException {
    if (ew == null)
        return;
    Base e = ew.getBase();
    if (e instanceof StringType)
        x.addText(((StringType) e).getValue());
    else if (e instanceof CodeType)
        x.addText(((CodeType) e).getValue());
    else if (e instanceof IdType)
        x.addText(((IdType) e).getValue());
    else if (e instanceof Extension)
        x.addText("Extensions: Todo");
    else if (e instanceof InstantType)
        x.addText(((InstantType) e).toHumanDisplay());
    else if (e instanceof DateTimeType)
        x.addText(((DateTimeType) e).toHumanDisplay());
    else if (e instanceof Base64BinaryType)
        x.addText(new Base64().encodeAsString(((Base64BinaryType) e).getValue()));
    else if (e instanceof org.hl7.fhir.dstu2.model.DateType)
        x.addText(((org.hl7.fhir.dstu2.model.DateType) e).toHumanDisplay());
    else if (e instanceof Enumeration) {
        Object ev = ((Enumeration<?>) e).getValue();
        // todo: look up a display name if there is one
        x.addText(ev == null ? "" : ev.toString());
    } else if (e instanceof BooleanType)
        x.addText(((BooleanType) e).getValue().toString());
    else if (e instanceof CodeableConcept) {
        renderCodeableConcept((CodeableConcept) e, x, showCodeDetails);
    } else if (e instanceof Coding) {
        renderCoding((Coding) e, x, showCodeDetails);
    } else if (e instanceof Annotation) {
        renderAnnotation((Annotation) e, x);
    } else if (e instanceof Identifier) {
        renderIdentifier((Identifier) e, x);
    } else if (e instanceof org.hl7.fhir.dstu2.model.IntegerType) {
        x.addText(Integer.toString(((org.hl7.fhir.dstu2.model.IntegerType) e).getValue()));
    } else if (e instanceof org.hl7.fhir.dstu2.model.DecimalType) {
        x.addText(((org.hl7.fhir.dstu2.model.DecimalType) e).getValue().toString());
    } else if (e instanceof HumanName) {
        renderHumanName((HumanName) e, x);
    } else if (e instanceof SampledData) {
        renderSampledData((SampledData) e, x);
    } else if (e instanceof Address) {
        renderAddress((Address) e, x);
    } else if (e instanceof ContactPoint) {
        renderContactPoint((ContactPoint) e, x);
    } else if (e instanceof UriType) {
        renderUri((UriType) e, x);
    } else if (e instanceof Timing) {
        renderTiming((Timing) e, x);
    } else if (e instanceof Range) {
        renderRange((Range) e, x);
    } else if (e instanceof Quantity) {
        renderQuantity((Quantity) e, x, showCodeDetails);
    } else if (e instanceof Ratio) {
        renderQuantity(((Ratio) e).getNumerator(), x, showCodeDetails);
        x.addText("/");
        renderQuantity(((Ratio) e).getDenominator(), x, showCodeDetails);
    } else if (e instanceof Period) {
        Period p = (Period) e;
        x.addText(!p.hasStart() ? "??" : p.getStartElement().toHumanDisplay());
        x.addText(" --> ");
        x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
    } else if (e instanceof Reference) {
        Reference r = (Reference) e;
        XhtmlNode c = x;
        ResourceWithReference tr = null;
        if (r.hasReferenceElement()) {
            tr = resolveReference(res, r.getReference());
            if (!r.getReference().startsWith("#")) {
                if (tr != null && tr.getReference() != null)
                    c = x.addTag("a").attribute("href", tr.getReference());
                else
                    c = x.addTag("a").attribute("href", r.getReference());
            }
        }
        // what to display: if text is provided, then that. if the reference was resolved, then show the generated narrative
        if (r.hasDisplayElement()) {
            c.addText(r.getDisplay());
            if (tr != null) {
                c.addText(". Generated Summary: ");
                generateResourceSummary(c, tr.getResource(), true, r.getReference().startsWith("#"));
            }
        } else if (tr != null) {
            generateResourceSummary(c, tr.getResource(), r.getReference().startsWith("#"), r.getReference().startsWith("#"));
        } else {
            c.addText(r.getReference());
        }
    } else if (e instanceof Resource) {
        return;
    } else if (e instanceof ElementDefinition) {
        x.addText("todo-bundle");
    } else if (e != null && !(e instanceof Attachment) && !(e instanceof Narrative) && !(e instanceof Meta))
        throw new NotImplementedException("type " + e.getClass().getName() + " not handled yet");
}
Also used : Meta(org.hl7.fhir.dstu2.model.Meta) Base64(org.apache.commons.codec.binary.Base64) Address(org.hl7.fhir.dstu2.model.Address) StringType(org.hl7.fhir.dstu2.model.StringType) NotImplementedException(org.apache.commons.lang3.NotImplementedException) Attachment(org.hl7.fhir.dstu2.model.Attachment) UriType(org.hl7.fhir.dstu2.model.UriType) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode) HumanName(org.hl7.fhir.dstu2.model.HumanName) ContactPoint(org.hl7.fhir.dstu2.model.ContactPoint) Identifier(org.hl7.fhir.dstu2.model.Identifier) Coding(org.hl7.fhir.dstu2.model.Coding) Narrative(org.hl7.fhir.dstu2.model.Narrative) SampledData(org.hl7.fhir.dstu2.model.SampledData) Ratio(org.hl7.fhir.dstu2.model.Ratio) ElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition) InstantType(org.hl7.fhir.dstu2.model.InstantType) Enumeration(org.hl7.fhir.dstu2.model.Enumeration) Reference(org.hl7.fhir.dstu2.model.Reference) BooleanType(org.hl7.fhir.dstu2.model.BooleanType) Resource(org.hl7.fhir.dstu2.model.Resource) DomainResource(org.hl7.fhir.dstu2.model.DomainResource) Quantity(org.hl7.fhir.dstu2.model.Quantity) Period(org.hl7.fhir.dstu2.model.Period) Range(org.hl7.fhir.dstu2.model.Range) Base(org.hl7.fhir.dstu2.model.Base) Annotation(org.hl7.fhir.dstu2.model.Annotation) IdType(org.hl7.fhir.dstu2.model.IdType) Extension(org.hl7.fhir.dstu2.model.Extension) DateTimeType(org.hl7.fhir.dstu2.model.DateTimeType) CodeType(org.hl7.fhir.dstu2.model.CodeType) EventTiming(org.hl7.fhir.dstu2.model.Timing.EventTiming) Timing(org.hl7.fhir.dstu2.model.Timing) Base64BinaryType(org.hl7.fhir.dstu2.model.Base64BinaryType) CodeableConcept(org.hl7.fhir.dstu2.model.CodeableConcept)

Example 3 with Base64BinaryType

use of org.hl7.fhir.r4b.model.Base64BinaryType in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeBase64Binary.

protected void composeBase64Binary(Complex parent, String parentType, String name, Base64BinaryType value, int index) {
    if (value == null)
        return;
    Complex t = parent.predicate("fhir:" + parentType + "." + name);
    t.predicate("fhir:value", ttlLiteral(value.asStringValue()));
    composeElement(t, parentType, name, value, index);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 4 with Base64BinaryType

use of org.hl7.fhir.r4b.model.Base64BinaryType in project org.hl7.fhir.core by hapifhir.

the class JsonParser method composeType.

protected void composeType(String prefix, Type type) throws IOException {
    if (type == null)
        ;
    else if (type instanceof Age)
        composeAge(prefix + "Age", (Age) type);
    else if (type instanceof Count)
        composeCount(prefix + "Count", (Count) type);
    else if (type instanceof Money)
        composeMoney(prefix + "Money", (Money) type);
    else if (type instanceof Distance)
        composeDistance(prefix + "Distance", (Distance) type);
    else if (type instanceof Duration)
        composeDuration(prefix + "Duration", (Duration) type);
    else if (type instanceof SimpleQuantity)
        composeSimpleQuantity(prefix + "SimpleQuantity", (SimpleQuantity) type);
    else if (type instanceof Period)
        composePeriod(prefix + "Period", (Period) type);
    else if (type instanceof Coding)
        composeCoding(prefix + "Coding", (Coding) type);
    else if (type instanceof Range)
        composeRange(prefix + "Range", (Range) type);
    else if (type instanceof Quantity)
        composeQuantity(prefix + "Quantity", (Quantity) type);
    else if (type instanceof Attachment)
        composeAttachment(prefix + "Attachment", (Attachment) type);
    else if (type instanceof Ratio)
        composeRatio(prefix + "Ratio", (Ratio) type);
    else if (type instanceof Annotation)
        composeAnnotation(prefix + "Annotation", (Annotation) type);
    else if (type instanceof SampledData)
        composeSampledData(prefix + "SampledData", (SampledData) type);
    else if (type instanceof Reference)
        composeReference(prefix + "Reference", (Reference) type);
    else if (type instanceof CodeableConcept)
        composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) type);
    else if (type instanceof Identifier)
        composeIdentifier(prefix + "Identifier", (Identifier) type);
    else if (type instanceof Signature)
        composeSignature(prefix + "Signature", (Signature) type);
    else if (type instanceof TriggerDefinition)
        composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) type);
    else if (type instanceof ElementDefinition)
        composeElementDefinition(prefix + "ElementDefinition", (ElementDefinition) type);
    else if (type instanceof Timing)
        composeTiming(prefix + "Timing", (Timing) type);
    else if (type instanceof ModuleMetadata)
        composeModuleMetadata(prefix + "ModuleMetadata", (ModuleMetadata) type);
    else if (type instanceof ActionDefinition)
        composeActionDefinition(prefix + "ActionDefinition", (ActionDefinition) type);
    else if (type instanceof Address)
        composeAddress(prefix + "Address", (Address) type);
    else if (type instanceof HumanName)
        composeHumanName(prefix + "HumanName", (HumanName) type);
    else if (type instanceof DataRequirement)
        composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
    else if (type instanceof Meta)
        composeMeta(prefix + "Meta", (Meta) type);
    else if (type instanceof ParameterDefinition)
        composeParameterDefinition(prefix + "ParameterDefinition", (ParameterDefinition) type);
    else if (type instanceof ContactPoint)
        composeContactPoint(prefix + "ContactPoint", (ContactPoint) type);
    else if (type instanceof MarkdownType) {
        composeMarkdownCore(prefix + "Markdown", (MarkdownType) type, false);
        composeMarkdownExtras(prefix + "Markdown", (MarkdownType) type, false);
    } else if (type instanceof UnsignedIntType) {
        composeUnsignedIntCore(prefix + "UnsignedInt", (UnsignedIntType) type, false);
        composeUnsignedIntExtras(prefix + "UnsignedInt", (UnsignedIntType) type, false);
    } else if (type instanceof CodeType) {
        composeCodeCore(prefix + "Code", (CodeType) type, false);
        composeCodeExtras(prefix + "Code", (CodeType) type, false);
    } else if (type instanceof IdType) {
        composeIdCore(prefix + "Id", (IdType) type, false);
        composeIdExtras(prefix + "Id", (IdType) type, false);
    } else if (type instanceof OidType) {
        composeOidCore(prefix + "Oid", (OidType) type, false);
        composeOidExtras(prefix + "Oid", (OidType) type, false);
    } else if (type instanceof PositiveIntType) {
        composePositiveIntCore(prefix + "PositiveInt", (PositiveIntType) type, false);
        composePositiveIntExtras(prefix + "PositiveInt", (PositiveIntType) type, false);
    } else if (type instanceof UuidType) {
        composeUuidCore(prefix + "Uuid", (UuidType) type, false);
        composeUuidExtras(prefix + "Uuid", (UuidType) type, false);
    } else if (type instanceof IntegerType) {
        composeIntegerCore(prefix + "Integer", (IntegerType) type, false);
        composeIntegerExtras(prefix + "Integer", (IntegerType) type, false);
    } else if (type instanceof DateTimeType) {
        composeDateTimeCore(prefix + "DateTime", (DateTimeType) type, false);
        composeDateTimeExtras(prefix + "DateTime", (DateTimeType) type, false);
    } else if (type instanceof DateType) {
        composeDateCore(prefix + "Date", (DateType) type, false);
        composeDateExtras(prefix + "Date", (DateType) type, false);
    } else if (type instanceof DecimalType) {
        composeDecimalCore(prefix + "Decimal", (DecimalType) type, false);
        composeDecimalExtras(prefix + "Decimal", (DecimalType) type, false);
    } else if (type instanceof UriType) {
        composeUriCore(prefix + "Uri", (UriType) type, false);
        composeUriExtras(prefix + "Uri", (UriType) type, false);
    } else if (type instanceof Base64BinaryType) {
        composeBase64BinaryCore(prefix + "Base64Binary", (Base64BinaryType) type, false);
        composeBase64BinaryExtras(prefix + "Base64Binary", (Base64BinaryType) type, false);
    } else if (type instanceof TimeType) {
        composeTimeCore(prefix + "Time", (TimeType) type, false);
        composeTimeExtras(prefix + "Time", (TimeType) type, false);
    } else if (type instanceof StringType) {
        composeStringCore(prefix + "String", (StringType) type, false);
        composeStringExtras(prefix + "String", (StringType) type, false);
    } else if (type instanceof BooleanType) {
        composeBooleanCore(prefix + "Boolean", (BooleanType) type, false);
        composeBooleanExtras(prefix + "Boolean", (BooleanType) type, false);
    } else if (type instanceof InstantType) {
        composeInstantCore(prefix + "Instant", (InstantType) type, false);
        composeInstantExtras(prefix + "Instant", (InstantType) type, false);
    } else
        throw new Error("Unhandled type");
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Example 5 with Base64BinaryType

use of org.hl7.fhir.r4b.model.Base64BinaryType in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeBase64Binary.

protected void composeBase64Binary(Complex parent, String parentType, String name, Base64BinaryType value, int index) {
    if (value == null)
        return;
    Complex t = parent.predicate("fhir:" + parentType + "." + name);
    t.predicate("fhir:value", ttlLiteral(value.asStringValue()));
    composeElement(t, parentType, name, value, index);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Aggregations

NotImplementedException (org.apache.commons.lang3.NotImplementedException)8 Base64BinaryType (org.hl7.fhir.r4b.model.Base64BinaryType)7 Base64 (org.apache.commons.codec.binary.Base64)6 Base64BinaryType (org.hl7.fhir.r4.model.Base64BinaryType)5 DisplayName (org.junit.jupiter.api.DisplayName)5 Test (org.junit.jupiter.api.Test)5 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)3 StringParameter (com.ibm.cohort.cql.evaluation.parameters.StringParameter)2 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)2 DecimalType (org.hl7.fhir.r4.model.DecimalType)2 Address (org.hl7.fhir.r4b.model.Address)2 Annotation (org.hl7.fhir.r4b.model.Annotation)2 Attachment (org.hl7.fhir.r4b.model.Attachment)2 Base (org.hl7.fhir.r4b.model.Base)2 BooleanType (org.hl7.fhir.r4b.model.BooleanType)2 CodeType (org.hl7.fhir.r4b.model.CodeType)2 CodeableConcept (org.hl7.fhir.r4b.model.CodeableConcept)2 CodeableReference (org.hl7.fhir.r4b.model.CodeableReference)2 Coding (org.hl7.fhir.r4b.model.Coding)2 ContactDetail (org.hl7.fhir.r4b.model.ContactDetail)2