use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent 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.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent in project kindling by HL7.
the class ValueSetGenerator method loadOperationOutcomeValueSet.
public void loadOperationOutcomeValueSet(BindingSpecification cd) throws Exception {
ValueSet vs = new ValueSet();
cd.setValueSet(vs);
cd.setBindingMethod(BindingMethod.ValueSet);
vs.setId("operation-outcome");
vs.setUrl("http://hl7.org/fhir/ValueSet/" + vs.getId());
vs.setName("OperationOutcomeCodes");
vs.setTitle("Operation Outcome Codes");
vs.setPublisher("HL7 (FHIR Project)");
vs.setVersion(version);
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 11: is " + ec + ", want to set to " + "fhir");
}
vs.setUserData("path", "valueset-" + vs.getId() + ".html");
ContactDetail c = vs.addContact();
c.addTelecom().setSystem(ContactPointSystem.URL).setValue("http://hl7.org/fhir");
c.addTelecom().setSystem(ContactPointSystem.EMAIL).setValue("fhir@lists.hl7.org");
vs.setDescription("Operation Outcome codes used by FHIR test servers (see Implementation file translations.xml)");
vs.setStatus(PublicationStatus.DRAFT);
if (!vs.hasCompose())
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().addInclude().setSystem("http://terminology.hl7.org/CodeSystem/operation-outcome");
CodeSystem cs = new CodeSystem();
cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.ISA);
Set<String> codes = translator.listTranslations("ecode");
for (String s : sorted(codes)) {
Map<String, String> langs = translator.translations(s);
ConceptDefinitionComponent cv = cs.addConcept();
cv.setCode(s);
cv.setDisplay(langs.get("en"));
for (String lang : langs.keySet()) {
if (!lang.equals("en")) {
String value = langs.get(lang);
ConceptDefinitionDesignationComponent dc = cv.addDesignation();
dc.setLanguage(lang);
dc.setValue(value);
dc.getUse().setSystem("http://terminology.hl7.org/CodeSystem/designation-usage").setCode("display");
}
}
}
CodeSystemConvertor.populate(cs, vs);
cs.setUrl("http://terminology.hl7.org/CodeSystem/operation-outcome");
cs.setVersion(version);
cs.setCaseSensitive(true);
cs.setContent(CodeSystemContentMode.COMPLETE);
definitions.getCodeSystems().see(cs, packageInfo);
}
use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpanderSimple method convert.
private List<ConceptDefinitionDesignationComponent> convert(List<ConceptReferenceDesignationComponent> designations) {
List<ConceptDefinitionDesignationComponent> list = new ArrayList<ConceptDefinitionDesignationComponent>();
for (ConceptReferenceDesignationComponent d : designations) {
ConceptDefinitionDesignationComponent n = new ConceptDefinitionDesignationComponent();
n.setLanguage(d.getLanguage());
n.setUse(d.getUse());
n.setValue(d.getValue());
list.add(n);
}
return list;
}
use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSetCheckerSimple method validateCode.
private ValidationResult validateCode(Coding code, CodeSystem cs) {
ConceptDefinitionComponent cc = cs.hasUserData("tx.cs.special") ? ((SpecialCodeSystem) cs.getUserData("tx.cs.special")).findConcept(code) : findCodeInConcept(cs.getConcept(), code.getCode());
if (cc == null) {
if (cs.getContent() == CodeSystemContentMode.FRAGMENT) {
return new ValidationResult(IssueSeverity.WARNING, context.formatMessage(I18nConstants.UNKNOWN_CODE__IN_FRAGMENT, gen(code), cs.getUrl()));
} else {
return new ValidationResult(IssueSeverity.ERROR, context.formatMessage(I18nConstants.UNKNOWN_CODE__IN_, gen(code), cs.getUrl()));
}
}
if (code.getDisplay() == null) {
return new ValidationResult(code.getSystem(), cc);
}
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
if (cc.hasDisplay()) {
b.append(cc.getDisplay());
if (code.getDisplay().equalsIgnoreCase(cc.getDisplay())) {
return new ValidationResult(code.getSystem(), cc);
}
}
for (ConceptDefinitionDesignationComponent ds : cc.getDesignation()) {
b.append(ds.getValue());
if (code.getDisplay().equalsIgnoreCase(ds.getValue())) {
return new ValidationResult(code.getSystem(), cc);
}
}
// also check to see if the value set has another display
ConceptReferenceComponent vs = findValueSetRef(code.getSystem(), code.getCode());
if (vs != null && (vs.hasDisplay() || vs.hasDesignation())) {
if (vs.hasDisplay()) {
b.append(vs.getDisplay());
if (code.getDisplay().equalsIgnoreCase(vs.getDisplay())) {
return new ValidationResult(code.getSystem(), cc);
}
}
for (ConceptReferenceDesignationComponent ds : vs.getDesignation()) {
b.append(ds.getValue());
if (code.getDisplay().equalsIgnoreCase(ds.getValue())) {
return new ValidationResult(code.getSystem(), cc);
}
}
}
return new ValidationResult(IssueSeverity.WARNING, context.formatMessage(I18nConstants.DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF_, code.getSystem(), code.getCode(), b.toString(), code.getDisplay()), code.getSystem(), cc);
}
use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpanderSimple method convertDesignations.
private List<ConceptDefinitionDesignationComponent> convertDesignations(List<ConceptReferenceDesignationComponent> list) {
List<ConceptDefinitionDesignationComponent> res = new ArrayList<CodeSystem.ConceptDefinitionDesignationComponent>();
for (ConceptReferenceDesignationComponent t : list) {
ConceptDefinitionDesignationComponent c = new ConceptDefinitionDesignationComponent();
c.setLanguage(t.getLanguage());
c.setUse(t.getUse());
c.setValue(t.getValue());
}
return res;
}
Aggregations