Java Code Examples for org.hl7.fhir.dstu3.model.CodeSystem

The following examples show how to use org.hl7.fhir.dstu3.model.CodeSystem. These examples are extracted from open source projects. 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 Project: org.hl7.fhir.core   Source File: NUCCConvertor.java    License: Apache License 2.0 6 votes vote down vote up
public void execute() throws IOException, FHIRException {
  CSVReader csv = new CSVReader(new FileInputStream("c:\\temp\\nucc.csv"));
  CodeSystem cs = new CodeSystem();
  cs.setId("nucc-provider-taxonomy");
  cs.setUrl("http://nucc.org/provider-taxonomy");
  cs.setName("NUCC Provider Taxonomy");
  cs.setDateElement(new DateTimeType());
  cs.setDescription("The Health Care Provider Taxonomy code is a unique alphanumeric code, ten characters in length. The code set is structured into three distinct 'Levels' including Provider Type, Classification, and Area of Specialization");
  cs.setCopyright("See NUCC copyright statement");
  cs.setStatus(PublicationStatus.ACTIVE);
  cs.setContent(CodeSystemContentMode.COMPLETE);
  cs.setExperimental(false);
  cs.setValueSet("http://hl7.org/fhir/ValueSet/nucc-provider-taxonomy"); 
  cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
  csv.parseLine();
  while (csv.ready())
  {
    String[] values = csv.parseLine();
    processLine(cs, values);
  }     
  csv.close();
  new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\nucc.xml"), cs);
}
 
Example 2
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 6 votes vote down vote up
static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentModeEnumFactory());
    VersionConvertor_14_30.copyElement(src, tgt);
    switch(src.getValue()) {
        case NOTPRESENT:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT);
            break;
        case EXAMPLE:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR);
            break;
        case FRAGMENT:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT);
            break;
        case COMPLETE:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE);
            break;
        default:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL);
            break;
    }
    return tgt;
}
 
Example 3
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 6 votes vote down vote up
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentModeEnumFactory());
    VersionConvertor_14_30.copyElement(src, tgt);
    switch(src.getValue()) {
        case NOTPRESENT:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT);
            break;
        case EXAMPLAR:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE);
            break;
        case FRAGMENT:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT);
            break;
        case COMPLETE:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE);
            break;
        default:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL);
            break;
    }
    return tgt;
}
 
Example 4
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 6 votes vote down vote up
public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasCodeElement())
        tgt.setCodeElement(VersionConvertor_14_30.convertCode(src.getCodeElement()));
    if (src.hasDescription())
        tgt.setDescriptionElement(VersionConvertor_14_30.convertString(src.getDescriptionElement()));
    for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) try {
        tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue()));
    } catch (org.hl7.fhir.exceptions.FHIRException e) {
        throw new FHIRException(e);
    }
    if (src.hasValueElement())
        tgt.setValueElement(VersionConvertor_14_30.convertString(src.getValueElement()));
    return tgt;
}
 
Example 5
Source Project: org.hl7.fhir.core   Source File: ValueSet10_30.java    License: Apache License 2.0 6 votes vote down vote up
static public void processConcept(List<ConceptDefinitionComponent> concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException {
    org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu3.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.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent();
        cst.setLanguage(csd.getLanguage());
        cst.setUse(VersionConvertor_10_30.convertCoding(csd.getUse()));
        cst.setValue(csd.getValue());
    }
    for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, tgtcs);
}
 
Example 6
Source Project: org.hl7.fhir.core   Source File: ValueSet10_30.java    License: Apache License 2.0 6 votes vote down vote up
static public void processConcept(List<ValueSet.ConceptDefinitionComponent> concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException {
    org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent();
    concepts.add(ct);
    ct.setCode(cs.getCode());
    ct.setDisplay(cs.getDisplay());
    ct.setDefinition(cs.getDefinition());
    if (CodeSystemUtilities.isNotSelectable(srcCS, cs))
        ct.setAbstract(true);
    for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) {
        org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent();
        cst.setLanguage(csd.getLanguage());
        cst.setUse(VersionConvertor_10_30.convertCoding(csd.getUse()));
        cst.setValue(csd.getValue());
    }
    for (ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, srcCS);
}
 
Example 7
Source Project: org.hl7.fhir.core   Source File: CodeSystemUtilities.java    License: Apache License 2.0 6 votes vote down vote up
public static void markStatus(CodeSystem cs, String wg, String status, String fmm) {
  if (wg != null) {
    if (!ToolingExtensions.hasExtension(cs, ToolingExtensions.EXT_WORKGROUP) || 
        (Utilities.existsInList(ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_WORKGROUP), "fhir", "vocab") && !Utilities.existsInList(wg, "fhir", "vocab"))) {
      ToolingExtensions.setCodeExtension(cs, ToolingExtensions.EXT_WORKGROUP, wg);
    }
  }
  if (status != null) {
    String ss = ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_BALLOT_STATUS);
    if (Utilities.noString(ss) || ssval(ss) < ssval(status)) 
      ToolingExtensions.setStringExtension(cs, ToolingExtensions.EXT_BALLOT_STATUS, status);
  }
  if (fmm != null) {
    String sfmm = ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_FMM_LEVEL);
    if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm)) 
      ToolingExtensions.setIntegerExtension(cs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm));
  }
}
 
Example 8
Source Project: org.hl7.fhir.core   Source File: ValueSetUtilities.java    License: Apache License 2.0 6 votes vote down vote up
public static void markStatus(ValueSet vs, String wg, String status, String fmm) {
  if (wg != null) {
    if (!ToolingExtensions.hasExtension(vs, ToolingExtensions.EXT_WORKGROUP) || 
        (Utilities.existsInList(ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_WORKGROUP), "fhir", "vocab") && !Utilities.existsInList(wg, "fhir", "vocab"))) {
      ToolingExtensions.setCodeExtension(vs, ToolingExtensions.EXT_WORKGROUP, wg);
    }
  }
  if (status != null) {
    String ss = ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_BALLOT_STATUS);
    if (Utilities.noString(ss) || ssval(ss) < ssval(status)) 
      ToolingExtensions.setStringExtension(vs, ToolingExtensions.EXT_BALLOT_STATUS, status);
  }
  if (fmm != null) {
    String sfmm = ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_FMM_LEVEL);
    if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm)) 
      ToolingExtensions.setIntegerExtension(vs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm));
  }
  if (vs.hasUserData("cs"))
    CodeSystemUtilities.markStatus((CodeSystem) vs.getUserData("cs"), wg, status, fmm);
}
 
Example 9
Source Project: org.hl7.fhir.core   Source File: NarrativeGenerator.java    License: Apache License 2.0 6 votes vote down vote up
private void generateProperties(XhtmlNode x, CodeSystem cs) {
  if (cs.hasProperty()) {
    x.para().b().tx("Properties");
    XhtmlNode tbl = x.table("grid");
    XhtmlNode tr = tbl.tr();
    tr.td().b().tx("Code");
    tr.td().b().tx("URL");
    tr.td().b().tx("Description");
    tr.td().b().tx("Type");
    for (PropertyComponent p : cs.getProperty()) {
      tr = tbl.tr();
      tr.td().tx(p.getCode());
      tr.td().tx(p.getUri());
      tr.td().tx(p.getDescription());
      tr.td().tx(p.hasType() ? p.getType().toCode() : "");
    }
  }
}
 
Example 10
Source Project: org.hl7.fhir.core   Source File: NarrativeGenerator.java    License: Apache License 2.0 6 votes vote down vote up
private void addCodeToTable(boolean isAbstract, String system, String code, String display, XhtmlNode td) {
  CodeSystem e = context.fetchCodeSystem(system);
  if (e == null || e.getContent() != org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE) {
    if (isAbstract)
      td.i().setAttribute("title", ABSTRACT_CODE_HINT).addText(code);
    else if ("http://snomed.info/sct".equals(system)) {
      td.ah("http://browser.ihtsdotools.org/?perspective=full&conceptId1="+code).addText(code);
    } else if ("http://loinc.org".equals(system)) {
        td.ah("http://details.loinc.org/LOINC/"+code+".html").addText(code);
    } else        
      td.addText(code);
  } else {
    String href = prefix+getCsRef(e);
    if (href.contains("#"))
      href = href + "-"+Utilities.nmtokenize(code);
    else
      href = href + "#"+e.getId()+"-"+Utilities.nmtokenize(code);
    if (isAbstract)
      td.ah(href).setAttribute("title", ABSTRACT_CODE_HINT).i().addText(code);
    else
      td.ah(href).addText(code);
  }
}
 
Example 11
Source Project: org.hl7.fhir.core   Source File: BaseWorkerContext.java    License: Apache License 2.0 6 votes vote down vote up
private String determineCacheId(ValueSet vs, boolean heirarchical) throws Exception {
  // just the content logical definition is hashed
  ValueSet vsid = new ValueSet();
  vsid.setCompose(vs.getCompose());
  JsonParser parser = new JsonParser();
  parser.setOutputStyle(OutputStyle.NORMAL);
  ByteArrayOutputStream b = new ByteArrayOutputStream();
  parser.compose(b, vsid);
  b.close();
  String s = new String(b.toByteArray(), Constants.CHARSET_UTF8);
  // any code systems we can find, we add these too. 
  for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
    CodeSystem cs = fetchCodeSystem(inc.getSystem());
    if (cs != null) {
      String css = cacheValue(cs);
      s = s + css;
    }
  }
  s = s + "-" + Boolean.toString(heirarchical);
  String r = Integer.toString(s.hashCode());
  //    TextFile.stringToFile(s, Utilities.path(cache, r+".id.json"));
  return r;
}
 
Example 12
Source Project: org.hl7.fhir.core   Source File: BaseWorkerContext.java    License: Apache License 2.0 6 votes vote down vote up
private String cacheValue(CodeSystem cs) throws IOException {
  CodeSystem csid = new CodeSystem();
  csid.setId(cs.getId());
  csid.setVersion(cs.getVersion());
  csid.setContent(cs.getContent());
  csid.setHierarchyMeaning(CodeSystemHierarchyMeaning.GROUPEDBY);
  for (ConceptDefinitionComponent cc : cs.getConcept()) {
    csid.getConcept().add(processCSConcept(cc));
  }
  JsonParser parser = new JsonParser();
  parser.setOutputStyle(OutputStyle.NORMAL);
  ByteArrayOutputStream b = new ByteArrayOutputStream();
  parser.compose(b, csid);
  b.close();
  return new String(b.toByteArray(), Constants.CHARSET_UTF8);
}
 
Example 13
Source Project: org.hl7.fhir.core   Source File: SimpleWorkerContext.java    License: Apache License 2.0 6 votes vote down vote up
public void seeResource(String url, Resource r) throws FHIRException {
   if (r instanceof StructureDefinition)
     seeProfile(url, (StructureDefinition) r);
   else if (r instanceof ValueSet)
     seeValueSet(url, (ValueSet) r);
   else if (r instanceof CodeSystem)
     seeCodeSystem(url, (CodeSystem) r);
   else if (r instanceof OperationDefinition)
     seeOperationDefinition(url, (OperationDefinition) r);
   else if (r instanceof ConceptMap)
     maps.put(((ConceptMap) r).getUrl(), (ConceptMap) r);
   else if (r instanceof StructureMap)
     transforms.put(((StructureMap) r).getUrl(), (StructureMap) r);
   else if (r instanceof NamingSystem)
   	systems.add((NamingSystem) r);
}
 
Example 14
private CodeValidationResult testIfConceptIsInListInner(List<CodeSystem.ConceptDefinitionComponent> conceptList, boolean theCaseSensitive, String code) {
  logT("CareConnect testIfConceptIsInListInner: code=" + code);
  CodeValidationResult retVal = null;
  for (CodeSystem.ConceptDefinitionComponent next : conceptList) {
    // KGM
    logT("CareConnect testIfConceptIsInListInner NextCode = "+next.getCode());
    String nextCandidate = next.getCode();
    if (theCaseSensitive == false) {
      nextCandidate = nextCandidate.toUpperCase();
    }
    if (nextCandidate.equals(code)) {
      logD("Code "+code+" is in the list");
      retVal = new CodeValidationResult(next);
      break;
    }

    // recurse
    retVal = testIfConceptIsInList(code, next.getConcept(), theCaseSensitive);
    if (retVal != null) {
      break;
    }
  }

  return retVal;
}
 
Example 15
@Override
public CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay) {
  CodeSystem cs = fetchCodeSystem(theContext, theCodeSystem);
  logD("CareConnect validateCode system = "+ theCodeSystem);

  if (cs != null) {
    boolean caseSensitive = true;
    if (cs.hasCaseSensitive()) {
      caseSensitive = cs.getCaseSensitive();
    }

    CodeValidationResult retVal = testIfConceptIsInList(theCode, cs.getConcept(), caseSensitive);

    if (retVal != null) {
      return retVal;
    }
  }

  return new CodeValidationResult(IssueSeverity.WARNING, "CareConnect Unknown code: " + theCodeSystem + " / " + theCode);
}
 
Example 16
Source Project: synthea   Source File: ValidationSupportSTU3.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public LookupCodeResult lookupCode(FhirContext theContext, String theSystem, String theCode) {
  if (isCodeSystemSupported(theContext, theSystem)) {
    LookupCodeResult result = new LookupCodeResult();
    result.setSearchedForSystem(theSystem);
    result.setSearchedForCode(theCode);
    result.setFound(false);

    CodeSystem cs = codeSystemMap.get(theSystem);
    for (ConceptDefinitionComponent def : cs.getConcept()) {
      if (def.getCode().equals(theCode)) {
        result.setCodeDisplay(def.getDisplay());
        result.setFound(true);
        return result;
      }
    }
  }
  return LookupCodeResult.notFound(theSystem, theCode);
}
 
Example 17
Source Project: org.hl7.fhir.core   Source File: VersionConvertor_10_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException {
  if (src == null || src.isEmpty())
    return null;
  org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.dstu2.model.ValueSet.ValueSetCodeSystemComponent();
  copyElement(src, tgt);
  if (src.hasUrlElement())
    tgt.setSystemElement(convertUri(src.getUrlElement()));
  if (src.hasVersionElement())
    tgt.setVersionElement(convertString(src.getVersionElement()));
  if (src.hasCaseSensitiveElement())
    tgt.setCaseSensitiveElement(convertBoolean(src.getCaseSensitiveElement()));
  for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(src, cc));
  return tgt;
}
 
Example 18
Source Project: org.hl7.fhir.core   Source File: NUCCConvertor.java    License: 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 19
Source Project: org.hl7.fhir.core   Source File: ICPC2Importer.java    License: 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);
  }
}
 
Example 20
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasName())
        tgt.setNameElement(VersionConvertor_14_30.convertString(src.getNameElement()));
    for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t));
    return tgt;
}
 
Example 21
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu3.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasName())
        tgt.setNameElement(VersionConvertor_14_30.convertString(src.getNameElement()));
    for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t));
    return tgt;
}
 
Example 22
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasCodeElement())
        tgt.setCodeElement(VersionConvertor_14_30.convertCode(src.getCodeElement()));
    if (src.hasDescription())
        tgt.setDescriptionElement(VersionConvertor_14_30.convertString(src.getDescriptionElement()));
    for (Enumeration<FilterOperator> t : src.getOperator()) tgt.addOperator(t.getValue().toCode());
    if (src.hasValueElement())
        tgt.setValueElement(VersionConvertor_14_30.convertString(src.getValueElement()));
    return tgt;
}
 
Example 23
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasLanguage())
        tgt.setLanguageElement(VersionConvertor_14_30.convertCode(src.getLanguageElement()));
    if (src.hasUse())
        tgt.setUse(VersionConvertor_14_30.convertCoding(src.getUse()));
    if (src.hasValueElement())
        tgt.setValueElement(VersionConvertor_14_30.convertString(src.getValueElement()));
    return tgt;
}
 
Example 24
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasLanguage())
        tgt.setLanguageElement(VersionConvertor_14_30.convertCode(src.getLanguageElement()));
    if (src.hasUse())
        tgt.setUse(VersionConvertor_14_30.convertCoding(src.getUse()));
    if (src.hasValueElement())
        tgt.setValueElement(VersionConvertor_14_30.convertString(src.getValueElement()));
    return tgt;
}
 
Example 25
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasCodeElement())
        tgt.setCodeElement(VersionConvertor_14_30.convertCode(src.getCodeElement()));
    if (src.hasValue())
        tgt.setValue(VersionConvertor_14_30.convertType(src.getValue()));
    return tgt;
}
 
Example 26
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasCodeElement())
        tgt.setCodeElement(VersionConvertor_14_30.convertCode(src.getCodeElement()));
    if (src.hasValue())
        tgt.setValue(VersionConvertor_14_30.convertType(src.getValue()));
    return tgt;
}
 
Example 27
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasCodeElement())
        tgt.setCodeElement(VersionConvertor_14_30.convertCode(src.getCodeElement()));
    if (src.hasDescription())
        tgt.setDescriptionElement(VersionConvertor_14_30.convertString(src.getDescriptionElement()));
    if (src.hasType())
        tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
    return tgt;
}
 
Example 28
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent();
    VersionConvertor_14_30.copyElement(src, tgt);
    if (src.hasCodeElement())
        tgt.setCodeElement(VersionConvertor_14_30.convertCode(src.getCodeElement()));
    if (src.hasDescription())
        tgt.setDescriptionElement(VersionConvertor_14_30.convertString(src.getDescriptionElement()));
    if (src.hasType())
        tgt.setTypeElement(convertPropertyType(src.getTypeElement()));
    return tgt;
}
 
Example 29
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType> src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.PropertyTypeEnumFactory());
    VersionConvertor_14_30.copyElement(src, tgt);
    switch(src.getValue()) {
        case CODE:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE);
            break;
        case CODING:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING);
            break;
        case STRING:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING);
            break;
        case INTEGER:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER);
            break;
        case BOOLEAN:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN);
            break;
        case DATETIME:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME);
            break;
        default:
            tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL);
            break;
    }
    return tgt;
}
 
Example 30
Source Project: org.hl7.fhir.core   Source File: CodeSystem14_30.java    License: Apache License 2.0 5 votes vote down vote up
static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType> convertPropertyType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.PropertyType> src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyTypeEnumFactory());
    VersionConvertor_14_30.copyElement(src, tgt);
    switch(src.getValue()) {
        case CODE:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE);
            break;
        case CODING:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING);
            break;
        case STRING:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING);
            break;
        case INTEGER:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER);
            break;
        case BOOLEAN:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN);
            break;
        case DATETIME:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME);
            break;
        default:
            tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL);
            break;
    }
    return tgt;
}