Search in sources :

Example 11 with ConceptPropertyComponent

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

the class CodeSystemUtilities method setStatus.

public static void setStatus(CodeSystem cs, ConceptDefinitionComponent concept, ConceptStatus status) throws FHIRFormatError {
    defineStatusProperty(cs);
    ConceptPropertyComponent p = getProperty(concept, "status");
    if (p != null)
        p.setValue(new CodeType(status.toCode()));
    else
        concept.addProperty().setCode("status").setValue(new CodeType(status.toCode()));
}
Also used : ConceptPropertyComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent) CodeType(org.hl7.fhir.r4.model.CodeType)

Example 12 with ConceptPropertyComponent

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

the class CodeSystemUtilities method crossLinkConcepts.

private static void crossLinkConcepts(List<ConceptDefinitionComponent> root, List<ConceptDefinitionComponent> focus, String parent) {
    for (ConceptDefinitionComponent def : focus) {
        List<ConceptPropertyComponent> pcl = getPropertyValues(def, parent);
        for (ConceptPropertyComponent pc : pcl) {
            String code = pc.getValue().primitiveValue();
            ConceptDefinitionComponent tgt = findCode(root, code);
            if (!tgt.hasUserData(USER_DATA_CROSS_LINK)) {
                tgt.setUserData(USER_DATA_CROSS_LINK, new ArrayList<>());
            }
            @SuppressWarnings("unchecked") List<ConceptDefinitionComponent> children = (List<ConceptDefinitionComponent>) tgt.getUserData(USER_DATA_CROSS_LINK);
            children.add(def);
        }
        if (def.hasConcept()) {
            crossLinkConcepts(root, def.getConcept(), parent);
        }
    }
}
Also used : ConceptPropertyComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent) ConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent) ArrayList(java.util.ArrayList) List(java.util.List)

Example 13 with ConceptPropertyComponent

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

the class CodeSystemComparer method mergeProps.

private void mergeProps(ConceptDefinitionComponent cd, ConceptDefinitionComponent l, ConceptDefinitionComponent r, List<PropertyComponent> destProps, CodeSystemComparison res) {
    List<ConceptPropertyComponent> matchR = new ArrayList<>();
    for (ConceptPropertyComponent lp : l.getProperty()) {
        ConceptPropertyComponent rp = findRightProp(r.getProperty(), lp, res);
        if (rp == null) {
            cd.getProperty().add(lp);
        } else {
            matchR.add(rp);
            cd.getProperty().add(lp);
            if (lp.getValue().equalsDeep(rp.getValue())) {
                cd.getProperty().add(rp.setCode(res.getPropMap().get(rp.getCode())));
            }
        }
    }
    for (ConceptPropertyComponent rp : r.getProperty()) {
        if (!matchR.contains(rp)) {
            cd.getProperty().add(rp.setCode(res.getPropMap().get(rp.getCode())));
        }
    }
}
Also used : ConceptPropertyComponent(org.hl7.fhir.r4b.model.CodeSystem.ConceptPropertyComponent) ArrayList(java.util.ArrayList)

Example 14 with ConceptPropertyComponent

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

the class CodeSystemUtilities method setNotSelectable.

public static void setNotSelectable(CodeSystem cs, ConceptDefinitionComponent concept) throws FHIRFormatError {
    defineNotSelectableProperty(cs);
    ConceptPropertyComponent p = getProperty(concept, "notSelectable");
    if (p != null)
        p.setValue(new BooleanType(true));
    else
        concept.addProperty().setCode("notSelectable").setValue(new BooleanType(true));
}
Also used : ConceptPropertyComponent(org.hl7.fhir.r4b.model.CodeSystem.ConceptPropertyComponent) BooleanType(org.hl7.fhir.r4b.model.BooleanType)

Example 15 with ConceptPropertyComponent

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

the class CodeSystemUtilities method crossLinkConcepts.

private static void crossLinkConcepts(List<ConceptDefinitionComponent> root, List<ConceptDefinitionComponent> focus, String parent) {
    for (ConceptDefinitionComponent def : focus) {
        List<ConceptPropertyComponent> pcl = getPropertyValues(def, parent);
        for (ConceptPropertyComponent pc : pcl) {
            String code = pc.getValue().primitiveValue();
            ConceptDefinitionComponent tgt = findCode(root, code);
            if (!tgt.hasUserData(USER_DATA_CROSS_LINK)) {
                tgt.setUserData(USER_DATA_CROSS_LINK, new ArrayList<>());
            }
            @SuppressWarnings("unchecked") List<ConceptDefinitionComponent> children = (List<ConceptDefinitionComponent>) tgt.getUserData(USER_DATA_CROSS_LINK);
            children.add(def);
        }
        if (def.hasConcept()) {
            crossLinkConcepts(root, def.getConcept(), parent);
        }
    }
}
Also used : ConceptPropertyComponent(org.hl7.fhir.r4b.model.CodeSystem.ConceptPropertyComponent) ConceptDefinitionComponent(org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ConceptPropertyComponent (org.hl7.fhir.r4b.model.CodeSystem.ConceptPropertyComponent)8 ConceptPropertyComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent)8 ArrayList (java.util.ArrayList)4 ConceptPropertyComponent (org.hl7.fhir.r4.model.CodeSystem.ConceptPropertyComponent)3 ConceptDefinitionComponent (org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent)3 ConceptDefinitionComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent)3 List (java.util.List)2 PropertyComponent (org.hl7.fhir.r4b.model.CodeSystem.PropertyComponent)2 PropertyComponent (org.hl7.fhir.r5.model.CodeSystem.PropertyComponent)2 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)2 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)2 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)2 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1 BooleanType (org.hl7.fhir.r4.model.BooleanType)1 CodeType (org.hl7.fhir.r4.model.CodeType)1 BooleanType (org.hl7.fhir.r4b.model.BooleanType)1 CodeSystem (org.hl7.fhir.r4b.model.CodeSystem)1 ConceptDefinitionDesignationComponent (org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent)1 CodeType (org.hl7.fhir.r4b.model.CodeType)1