use of org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent in project kindling by HL7.
the class ValueSetGenerator method genAbstractTypes.
private void genAbstractTypes(ValueSet vs) {
if (!vs.hasCompose())
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().addInclude().setSystem("http://hl7.org/fhir/abstract-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 8: is " + ec + ", want to set to " + "fhir");
}
vs.setUserData("path", "valueset-" + vs.getId() + ".html");
CodeSystem cs = new CodeSystem();
cs.setUserData("filename", vs.getUserString("filename").replace("valueset-", "codesystem-"));
cs.setUserData("path", vs.getUserString("path").replace("valueset-", "codesystem-"));
CodeSystemConvertor.populate(cs, vs);
cs.setUrl("http://hl7.org/fhir/abstract-types");
cs.setVersion(version);
cs.setCaseSensitive(true);
cs.setContent(CodeSystemContentMode.COMPLETE);
definitions.getCodeSystems().see(cs, packageInfo);
cs.addConcept().setCode("Type").setDisplay("Type").setDefinition("A place holder that means any kind of data type");
cs.addConcept().setCode("Any").setDisplay("Any").setDefinition("A place holder that means any kind of resource");
markSpecialStatus(vs, cs, true);
}
use of org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent 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);
}
use of org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent in project kindling by HL7.
the class ValueSetGenerator method genMessageEvents.
private void genMessageEvents(ValueSet vs) {
if (!vs.hasCompose())
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().addInclude().setSystem("http://hl7.org/fhir/message-events");
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 10: is " + ec + ", want to set to " + "fhir");
}
vs.setUserData("path", "valueset-" + vs.getId() + ".html");
CodeSystem cs = new CodeSystem();
CodeSystemConvertor.populate(cs, vs);
cs.setUserData("filename", vs.getUserString("filename").replace("valueset-", "codesystem-"));
cs.setUserData("path", vs.getUserString("path").replace("valueset-", "codesystem-"));
cs.setUrl("http://hl7.org/fhir/message-events");
cs.setVersion(version);
cs.setCaseSensitive(true);
cs.setContent(CodeSystemContentMode.COMPLETE);
definitions.getCodeSystems().see(cs, packageInfo);
List<String> codes = new ArrayList<String>();
codes.addAll(definitions.getEvents().keySet());
Collections.sort(codes);
for (String s : codes) {
ConceptDefinitionComponent c = cs.addConcept();
EventDefn e = definitions.getEvents().get(s);
c.setCode(s);
c.setDisplay(transform(e.getCode(), e.getTitle()));
c.setDefinition(e.getDefinition());
}
markSpecialStatus(vs, cs, false);
}
use of org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent in project kindling by HL7.
the class ValueSetGenerator method genDataTypes.
private void genDataTypes(ValueSet vs) throws Exception {
if (!vs.hasCompose())
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().addInclude().setSystem("http://hl7.org/fhir/data-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 6: 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/data-types");
cs.setVersion(version);
cs.setCaseSensitive(true);
cs.setContent(CodeSystemContentMode.COMPLETE);
definitions.getCodeSystems().see(cs, packageInfo);
List<String> codes = new ArrayList<String>();
for (TypeRef t : definitions.getKnownTypes()) codes.add(t.getName());
Collections.sort(codes);
for (String s : codes) {
if (!definitions.dataTypeIsSharedInfo(s)) {
ConceptDefinitionComponent c = cs.addConcept();
c.setCode(s);
c.setDisplay(s);
if (definitions.getPrimitives().containsKey(s))
c.setDefinition(definitions.getPrimitives().get(s).getDefinition());
else if (definitions.getConstraints().containsKey(s))
// don't add these: c.setDefinition(definitions.getConstraints().get(s).getDefinition());
;
else if (definitions.hasElementDefn(s))
c.setDefinition(definitions.getElementDefn(s).getDefinition());
else
c.setDefinition("...to do...");
}
}
ToolingExtensions.addCSComment(cs.addConcept().setCode("xhtml").setDisplay("XHTML").setDefinition("XHTML format, as defined by W3C, but restricted usage (mainly, no active content)"), "Special case: xhtml can only be used in the narrative Data Type");
markSpecialStatus(vs, cs, true);
}
use of org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent 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);
}
Aggregations