use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method genInclude.
private boolean genInclude(XhtmlNode ul, ConceptSetComponent inc, String type) {
boolean hasExtensions = false;
XhtmlNode li;
li = ul.addTag("li");
CodeSystem e = context.fetchCodeSystem(inc.getSystem());
if (inc.getConcept().size() == 0 && inc.getFilter().size() == 0) {
li.addText(type + " all codes defined in ");
addCsRef(inc, li, e);
} else {
if (inc.getConcept().size() > 0) {
li.addText(type + " these codes as defined in ");
addCsRef(inc, li, e);
XhtmlNode t = li.addTag("table");
boolean hasComments = false;
boolean hasDefinition = false;
for (ConceptReferenceComponent c : inc.getConcept()) {
hasComments = hasComments || ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_COMMENT);
hasDefinition = hasDefinition || ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_DEFINITION);
}
if (hasComments || hasDefinition)
hasExtensions = true;
addTableHeaderRowStandard(t, false, true, hasDefinition, hasComments, false);
for (ConceptReferenceComponent c : inc.getConcept()) {
XhtmlNode tr = t.addTag("tr");
tr.addTag("td").addText(c.getCode());
ConceptDefinitionComponent cc = getConceptForCode(e, c.getCode(), inc.getSystem());
XhtmlNode td = tr.addTag("td");
if (!Utilities.noString(c.getDisplay()))
td.addText(c.getDisplay());
else if (cc != null && !Utilities.noString(cc.getDisplay()))
td.addText(cc.getDisplay());
td = tr.addTag("td");
if (ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_DEFINITION))
smartAddText(td, ToolingExtensions.readStringExtension(c, ToolingExtensions.EXT_DEFINITION));
else if (cc != null && !Utilities.noString(cc.getDefinition()))
smartAddText(td, cc.getDefinition());
if (ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_COMMENT)) {
smartAddText(tr.addTag("td"), "Note: " + ToolingExtensions.readStringExtension(c, ToolingExtensions.EXT_COMMENT));
}
}
}
boolean first = true;
for (ConceptSetFilterComponent f : inc.getFilter()) {
if (first) {
li.addText(type + " codes from ");
first = false;
} else
li.addText(" and ");
addCsRef(inc, li, e);
li.addText(" where " + f.getProperty() + " " + describe(f.getOp()) + " ");
if (e != null && codeExistsInValueSet(e, f.getValue())) {
XhtmlNode a = li.addTag("a");
a.addText(f.getValue());
a.setAttribute("href", prefix + getCsRef(e) + "#" + Utilities.nmtokenize(f.getValue()));
} else
li.addText(f.getValue());
String disp = ToolingExtensions.getDisplayHint(f);
if (disp != null)
li.addText(" (" + disp + ")");
}
}
return hasExtensions;
}
use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.
the class CodeSystemUtilities method setAbstract.
public static void setAbstract(CodeSystem cs, ConceptDefinitionComponent concept) {
defineAbstractProperty(cs);
concept.addProperty().setCode("abstract").setValue(new BooleanType(true));
}
use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.
the class ICPC2Importer method processClass.
private void processClass(Element cls, Map<String, ConceptDefinitionComponent> concepts, CodeSystem define) {
ConceptDefinitionComponent concept = new ConceptDefinitionComponent();
concept.setCode(cls.getAttribute("code"));
concept.setDefinition(getRubric(cls, "preferred"));
String s = getRubric(cls, "shortTitle");
if (s != null && !s.equals(concept.getDefinition()))
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("shortTitle")).setValue(s);
s = getRubric(cls, "inclusion");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("inclusion")).setValue(s);
s = getRubric(cls, "exclusion");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("exclusion")).setValue(s);
s = getRubric(cls, "criteria");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("criteria")).setValue(s);
s = getRubric(cls, "consider");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("consider")).setValue(s);
s = getRubric(cls, "note");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("note")).setValue(s);
concepts.put(concept.getCode(), concept);
List<Element> children = new ArrayList<Element>();
XMLUtil.getNamedChildren(cls, "SubClass", children);
if (children.size() > 0)
CodeSystemUtilities.setAbstract(define, concept);
Element parent = XMLUtil.getNamedChild(cls, "SuperClass");
if (parent == null) {
define.addConcept(concept);
} else {
ConceptDefinitionComponent p = concepts.get(parent.getAttribute("code"));
p.getConcept().add(concept);
}
}
use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSet10_30 method convertCodeSystemConcept.
public static ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
ValueSet.ConceptDefinitionComponent tgt = new ValueSet.ConceptDefinitionComponent();
ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt);
tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src));
tgt.setCode(src.getCode());
tgt.setDefinition(src.getDefinition());
tgt.setDisplay(src.getDisplay());
for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(cs, cc));
for (CodeSystem.ConceptDefinitionDesignationComponent cc : src.getDesignation()) tgt.addDesignation(convertCodeSystemDesignation(cc));
return tgt;
}
use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSet10_50 method processConcept.
public static void processConcept(List<ConceptDefinitionComponent> concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException {
org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent();
concepts.add(ct);
ct.setCode(cs.getCode());
ct.setDisplay(cs.getDisplay());
ct.setDefinition(cs.getDefinition());
if (cs.getAbstract())
CodeSystemUtilities.setNotSelectable(tgtcs, ct);
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) {
org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent();
cst.setLanguage(csd.getLanguage());
cst.setUse(Coding10_50.convertCoding(csd.getUse()));
cst.setValue(csd.getValue());
}
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, tgtcs);
}
Aggregations