Search in sources :

Example 51 with Quantity

use of org.hl7.fhir.dstu2.model.Quantity in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeActivityDefinition.

protected void composeActivityDefinition(Complex parent, String parentType, String name, ActivityDefinition element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "ActivityDefinition", name, element, index);
    if (element.hasUrlElement())
        composeUri(t, "ActivityDefinition", "url", element.getUrlElement(), -1);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ActivityDefinition", "identifier", element.getIdentifier().get(i), i);
    if (element.hasVersionElement())
        composeString(t, "ActivityDefinition", "version", element.getVersionElement(), -1);
    if (element.hasNameElement())
        composeString(t, "ActivityDefinition", "name", element.getNameElement(), -1);
    if (element.hasTitleElement())
        composeString(t, "ActivityDefinition", "title", element.getTitleElement(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "ActivityDefinition", "status", element.getStatusElement(), -1);
    if (element.hasExperimentalElement())
        composeBoolean(t, "ActivityDefinition", "experimental", element.getExperimentalElement(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "ActivityDefinition", "date", element.getDateElement(), -1);
    if (element.hasPublisherElement())
        composeString(t, "ActivityDefinition", "publisher", element.getPublisherElement(), -1);
    if (element.hasDescriptionElement())
        composeMarkdown(t, "ActivityDefinition", "description", element.getDescriptionElement(), -1);
    if (element.hasPurposeElement())
        composeMarkdown(t, "ActivityDefinition", "purpose", element.getPurposeElement(), -1);
    if (element.hasUsageElement())
        composeString(t, "ActivityDefinition", "usage", element.getUsageElement(), -1);
    if (element.hasApprovalDateElement())
        composeDate(t, "ActivityDefinition", "approvalDate", element.getApprovalDateElement(), -1);
    if (element.hasLastReviewDateElement())
        composeDate(t, "ActivityDefinition", "lastReviewDate", element.getLastReviewDateElement(), -1);
    if (element.hasEffectivePeriod())
        composePeriod(t, "ActivityDefinition", "effectivePeriod", element.getEffectivePeriod(), -1);
    for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "ActivityDefinition", "useContext", element.getUseContext().get(i), i);
    for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "ActivityDefinition", "jurisdiction", element.getJurisdiction().get(i), i);
    for (int i = 0; i < element.getTopic().size(); i++) composeCodeableConcept(t, "ActivityDefinition", "topic", element.getTopic().get(i), i);
    for (int i = 0; i < element.getContributor().size(); i++) composeContributor(t, "ActivityDefinition", "contributor", element.getContributor().get(i), i);
    for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "ActivityDefinition", "contact", element.getContact().get(i), i);
    if (element.hasCopyrightElement())
        composeMarkdown(t, "ActivityDefinition", "copyright", element.getCopyrightElement(), -1);
    for (int i = 0; i < element.getRelatedArtifact().size(); i++) composeRelatedArtifact(t, "ActivityDefinition", "relatedArtifact", element.getRelatedArtifact().get(i), i);
    for (int i = 0; i < element.getLibrary().size(); i++) composeReference(t, "ActivityDefinition", "library", element.getLibrary().get(i), i);
    if (element.hasKindElement())
        composeEnum(t, "ActivityDefinition", "kind", element.getKindElement(), -1);
    if (element.hasCode())
        composeCodeableConcept(t, "ActivityDefinition", "code", element.getCode(), -1);
    if (element.hasTiming())
        composeType(t, "ActivityDefinition", "timing", element.getTiming(), -1);
    if (element.hasLocation())
        composeReference(t, "ActivityDefinition", "location", element.getLocation(), -1);
    for (int i = 0; i < element.getParticipant().size(); i++) composeActivityDefinitionActivityDefinitionParticipantComponent(t, "ActivityDefinition", "participant", element.getParticipant().get(i), i);
    if (element.hasProduct())
        composeType(t, "ActivityDefinition", "product", element.getProduct(), -1);
    if (element.hasQuantity())
        composeQuantity(t, "ActivityDefinition", "quantity", element.getQuantity(), -1);
    for (int i = 0; i < element.getDosage().size(); i++) composeDosage(t, "ActivityDefinition", "dosage", element.getDosage().get(i), i);
    for (int i = 0; i < element.getBodySite().size(); i++) composeCodeableConcept(t, "ActivityDefinition", "bodySite", element.getBodySite().get(i), i);
    if (element.hasTransform())
        composeReference(t, "ActivityDefinition", "transform", element.getTransform(), -1);
    for (int i = 0; i < element.getDynamicValue().size(); i++) composeActivityDefinitionActivityDefinitionDynamicValueComponent(t, "ActivityDefinition", "dynamicValue", element.getDynamicValue().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 52 with Quantity

use of org.hl7.fhir.dstu2.model.Quantity in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeContractTermValuedItemComponent.

protected void composeContractTermValuedItemComponent(Complex parent, String parentType, String name, Contract.TermValuedItemComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "valuedItem", name, element, index);
    if (element.hasEntity())
        composeType(t, "Contract", "entity", element.getEntity(), -1);
    if (element.hasIdentifier())
        composeIdentifier(t, "Contract", "identifier", element.getIdentifier(), -1);
    if (element.hasEffectiveTimeElement())
        composeDateTime(t, "Contract", "effectiveTime", element.getEffectiveTimeElement(), -1);
    if (element.hasQuantity())
        composeQuantity(t, "Contract", "quantity", element.getQuantity(), -1);
    if (element.hasUnitPrice())
        composeMoney(t, "Contract", "unitPrice", element.getUnitPrice(), -1);
    if (element.hasFactorElement())
        composeDecimal(t, "Contract", "factor", element.getFactorElement(), -1);
    if (element.hasPointsElement())
        composeDecimal(t, "Contract", "points", element.getPointsElement(), -1);
    if (element.hasNet())
        composeMoney(t, "Contract", "net", element.getNet(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 53 with Quantity

use of org.hl7.fhir.dstu2.model.Quantity in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeClaimSubDetailComponent.

protected void composeClaimSubDetailComponent(Complex parent, String parentType, String name, Claim.SubDetailComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "subDetail", name, element, index);
    if (element.hasSequenceElement())
        composePositiveInt(t, "Claim", "sequence", element.getSequenceElement(), -1);
    if (element.hasRevenue())
        composeCodeableConcept(t, "Claim", "revenue", element.getRevenue(), -1);
    if (element.hasCategory())
        composeCodeableConcept(t, "Claim", "category", element.getCategory(), -1);
    if (element.hasService())
        composeCodeableConcept(t, "Claim", "service", element.getService(), -1);
    for (int i = 0; i < element.getModifier().size(); i++) composeCodeableConcept(t, "Claim", "modifier", element.getModifier().get(i), i);
    for (int i = 0; i < element.getProgramCode().size(); i++) composeCodeableConcept(t, "Claim", "programCode", element.getProgramCode().get(i), i);
    if (element.hasQuantity())
        composeQuantity(t, "Claim", "quantity", element.getQuantity(), -1);
    if (element.hasUnitPrice())
        composeMoney(t, "Claim", "unitPrice", element.getUnitPrice(), -1);
    if (element.hasFactorElement())
        composeDecimal(t, "Claim", "factor", element.getFactorElement(), -1);
    if (element.hasNet())
        composeMoney(t, "Claim", "net", element.getNet(), -1);
    for (int i = 0; i < element.getUdi().size(); i++) composeReference(t, "Claim", "udi", element.getUdi().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 54 with Quantity

use of org.hl7.fhir.dstu2.model.Quantity 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 55 with Quantity

use of org.hl7.fhir.dstu2.model.Quantity in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeSequence.

protected void composeSequence(Complex parent, String parentType, String name, Sequence element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Sequence", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Sequence", "identifier", element.getIdentifier().get(i), i);
    if (element.hasTypeElement())
        composeEnum(t, "Sequence", "type", element.getTypeElement(), -1);
    if (element.hasCoordinateSystemElement())
        composeInteger(t, "Sequence", "coordinateSystem", element.getCoordinateSystemElement(), -1);
    if (element.hasPatient())
        composeReference(t, "Sequence", "patient", element.getPatient(), -1);
    if (element.hasSpecimen())
        composeReference(t, "Sequence", "specimen", element.getSpecimen(), -1);
    if (element.hasDevice())
        composeReference(t, "Sequence", "device", element.getDevice(), -1);
    if (element.hasPerformer())
        composeReference(t, "Sequence", "performer", element.getPerformer(), -1);
    if (element.hasQuantity())
        composeQuantity(t, "Sequence", "quantity", element.getQuantity(), -1);
    if (element.hasReferenceSeq())
        composeSequenceSequenceReferenceSeqComponent(t, "Sequence", "referenceSeq", element.getReferenceSeq(), -1);
    for (int i = 0; i < element.getVariant().size(); i++) composeSequenceSequenceVariantComponent(t, "Sequence", "variant", element.getVariant().get(i), i);
    if (element.hasObservedSeqElement())
        composeString(t, "Sequence", "observedSeq", element.getObservedSeqElement(), -1);
    for (int i = 0; i < element.getQuality().size(); i++) composeSequenceSequenceQualityComponent(t, "Sequence", "quality", element.getQuality().get(i), i);
    if (element.hasReadCoverageElement())
        composeInteger(t, "Sequence", "readCoverage", element.getReadCoverageElement(), -1);
    for (int i = 0; i < element.getRepository().size(); i++) composeSequenceSequenceRepositoryComponent(t, "Sequence", "repository", element.getRepository().get(i), i);
    for (int i = 0; i < element.getPointer().size(); i++) composeReference(t, "Sequence", "pointer", element.getPointer().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Aggregations

Quantity (org.hl7.fhir.r4.model.Quantity)58 ArrayList (java.util.ArrayList)47 Test (org.junit.jupiter.api.Test)40 BigDecimal (java.math.BigDecimal)39 Quantity (org.hl7.fhir.dstu3.model.Quantity)39 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)37 Test (org.junit.Test)25 List (java.util.List)24 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)23 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)23 NotImplementedException (org.apache.commons.lang3.NotImplementedException)19 FHIRException (org.hl7.fhir.exceptions.FHIRException)18 PathEngineException (org.hl7.fhir.exceptions.PathEngineException)18 Observation (org.hl7.fhir.r4.model.Observation)18 UcumException (org.fhir.ucum.UcumException)16 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)16 Resource (org.hl7.fhir.r4.model.Resource)16 Quantity (org.hl7.fhir.r5.model.Quantity)16 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)15 Coding (org.hl7.fhir.r4.model.Coding)13