Search in sources :

Example 41 with ValueSetExpansionContainsComponent

use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.

the class ValueSetExpanderSimple method addCodeAndDescendents.

private void addCodeAndDescendents(CodeSystem cs, String system, ConceptDefinitionComponent def, ValueSetExpansionContainsComponent parent, Parameters expParams, List<ValueSet> filters, ConceptDefinitionComponent exclusion, IConceptFilter filterFunc) throws FHIRException {
    def.checkNoModifiers("Code in Code System", "expanding");
    if (exclusion != null) {
        if (exclusion.getCode().equals(def.getCode()))
            // excluded.
            return;
    }
    if (!CodeSystemUtilities.isDeprecated(cs, def, false)) {
        ValueSetExpansionContainsComponent np = null;
        boolean abs = CodeSystemUtilities.isNotSelectable(cs, def);
        boolean inc = CodeSystemUtilities.isInactive(cs, def);
        if ((includeAbstract || !abs) && filterFunc.includeConcept(cs, def)) {
            np = addCode(system, def.getCode(), def.getDisplay(), parent, def.getDesignation(), expParams, abs, inc, filters);
        }
        for (ConceptDefinitionComponent c : def.getConcept()) {
            addCodeAndDescendents(cs, system, c, np, expParams, filters, exclusion, filterFunc);
        }
        if (def.hasUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK)) {
            List<ConceptDefinitionComponent> children = (List<ConceptDefinitionComponent>) def.getUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK);
            for (ConceptDefinitionComponent c : children) addCodeAndDescendents(cs, system, c, np, expParams, filters, exclusion, filterFunc);
        }
    } else {
        for (ConceptDefinitionComponent c : def.getConcept()) {
            addCodeAndDescendents(cs, system, c, null, expParams, filters, exclusion, filterFunc);
        }
        if (def.hasUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK)) {
            List<ConceptDefinitionComponent> children = (List<ConceptDefinitionComponent>) def.getUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK);
            for (ConceptDefinitionComponent c : children) addCodeAndDescendents(cs, system, c, null, expParams, filters, exclusion, filterFunc);
        }
    }
}
Also used : ValueSetExpansionContainsComponent(org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent) ConceptDefinitionComponent(org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent) ArrayList(java.util.ArrayList) List(java.util.List)

Example 42 with ValueSetExpansionContainsComponent

use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.

the class ValueSetExpanderSimple method copyImportContains.

private void copyImportContains(List<ValueSetExpansionContainsComponent> list, ValueSetExpansionContainsComponent parent, Parameters expParams, List<ValueSet> filter) throws FHIRException {
    for (ValueSetExpansionContainsComponent c : list) {
        c.checkNoModifiers("Imported Expansion in Code System", "expanding");
        ValueSetExpansionContainsComponent np = addCode(c.getSystem(), c.getCode(), c.getDisplay(), parent, null, expParams, c.getAbstract(), c.getInactive(), filter);
        copyImportContains(c.getContains(), np, expParams, filter);
    }
}
Also used : ValueSetExpansionContainsComponent(org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent)

Example 43 with ValueSetExpansionContainsComponent

use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.

the class ValueSetExpanderSimple method doServerIncludeCodes.

private void doServerIncludeCodes(ConceptSetComponent inc, boolean heirarchical, ValueSetExpansionComponent exp, List<ValueSet> imports, Parameters expParams, List<Extension> extensions) throws FHIRException {
    ValueSetExpansionOutcome vso = context.expandVS(inc, heirarchical);
    if (vso.getError() != null) {
        throw failTSE("Unable to expand imported value set: " + vso.getError());
    }
    ValueSet vs = vso.getValueset();
    if (vs.hasVersion()) {
        if (!existsInParams(exp.getParameter(), "version", new UriType(vs.getUrl() + "|" + vs.getVersion()))) {
            exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("version").setValue(new UriType(vs.getUrl() + "|" + vs.getVersion())));
        }
    }
    for (ValueSetExpansionParameterComponent p : vso.getValueset().getExpansion().getParameter()) {
        if (!existsInParams(exp.getParameter(), p.getName(), p.getValue())) {
            exp.getParameter().add(p);
        }
    }
    for (Extension ex : vs.getExpansion().getExtension()) {
        if (Utilities.existsInList(ex.getUrl(), ToolingExtensions.EXT_EXP_TOOCOSTLY, "http://hl7.org/fhir/StructureDefinition/valueset-unclosed")) {
            if (!hasExtension(extensions, ex.getUrl())) {
                extensions.add(ex);
            }
        }
    }
    for (ValueSetExpansionContainsComponent cc : vs.getExpansion().getContains()) {
        addCodeAndDescendents(cc, null, expParams, imports);
    }
}
Also used : Extension(org.hl7.fhir.r4b.model.Extension) ValueSetExpansionContainsComponent(org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent) ValueSetExpansionParameterComponent(org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionParameterComponent) ValueSet(org.hl7.fhir.r4b.model.ValueSet) UriType(org.hl7.fhir.r4b.model.UriType)

Example 44 with ValueSetExpansionContainsComponent

use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.

the class ValueSetExpanderSimple method copyExpansion.

public void copyExpansion(List<ValueSetExpansionContainsComponent> list) {
    for (ValueSetExpansionContainsComponent cc : list) {
        ValueSetExpansionContainsComponent n = new ValueSet.ValueSetExpansionContainsComponent();
        n.setSystem(cc.getSystem());
        n.setCode(cc.getCode());
        n.setAbstract(cc.getAbstract());
        n.setInactive(cc.getInactive());
        n.setDisplay(cc.getDisplay());
        n.getDesignation().addAll(cc.getDesignation());
        String s = key(n);
        if (!map.containsKey(s) && !excludeKeys.contains(s)) {
            codes.add(n);
            map.put(s, n);
            total++;
        }
        copyExpansion(cc.getContains());
    }
}
Also used : ValueSetExpansionContainsComponent(org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent)

Example 45 with ValueSetExpansionContainsComponent

use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.

the class ValueSetRenderer method addDesignationRow.

private void addDesignationRow(ValueSetExpansionContainsComponent c, XhtmlNode t, List<String> langs, Map<String, String> designations) {
    XhtmlNode tr = t.tr();
    tr.td().addText(c.getCode());
    addDesignationsToRow(c, designations, tr);
    addLangaugesToRow(c, langs, tr);
    for (ValueSetExpansionContainsComponent cc : c.getContains()) {
        addDesignationRow(cc, t, langs, designations);
    }
}
Also used : ValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Aggregations

ValueSetExpansionContainsComponent (org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent)32 ValueSetExpansionContainsComponent (org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent)22 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)20 ValueSetExpansionContainsComponent (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent)17 ValueSet (org.hl7.fhir.r4.model.ValueSet)9 HashMap (java.util.HashMap)8 ValueSet (org.hl7.fhir.r5.model.ValueSet)8 ArrayList (java.util.ArrayList)7 ValueSetExpansionContainsComponent (org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionContainsComponent)7 ValueSetExpansionContainsComponent (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent)7 IOException (java.io.IOException)6 ValueSetExpansionContainsComponent (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent)6 ValueSetExpansionComponent (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent)6 ConceptDefinitionComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent)6 ValueSet (org.hl7.fhir.dstu2.model.ValueSet)5 TerminologyServiceException (org.hl7.fhir.exceptions.TerminologyServiceException)5 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)5 ValueSet (org.hl7.fhir.dstu2016may.model.ValueSet)4 ValueSet (org.hl7.fhir.r4b.model.ValueSet)4 FHIRException (org.hl7.fhir.exceptions.FHIRException)3