Exemplo n.º 1
0
 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(), Charsets.UTF_8);
 }
Exemplo n.º 2
0
 private ValidationResult verifyCodeInCodeSystem(
     CodeSystem cs, String system, String code, String display) throws Exception {
   ConceptDefinitionComponent cc = findCodeInConcept(cs.getConcept(), code);
   if (cc == null)
     if (cs.getContent().equals(CodeSystem.CodeSystemContentMode.COMPLETE))
       return new ValidationResult(
           IssueSeverity.ERROR, "Unknown Code " + code + " in " + cs.getUrl());
     else if (!cs.getContent().equals(CodeSystem.CodeSystemContentMode.NOTPRESENT))
       return new ValidationResult(
           IssueSeverity.WARNING,
           "Unknown Code " + code + " in partial code list of " + cs.getUrl());
     else
       return verifyCodeExternal(
           null, new Coding().setSystem(system).setCode(code).setDisplay(display), false);
   //
   //        return new ValidationResult(IssueSeverity.WARNING, "A definition was found for
   // "+cs.getUrl()+", but it has no codes in the definition");
   //      return new ValidationResult(IssueSeverity.ERROR, "Unknown Code "+code+" in
   // "+cs.getUrl());
   if (display == null) return new ValidationResult(cc);
   CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
   if (cc.hasDisplay()) {
     b.append(cc.getDisplay());
     if (display.equalsIgnoreCase(cc.getDisplay())) return new ValidationResult(cc);
   }
   for (ConceptDefinitionDesignationComponent ds : cc.getDesignation()) {
     b.append(ds.getValue());
     if (display.equalsIgnoreCase(ds.getValue())) return new ValidationResult(cc);
   }
   return new ValidationResult(
       IssueSeverity.WARNING,
       "Display Name for " + code + " must be one of '" + b.toString() + "'",
       cc);
 }
Exemplo n.º 3
0
  private String gen(Section section, CodeSystem cs, ValueSet vs) {
    String bn = getPNameForUri(cs.getUrl());
    if (!bn.startsWith("<")) {
      section.triple(bn + ".system", "a", "fhir:CodeSystem");
      if (cs.hasVersion()) section.triple(bn + ".system", "fhir:version", literal(cs.getVersion()));
      if (vs.hasName()) section.label(bn + ".system", vs.getName());
      if (vs.hasDescription())
        section.comment(
            bn + ".system",
            vs.getDescription()
                .replace("value set", "code system")
                .replace("Value Set", "Code System")
                .replace("Value set", "Code system"));
      if (vs.hasCopyright())
        section.triple(bn + ".system", "dc:rights", literal(vs.getCopyright()));
      if (vs.hasDate()) section.triple(bn + ".system", "dc:date", literal(vs.getDate().toString()));

      section.triple(bn, "a", "fhir:Concept");

      gen(section, bn, bn, cs.getConcept());
    }
    return bn;
  }