Search in sources :

Example 11 with UrlType

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

the class RdfParser method composeUrl.

protected void composeUrl(Complex parent, String parentType, String name, UrlType 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.r4.utils.formats.Turtle.Complex)

Example 12 with UrlType

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

the class JsonParser method composeType.

protected void composeType(String prefix, DataType type) throws IOException {
    if (type == null) {
        ;
    } else if (type instanceof Address) {
        composeAddress(prefix + "Address", (Address) type);
    } else if (type instanceof Age) {
        composeAge(prefix + "Age", (Age) type);
    } else if (type instanceof Annotation) {
        composeAnnotation(prefix + "Annotation", (Annotation) type);
    } else if (type instanceof Attachment) {
        composeAttachment(prefix + "Attachment", (Attachment) type);
    } else if (type instanceof CodeableConcept) {
        composeCodeableConcept(prefix + "CodeableConcept", (CodeableConcept) type);
    } else if (type instanceof CodeableReference) {
        composeCodeableReference(prefix + "CodeableReference", (CodeableReference) type);
    } else if (type instanceof Coding) {
        composeCoding(prefix + "Coding", (Coding) type);
    } else if (type instanceof ContactDetail) {
        composeContactDetail(prefix + "ContactDetail", (ContactDetail) type);
    } else if (type instanceof ContactPoint) {
        composeContactPoint(prefix + "ContactPoint", (ContactPoint) type);
    } else if (type instanceof Contributor) {
        composeContributor(prefix + "Contributor", (Contributor) type);
    } else if (type instanceof Count) {
        composeCount(prefix + "Count", (Count) type);
    } else if (type instanceof DataRequirement) {
        composeDataRequirement(prefix + "DataRequirement", (DataRequirement) type);
    } else if (type instanceof Distance) {
        composeDistance(prefix + "Distance", (Distance) type);
    } else if (type instanceof Dosage) {
        composeDosage(prefix + "Dosage", (Dosage) type);
    } else if (type instanceof Duration) {
        composeDuration(prefix + "Duration", (Duration) type);
    } else if (type instanceof ElementDefinition) {
        composeElementDefinition(prefix + "ElementDefinition", (ElementDefinition) type);
    } else if (type instanceof Expression) {
        composeExpression(prefix + "Expression", (Expression) type);
    } else if (type instanceof Extension) {
        composeExtension(prefix + "Extension", (Extension) type);
    } else if (type instanceof HumanName) {
        composeHumanName(prefix + "HumanName", (HumanName) type);
    } else if (type instanceof Identifier) {
        composeIdentifier(prefix + "Identifier", (Identifier) type);
    } else if (type instanceof MarketingStatus) {
        composeMarketingStatus(prefix + "MarketingStatus", (MarketingStatus) type);
    } else if (type instanceof Meta) {
        composeMeta(prefix + "Meta", (Meta) type);
    } else if (type instanceof Money) {
        composeMoney(prefix + "Money", (Money) type);
    } else if (type instanceof Narrative) {
        composeNarrative(prefix + "Narrative", (Narrative) type);
    } else if (type instanceof ParameterDefinition) {
        composeParameterDefinition(prefix + "ParameterDefinition", (ParameterDefinition) type);
    } else if (type instanceof Period) {
        composePeriod(prefix + "Period", (Period) type);
    } else if (type instanceof Population) {
        composePopulation(prefix + "Population", (Population) type);
    } else if (type instanceof ProdCharacteristic) {
        composeProdCharacteristic(prefix + "ProdCharacteristic", (ProdCharacteristic) type);
    } else if (type instanceof ProductShelfLife) {
        composeProductShelfLife(prefix + "ProductShelfLife", (ProductShelfLife) type);
    } else if (type instanceof Quantity) {
        composeQuantity(prefix + "Quantity", (Quantity) type);
    } else if (type instanceof Range) {
        composeRange(prefix + "Range", (Range) type);
    } else if (type instanceof Ratio) {
        composeRatio(prefix + "Ratio", (Ratio) type);
    } else if (type instanceof RatioRange) {
        composeRatioRange(prefix + "RatioRange", (RatioRange) type);
    } else if (type instanceof Reference) {
        composeReference(prefix + "Reference", (Reference) type);
    } else if (type instanceof RelatedArtifact) {
        composeRelatedArtifact(prefix + "RelatedArtifact", (RelatedArtifact) type);
    } else if (type instanceof SampledData) {
        composeSampledData(prefix + "SampledData", (SampledData) type);
    } else if (type instanceof Signature) {
        composeSignature(prefix + "Signature", (Signature) type);
    } else if (type instanceof Timing) {
        composeTiming(prefix + "Timing", (Timing) type);
    } else if (type instanceof TriggerDefinition) {
        composeTriggerDefinition(prefix + "TriggerDefinition", (TriggerDefinition) type);
    } else if (type instanceof UsageContext) {
        composeUsageContext(prefix + "UsageContext", (UsageContext) type);
    } else if (type instanceof CodeType) {
        composeCodeCore(prefix + "Code", (CodeType) type, false);
        composeCodeExtras(prefix + "Code", (CodeType) type, false);
    } else if (type instanceof OidType) {
        composeOidCore(prefix + "Oid", (OidType) type, false);
        composeOidExtras(prefix + "Oid", (OidType) type, false);
    } else if (type instanceof CanonicalType) {
        composeCanonicalCore(prefix + "Canonical", (CanonicalType) type, false);
        composeCanonicalExtras(prefix + "Canonical", (CanonicalType) type, false);
    } else if (type instanceof UuidType) {
        composeUuidCore(prefix + "Uuid", (UuidType) type, false);
        composeUuidExtras(prefix + "Uuid", (UuidType) type, false);
    } else if (type instanceof UrlType) {
        composeUrlCore(prefix + "Url", (UrlType) type, false);
        composeUrlExtras(prefix + "Url", (UrlType) type, false);
    } else if (type instanceof UnsignedIntType) {
        composeUnsignedIntCore(prefix + "UnsignedInt", (UnsignedIntType) type, false);
        composeUnsignedIntExtras(prefix + "UnsignedInt", (UnsignedIntType) type, false);
    } else if (type instanceof MarkdownType) {
        composeMarkdownCore(prefix + "Markdown", (MarkdownType) type, false);
        composeMarkdownExtras(prefix + "Markdown", (MarkdownType) type, false);
    } else if (type instanceof IdType) {
        composeIdCore(prefix + "Id", (IdType) type, false);
        composeIdExtras(prefix + "Id", (IdType) type, false);
    } else if (type instanceof PositiveIntType) {
        composePositiveIntCore(prefix + "PositiveInt", (PositiveIntType) type, false);
        composePositiveIntExtras(prefix + "PositiveInt", (PositiveIntType) type, false);
    } else if (type instanceof DateType) {
        composeDateCore(prefix + "Date", (DateType) type, false);
        composeDateExtras(prefix + "Date", (DateType) type, false);
    } else if (type instanceof DateTimeType) {
        composeDateTimeCore(prefix + "DateTime", (DateTimeType) type, false);
        composeDateTimeExtras(prefix + "DateTime", (DateTimeType) type, false);
    } else if (type instanceof StringType) {
        composeStringCore(prefix + "String", (StringType) type, false);
        composeStringExtras(prefix + "String", (StringType) type, false);
    } else if (type instanceof IntegerType) {
        composeIntegerCore(prefix + "Integer", (IntegerType) type, false);
        composeIntegerExtras(prefix + "Integer", (IntegerType) type, false);
    } else if (type instanceof Integer64Type) {
        composeInteger64Core(prefix + "Integer64", (Integer64Type) type, false);
        composeInteger64Extras(prefix + "Integer64", (Integer64Type) type, false);
    } else if (type instanceof UriType) {
        composeUriCore(prefix + "Uri", (UriType) type, false);
        composeUriExtras(prefix + "Uri", (UriType) type, false);
    } else if (type instanceof InstantType) {
        composeInstantCore(prefix + "Instant", (InstantType) type, false);
        composeInstantExtras(prefix + "Instant", (InstantType) type, false);
    } else if (type instanceof BooleanType) {
        composeBooleanCore(prefix + "Boolean", (BooleanType) type, false);
        composeBooleanExtras(prefix + "Boolean", (BooleanType) 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 DecimalType) {
        composeDecimalCore(prefix + "Decimal", (DecimalType) type, false);
        composeDecimalExtras(prefix + "Decimal", (DecimalType) type, false);
    } else
        throw new Error("Unhandled type");
}
Also used : FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError)

Example 13 with UrlType

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

the class MappingSheetParser method getConceptMap.

public ConceptMap getConceptMap() throws FHIRException {
    ConceptMap map = new ConceptMap();
    loadMetadata(map);
    if (metadata.containsKey("copyright"))
        map.setCopyright(metadata.get("copyright"));
    for (MappingRow row : rows) {
        SourceElementComponent element = map.getGroupFirstRep().addElement();
        element.setCode(row.getIdentifier());
        element.setId(row.getSequence());
        element.setDisplay(row.getName() + " : " + row.getDataType() + " [" + row.getCardinality() + "]");
        element.addExtension(ToolingExtensions.EXT_MAPPING_NAME, new StringType(row.getName()));
        element.addExtension(ToolingExtensions.EXT_MAPPING_TYPE, new StringType(row.getDataType()));
        element.addExtension(ToolingExtensions.EXT_MAPPING_CARD, new StringType(row.getCardinality()));
        if ("N/A".equals(row.getAttribute()))
            element.addTarget().setEquivalence(ConceptMapEquivalence.UNMATCHED);
        else {
            element.getTargetFirstRep().setEquivalence(ConceptMapEquivalence.RELATEDTO);
            if (row.getCondition() != null)
                element.getTargetFirstRep().addDependsOn().setProperty("http://hl7.org/fhirpath").setValue(processCondition(row.getCondition()));
            element.getTargetFirstRep().setCode(row.getAttribute());
            element.getTargetFirstRep().setDisplay(row.getType() + " : [" + row.getMinMax() + "]");
            element.getTargetFirstRep().addExtension(ToolingExtensions.EXT_MAPPING_TGTTYPE, new StringType(row.getType()));
            element.getTargetFirstRep().addExtension(ToolingExtensions.EXT_MAPPING_TGTCARD, new StringType(row.getMinMax()));
            if (row.getDerived() != null)
                element.getTargetFirstRep().getProductFirstRep().setProperty(row.getDerived()).setValue(row.getDerivedMapping());
            if (row.getComments() != null)
                element.getTargetFirstRep().setComment(row.getComments());
            if (row.getDtMapping() != null)
                element.getTargetFirstRep().addExtension("http://hl7.org/fhir/StructureDefinition/ConceptMap-type-mapping", new UrlType("todo#" + row.getDtMapping()));
            if (row.getVocabMapping() != null)
                element.getTargetFirstRep().addExtension("http://hl7.org/fhir/StructureDefinition/ConceptMap-vocab-mapping", new UrlType("todo#" + row.getVocabMapping()));
        }
    }
    return map;
}
Also used : StringType(org.hl7.fhir.r4b.model.StringType) ConceptMap(org.hl7.fhir.r4b.model.ConceptMap) UrlType(org.hl7.fhir.r4b.model.UrlType) SourceElementComponent(org.hl7.fhir.r4b.model.ConceptMap.SourceElementComponent)

Example 14 with UrlType

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

the class MappingSheetParser method getConceptMap.

public ConceptMap getConceptMap() throws FHIRException {
    ConceptMap map = new ConceptMap();
    loadMetadata(map);
    if (metadata.containsKey("copyright"))
        map.setCopyright(metadata.get("copyright"));
    for (MappingRow row : rows) {
        SourceElementComponent element = map.getGroupFirstRep().addElement();
        element.setCode(row.getIdentifier());
        element.setId(row.getSequence());
        element.setDisplay(row.getName() + " : " + row.getDataType() + " [" + row.getCardinality() + "]");
        element.addExtension(ToolingExtensions.EXT_MAPPING_NAME, new StringType(row.getName()));
        element.addExtension(ToolingExtensions.EXT_MAPPING_TYPE, new StringType(row.getDataType()));
        element.addExtension(ToolingExtensions.EXT_MAPPING_CARD, new StringType(row.getCardinality()));
        if ("N/A".equals(row.getAttribute()))
            element.setNoMap(true);
        else {
            element.getTargetFirstRep().setRelationship(ConceptMapRelationship.RELATEDTO);
            if (row.getCondition() != null)
                element.getTargetFirstRep().addDependsOn().setProperty("http://hl7.org/fhirpath").setValue(processCondition(row.getCondition()));
            element.getTargetFirstRep().setCode(row.getAttribute());
            element.getTargetFirstRep().setDisplay(row.getType() + " : [" + row.getMinMax() + "]");
            element.getTargetFirstRep().addExtension(ToolingExtensions.EXT_MAPPING_TGTTYPE, new StringType(row.getType()));
            element.getTargetFirstRep().addExtension(ToolingExtensions.EXT_MAPPING_TGTCARD, new StringType(row.getMinMax()));
            if (row.getDerived() != null)
                element.getTargetFirstRep().getProductFirstRep().setProperty(row.getDerived()).setValue(row.getDerivedMapping());
            if (row.getComments() != null)
                element.getTargetFirstRep().setComment(row.getComments());
            if (row.getDtMapping() != null)
                element.getTargetFirstRep().addExtension("http://hl7.org/fhir/StructureDefinition/ConceptMap-type-mapping", new UrlType("todo#" + row.getDtMapping()));
            if (row.getVocabMapping() != null)
                element.getTargetFirstRep().addExtension("http://hl7.org/fhir/StructureDefinition/ConceptMap-vocab-mapping", new UrlType("todo#" + row.getVocabMapping()));
        }
    }
    return map;
}
Also used : StringType(org.hl7.fhir.r5.model.StringType) ConceptMap(org.hl7.fhir.r5.model.ConceptMap) UrlType(org.hl7.fhir.r5.model.UrlType) SourceElementComponent(org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent)

Example 15 with UrlType

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

the class UrlTypeNullTest method testToString.

@Test
@DisplayName("Test null value toString()")
void testToString() {
    UrlType nullUrl = new UrlType();
    System.out.println("Value -> " + nullUrl);
}
Also used : UrlType(org.hl7.fhir.r4b.model.UrlType) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

UrlType (org.hl7.fhir.r4b.model.UrlType)6 Test (org.junit.jupiter.api.Test)6 Parameters (org.hl7.fhir.r4.model.Parameters)5 UrlType (org.hl7.fhir.r4.model.UrlType)5 DisplayName (org.junit.jupiter.api.DisplayName)5 ParametersParameterComponent (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent)4 Nonnull (javax.annotation.Nonnull)3 CodeType (org.hl7.fhir.r4.model.CodeType)3 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Slf4j (lombok.extern.slf4j.Slf4j)2 SparkSession (org.apache.spark.sql.SparkSession)2 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)2 StringType (org.hl7.fhir.r5.model.StringType)2 UrlType (org.hl7.fhir.r5.model.UrlType)2 FhirEncoders (au.csiro.pathling.encoders.FhirEncoders)1 UnsupportedResourceError (au.csiro.pathling.encoders.UnsupportedResourceError)1 InvalidUserInputError (au.csiro.pathling.errors.InvalidUserInputError)1 SecurityError (au.csiro.pathling.errors.SecurityError)1 FhirContextFactory (au.csiro.pathling.fhir.FhirContextFactory)1