Java Code Examples for org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent#setDefinition()

The following examples show how to use org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent#setDefinition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NUCCConvertor.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void processLine(CodeSystem cs, String[] values) throws FHIRFormatError {
  if (!values[1].equals(last[0])) {
    last[1] = "";
    last[0] = values[1];
    concepts[0] = new ConceptDefinitionComponent();
    cs.getConcept().add(concepts[0]);
    concepts[0].setDisplay(values[1]);
    concepts[0].setCode("base-"+Integer.toString(cs.getConcept().size()));
    CodeSystemUtilities.setNotSelectable(cs, concepts[0]);
  }
  if (!values[2].equals(last[1])) {
    last[1] = values[2];
    concepts[1] = new ConceptDefinitionComponent();
    concepts[0].getConcept().add(concepts[1]);
    concepts[1].setCode(values[0]);
    concepts[1].setDisplay(values[2]);
    concepts[1].setDefinition(values[4]);
    if (values.length > 5 && !Utilities.noString(values[5]))
      ToolingExtensions.addCSComment(concepts[1], values[5]);
  } else if (!Utilities.noString(values[3])) {
    ConceptDefinitionComponent cc = new ConceptDefinitionComponent();
    concepts[1].getConcept().add(cc);
    cc.setCode(values[0]);
    cc.setDisplay(values[3]);
    cc.setDefinition(values[4]);
    if (values.length > 5 && !Utilities.noString(values[5]))
      ToolingExtensions.addCSComment(cc, values[5]);
  }
}
 
Example 2
Source File: ICPC2Importer.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private void processClass(Element cls, Map<String, ConceptDefinitionComponent> concepts, CodeSystem define) throws FHIRFormatError {
  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.setNotSelectable(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);
  }
}