Search in sources :

Example 16 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project kindling by HL7.

the class PageProcessor method describeSlice.

private String describeSlice(String path, ElementDefinitionSlicingComponent slicing) {
    if (!slicing.hasDiscriminator())
        return "<li>There is a slice with no discriminator at " + path + "</li>\r\n";
    String s = "";
    if (slicing.getOrdered())
        s = "ordered";
    if (slicing.getRules() != SlicingRules.OPEN)
        s = Utilities.noString(s) ? slicing.getRules().getDisplay() : s + ", " + slicing.getRules().getDisplay();
    if (!Utilities.noString(s))
        s = " (" + s + ")";
    CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
    for (ElementDefinitionSlicingDiscriminatorComponent d : slicing.getDiscriminator()) b.append(d.getType().toCode() + ":" + d.getPath());
    if (slicing.getDiscriminator().size() == 1)
        return "<li>The element " + path + " is sliced based on the value of " + b.toString() + s + "</li>\r\n";
    else
        return "<li>The element " + path + " is sliced based on the values of " + b.toString() + s + "</li>\r\n";
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 17 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project org.hl7.fhir.core by hapifhir.

the class ProfileUtilities method summarizeSlicing.

private String summarizeSlicing(ElementDefinitionSlicingComponent slice) {
    StringBuilder b = new StringBuilder();
    boolean first = true;
    for (ElementDefinitionSlicingDiscriminatorComponent d : slice.getDiscriminator()) {
        if (first)
            first = false;
        else
            b.append(", ");
        b.append(d);
    }
    b.append("(");
    if (slice.hasOrdered())
        b.append(slice.getOrderedElement().asStringValue());
    b.append("/");
    if (slice.hasRules())
        b.append(slice.getRules().toCode());
    b.append(")");
    if (slice.hasDescription()) {
        b.append(" \"");
        b.append(slice.getDescription());
        b.append("\"");
    }
    return b.toString();
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 18 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project org.hl7.fhir.core by hapifhir.

the class ProfileUtilities method sliceSummary.

private String sliceSummary(ElementDefinition ed) {
    if (!ed.hasSlicing() && !ed.hasSliceName())
        return "";
    if (ed.hasSliceName())
        return " (slicename = " + ed.getSliceName() + ")";
    StringBuilder b = new StringBuilder();
    boolean first = true;
    for (ElementDefinitionSlicingDiscriminatorComponent d : ed.getSlicing().getDiscriminator()) {
        if (first)
            first = false;
        else
            b.append("|");
        b.append(d.getPath());
    }
    return " (slicing by " + b.toString() + ")";
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 19 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project org.hl7.fhir.core by hapifhir.

the class CSVWriter method itemList.

private String itemList(List l) {
    StringBuilder s = new StringBuilder();
    for (int i = 0; i < l.size(); i++) {
        Object o = l.get(i);
        String val = "";
        if (o instanceof StringType) {
            val = ((StringType) o).getValue();
        } else if (o instanceof UriType) {
            val = ((UriType) o).getValue();
        } else if (o instanceof IdType) {
            val = ((IdType) o).getValue();
        } else if (o instanceof Enumeration<?>) {
            val = o.toString();
        } else if (o instanceof TypeRefComponent) {
            TypeRefComponent t = (TypeRefComponent) o;
            val = t.getWorkingCode() + (t.getProfile() == null ? "" : " {" + t.getProfile() + "}") + (t.getTargetProfile() == null ? "" : " {" + t.getTargetProfile() + "}") + (t.getAggregation() == null || t.getAggregation().isEmpty() ? "" : " (" + itemList(t.getAggregation()) + ")");
        } else if (o instanceof Coding) {
            Coding t = (Coding) o;
            val = (t.getSystem() == null ? "" : t.getSystem()) + (t.getCode() == null ? "" : "#" + t.getCode()) + (t.getDisplay() == null ? "" : " (" + t.getDisplay() + ")");
        } else if (o instanceof ElementDefinitionConstraintComponent) {
            ElementDefinitionConstraintComponent c = (ElementDefinitionConstraintComponent) o;
            val = c.getKey() + ":" + c.getHuman() + " {" + c.getExpression() + "}";
        } else if (o instanceof ElementDefinitionSlicingDiscriminatorComponent) {
            ElementDefinitionSlicingDiscriminatorComponent c = (ElementDefinitionSlicingDiscriminatorComponent) o;
            val = c.getType().toCode() + ":" + c.getPath() + "}";
        } else {
            val = o.toString();
            val = val.substring(val.indexOf("[") + 1);
            val = val.substring(0, val.indexOf("]"));
        }
        s = s.append(val);
        if (i == 0)
            s.append("\n");
    }
    return s.toString();
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) StringType(org.hl7.fhir.r5.model.StringType) TypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent) Coding(org.hl7.fhir.r5.model.Coding) ElementDefinitionConstraintComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent) UriType(org.hl7.fhir.r5.model.UriType) IdType(org.hl7.fhir.r5.model.IdType)

Example 20 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project org.hl7.fhir.core by hapifhir.

the class XLSXWriter method itemList.

private String itemList(List l) {
    StringBuilder s = new StringBuilder();
    for (int i = 0; i < l.size(); i++) {
        Object o = l.get(i);
        String val = "";
        if (o instanceof StringType) {
            val = ((StringType) o).getValue();
        } else if (o instanceof UriType) {
            val = ((UriType) o).getValue();
        } else if (o instanceof IdType) {
            val = ((IdType) o).getValue();
        } else if (o instanceof Enumeration<?>) {
            val = o.toString();
        } else if (o instanceof TypeRefComponent) {
            TypeRefComponent t = (TypeRefComponent) o;
            val = t.getWorkingCode();
            if (val == null)
                val = "";
            if (val.startsWith("http://hl7.org/fhir/StructureDefinition/"))
                val = val.substring(40);
            if (t.hasTargetProfile())
                val = val + "(" + canonicalList(t.getTargetProfile()) + ")";
            if (t.hasProfile())
                val = val + " {" + canonicalList(t.getProfile()) + "}";
            if (t.hasAggregation())
                val = val + " <<" + aggList(t.getAggregation()) + ">>";
        } else if (o instanceof Coding) {
            Coding t = (Coding) o;
            val = (t.getSystem() == null ? "" : t.getSystem()) + (t.getCode() == null ? "" : "#" + t.getCode()) + (t.getDisplay() == null ? "" : " (" + t.getDisplay() + ")");
        } else if (o instanceof ElementDefinitionConstraintComponent) {
            ElementDefinitionConstraintComponent c = (ElementDefinitionConstraintComponent) o;
            val = c.getKey() + ":" + c.getHuman() + " {" + c.getExpression() + "}";
        } else if (o instanceof ElementDefinitionSlicingDiscriminatorComponent) {
            ElementDefinitionSlicingDiscriminatorComponent c = (ElementDefinitionSlicingDiscriminatorComponent) o;
            val = c.getType().toCode() + ":" + c.getPath() + "}";
        } else {
            val = o.toString();
            val = val.substring(val.indexOf("[") + 1);
            val = val.substring(0, val.indexOf("]"));
        }
        s = s.append(val);
        if (i == 0)
            s.append("\n");
    }
    return s.toString();
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) StringType(org.hl7.fhir.r4.model.StringType) TypeRefComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent) Coding(org.hl7.fhir.r4.model.Coding) ElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent) UriType(org.hl7.fhir.r4.model.UriType) IdType(org.hl7.fhir.r4.model.IdType)

Aggregations

CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)18 ElementDefinitionSlicingDiscriminatorComponent (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent)10 ElementDefinitionSlicingDiscriminatorComponent (org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent)5 ElementDefinitionSlicingDiscriminatorComponent (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent)4 ElementDefinitionSlicingDiscriminatorComponent (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent)3 Coding (org.hl7.fhir.r4b.model.Coding)3 ElementDefinitionConstraintComponent (org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionConstraintComponent)3 TypeRefComponent (org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent)3 IdType (org.hl7.fhir.r4b.model.IdType)3 StringType (org.hl7.fhir.r4b.model.StringType)3 UriType (org.hl7.fhir.r4b.model.UriType)3 Coding (org.hl7.fhir.r4.model.Coding)2 ElementDefinitionConstraintComponent (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent)2 TypeRefComponent (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent)2 IdType (org.hl7.fhir.r4.model.IdType)2 StringType (org.hl7.fhir.r4.model.StringType)2 UriType (org.hl7.fhir.r4.model.UriType)2 Coding (org.hl7.fhir.r5.model.Coding)2 ElementDefinitionConstraintComponent (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent)2 TypeRefComponent (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent)2