use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class PageProcessor method findTranslations.
private void findTranslations(Set<String> res, List<ConceptDefinitionComponent> list) {
for (ConceptDefinitionComponent cc : list) {
for (ConceptDefinitionDesignationComponent cd : cc.getDesignation()) {
if (cd.hasLanguage())
res.add(cd.getLanguage());
}
Extension ex = cc.getExtensionByUrl(ToolingExtensions.EXT_CS_COMMENT);
if (ex != null) {
for (String l : ToolingExtensions.getLanguageTranslations(ex).keySet()) res.add(l);
}
findTranslations(res, cc.getConcept());
}
}
use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class PageProcessor method summariseSCTCLD.
private String summariseSCTCLD(ValueSet vs) {
boolean hasNonSCT = false;
for (ConceptSetComponent cc : vs.getCompose().getInclude()) {
if (!"http://snomed.info/sct".equals(cc.getSystem()))
hasNonSCT = true;
}
StringBuilder b = new StringBuilder();
b.append("<ul>");
for (ConceptSetComponent cc : vs.getCompose().getInclude()) {
if ("http://snomed.info/sct".equals(cc.getSystem())) {
if (!cc.hasConcept() && !cc.hasFilter()) {
b.append("<li>any SCT concept</li>");
} else if (cc.hasConcept()) {
b.append("<li>" + Integer.toString(cc.getConcept().size()) + " enumerated concepts</li>");
} else {
if (cc.getFilter().size() != 1 || !cc.getFilter().get(0).getProperty().equals("concept"))
b.append("<li>ERROR!</li>");
else {
ConceptDefinitionComponent def = workerContext.getCodeDefinition("http://snomed.info/sct", cc.getFilter().get(0).getValue());
b.append("<li>" + cc.getFilter().get(0).getOp().toCode() + " " + (def == null ? cc.getFilter().get(0).getValue() : Utilities.escapeXml(def.getDisplay())) + "</li>");
}
}
}
}
if (hasNonSCT)
b.append("<li>other code systems</li>");
b.append("</ul>");
return b.toString();
}
use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class PageProcessor method getSnomedCTConcept.
public void getSnomedCTConcept(Map<String, SnomedConceptUsage> concepts, ValueSet vs, ConceptSetFilterComponent c) throws Exception {
ConceptDefinitionComponent def = workerContext.getCodeDefinition("http://snomed.info/sct", c.getValue());
if (def == null) {
throw new Exception("Unable to retrieve definition for SNOMED code: " + c.getValue());
}
String d = def.getDisplay();
if (concepts.containsKey(c.getValue()))
concepts.get(c.getValue()).update(d, vs);
else
concepts.put(c.getValue(), new SnomedConceptUsage(c.getValue(), d, vs));
}
use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class MarkDownPreProcessor method presentExpansion.
private static String presentExpansion(List<ValueSetExpansionContainsComponent> contains, BuildWorkerContext workerContext) {
StringBuilder b = new StringBuilder();
for (ValueSetExpansionContainsComponent cc : contains) {
b.append(" - **");
b.append(cc.getCode());
b.append("** (\"");
b.append(cc.getDisplay());
b.append("\"): ");
ConceptDefinitionComponent definition = workerContext.getCodeDefinition(cc.getSystem(), cc.getCode());
b.append(definition.getDefinition());
b.append("\r\n");
}
return b.toString();
}
use of org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent in project kindling by HL7.
the class ValueSetGenerator method genResourceTypes.
private void genResourceTypes(ValueSet vs) {
if (!vs.hasCompose())
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().addInclude().setSystem("http://hl7.org/fhir/resource-types");
vs.setUserData("filename", "valueset-" + vs.getId());
if (!vs.hasExtension(ToolingExtensions.EXT_WORKGROUP)) {
vs.addExtension().setUrl(ToolingExtensions.EXT_WORKGROUP).setValue(new CodeType("fhir"));
} else {
String ec = ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_WORKGROUP);
if (!ec.equals("fhir"))
System.out.println("ValueSet " + vs.getUrl() + " WG mismatch 7: is " + ec + ", want to set to " + "fhir");
}
vs.setUserData("path", "valueset-" + vs.getId() + ".html");
CodeSystem cs = new CodeSystem();
CodeSystemConvertor.populate(cs, vs);
cs.setUrl("http://hl7.org/fhir/resource-types");
cs.setVersion(version);
cs.setCaseSensitive(true);
cs.setContent(CodeSystemContentMode.COMPLETE);
definitions.getCodeSystems().see(cs, packageInfo);
List<String> codes = new ArrayList<String>();
codes.addAll(definitions.getBaseResources().keySet());
codes.addAll(definitions.getKnownResources().keySet());
Collections.sort(codes);
for (String s : codes) {
DefinedCode rd = definitions.getKnownResources().get(s);
ConceptDefinitionComponent c = cs.addConcept();
Map<String, String> t;
if (rd == null) {
t = translator.translations(s);
c.setCode(s);
c.setDisplay(definitions.getBaseResources().get(s).getName());
c.setDefinition((definitions.getBaseResources().get(s).isAbstract() ? "--- Abstract Type! ---" : "") + definitions.getBaseResources().get(s).getDefinition());
} else {
t = translator.translations(rd.getCode());
c.setCode(rd.getCode());
c.setDisplay(rd.getCode());
c.setDefinition(rd.getDefinition());
}
if (t != null) {
for (String l : t.keySet()) c.addDesignation().setLanguage(l).setValue(t.get(l)).getUse().setSystem("http://terminology.hl7.org/CodeSystem/designation-usage").setCode("display");
}
}
markSpecialStatus(vs, cs, true);
}
Aggregations