use of org.hl7.fhir.r4.model.ValueSet in project kindling by HL7.
the class PageProcessor method genNSList.
private String genNSList() throws Exception {
StringBuilder b = new StringBuilder();
b.append("<p>Redirects on this page:</p>\r\n");
b.append("<ul>\r\n");
b.append(" <li>Resources</li>\r\n");
b.append(" <li>Data Types</li>\r\n");
b.append(" <li>Code Systems</li>\r\n");
b.append(" <li>Value Sets</li>\r\n");
b.append(" <li>Extensions</li>\r\n");
b.append(" <li>Profiles</li>\r\n");
b.append(" <li>Naming Systems</li>\r\n");
b.append(" <li>Examples</li>\r\n");
b.append(" <li>Compartments</li>\r\n");
b.append(" <li>Data Elements</li>\r\n");
b.append(" <li>Search Parameters</li>\r\n");
b.append(" <li>Implementation Guides</li>\r\n");
b.append(" <li>SIDs</li>\r\n");
b.append(" <li>Others From publish.ini</li>\r\n");
b.append("</ul>\r\n");
b.append("<table class=\"grid\">\r\n");
b.append(" <tr><td><b>URL</b></td><td><b>Thing</b></td><td><b>Page</b></td></tr>");
for (String n : definitions.sortedResourceNames()) definitions.addNs("http://hl7.org/fhir/" + n, n + " Resource", n.toLowerCase() + ".html");
for (String n : definitions.getTypes().keySet()) definitions.addNs("http://hl7.org/fhir/" + n, "Data Type " + n, definitions.getSrcFile(n) + ".html#" + n);
for (String n : definitions.getPrimitives().keySet()) definitions.addNs("http://hl7.org/fhir/" + n, "Primitive Data Type " + n, definitions.getSrcFile(n) + ".html#" + n);
for (String n : definitions.getConstraints().keySet()) definitions.addNs("http://hl7.org/fhir/" + n, "Data Type Profile " + n, definitions.getSrcFile(n) + ".html#" + n);
for (String n : definitions.getInfrastructure().keySet()) definitions.addNs("http://hl7.org/fhir/" + n, "Data Type " + n, definitions.getSrcFile(n) + ".html#" + n);
for (CodeSystem cs : getCodeSystems().getList()) if (cs != null && cs.getUrl().startsWith("http://hl7.org/fhir"))
definitions.addNs(cs.getUrl(), "CodeSystem " + cs.getName(), cs.getUserString("path"));
for (ValueSet vs : getValueSets().getList()) if (vs.getUrl().startsWith("http://hl7.org/fhir"))
definitions.addNs(vs.getUrl(), "ValueSet " + vs.present(), vs.getUserString("path"));
for (ConceptMap cm : getConceptMaps().getList()) if (cm.getUrl().startsWith("http://hl7.org/fhir"))
definitions.addNs(cm.getUrl(), "Concept Map" + cm.getName(), cm.getUserString("path"));
for (StructureDefinition sd : profiles.getList()) if (sd.getUrl().startsWith("http://hl7.org/fhir") && !definitions.getResourceTemplates().containsKey(sd.getName()))
definitions.addNs(sd.getUrl(), "Profile " + sd.getName(), sd.getUserString("path"));
for (StructureDefinition sd : workerContext.getExtensionDefinitions()) if (sd.getUrl().startsWith("http://hl7.org/fhir"))
definitions.addNs(sd.getUrl(), "Profile " + sd.getName(), sd.getUserString("path"));
for (NamingSystem nss : definitions.getNamingSystems()) {
String url = null;
definitions.addNs("http://hl7.org/fhir/NamingSystem/" + nss.getId(), "System " + nss.getName(), nss.getUserString("path"));
for (NamingSystemUniqueIdComponent t : nss.getUniqueId()) {
if (t.getType() == NamingSystemIdentifierType.URI)
url = t.getValue();
}
if (url != null && url.startsWith("http://hl7.org/fhir"))
definitions.addNs(url, "System " + nss.getName(), nss.getUserString("path"));
}
for (String n : ini.getPropertyNames("redirects")) {
String[] parts = ini.getStringProperty("redirects", n).split("\\;");
definitions.addNs(n, "System " + parts[0], parts[1]);
}
for (ImplementationGuideDefn ig : definitions.getIgs().values()) {
if (!ig.isCore()) {
definitions.addNs("http://hl7.org/fhir/ImplementationGuide/" + ig.getCode(), ig.getName(), ig.getHomePage());
definitions.addNs("http://hl7.org/fhir/" + ig.getCode(), ig.getName(), ig.getHomePage());
}
}
for (Compartment t : definitions.getCompartments()) {
definitions.addNs(t.getUri(), t.getName(), "compartmentdefinition.html#" + t.getName());
}
List<String> list = new ArrayList<String>();
list.addAll(definitions.getRedirectList().keySet());
Collections.sort(list);
for (String url : list) {
NamespacePair p = definitions.getRedirectList().get(url);
b.append(" <tr><td>" + Utilities.escapeXml(url) + "</td><td>" + hsplt(Utilities.escapeXml(p.desc)) + "</td><td><a href=\"" + p.page + "\">" + hsplt(Utilities.escapeXml(p.page)) + "</a></td></tr>\r\n");
}
b.append("</table>\r\n");
b.append("<p>" + Integer.toString(list.size()) + " Entries</p>\r\n");
return b.toString();
}
use of org.hl7.fhir.r4.model.ValueSet in project kindling by HL7.
the class PageProcessor method r2Json.
private String r2Json(ValueSet vs) throws Exception {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
IParser json = new JsonParser().setOutputStyle(OutputStyle.PRETTY);
json.setSuppressXhtml("Snipped for Brevity");
json.compose(bytes, vs);
return new String(bytes.toByteArray());
}
use of org.hl7.fhir.r4.model.ValueSet in project kindling by HL7.
the class PageProcessor method vsCLD.
private String vsCLD(String fileTitle, ValueSet vs, String prefix) throws Exception {
if (vs == null)
throw new Exception("no vs?");
ValueSet vs1 = vs.copy();
vs1.setExpansion(null);
vs1.setText(null);
ImplementationGuideDefn ig = (ImplementationGuideDefn) vs.getUserData(ToolResourceUtilities.NAME_RES_IG);
RenderingContext lrc = rc.copy().setLocalPrefix(prefix).setTooCostlyNoteNotEmpty(TOO_MANY_CODES_TEXT_NOT_EMPTY);
RendererFactory.factory(vs1, lrc).render(vs1);
return "<hr/>\r\n" + VS_INC_START + "" + new XhtmlComposer(XhtmlComposer.HTML).compose(vs1.getText().getDiv()) + VS_INC_END;
}
use of org.hl7.fhir.r4.model.ValueSet in project kindling by HL7.
the class ExampleInspector method fetch.
@Override
public Element fetch(IResourceValidator validator, Object appContext, String url) throws IOException, FHIRException {
String[] parts = url.split("\\/");
if (parts.length == 2 && definitions.hasResource(parts[0])) {
ResourceDefn r = definitions.getResourceByName(parts[0]);
for (Example e : r.getExamples()) {
if (e.getElement() == null && e.hasXml()) {
e.setElement(new org.hl7.fhir.r5.elementmodel.XmlParser(context).parse(e.getXml()));
if (e.getElement().getProperty().getStructure().getBaseDefinition().contains("MetadataResource")) {
String urle = e.getElement().getChildValue("url");
String v = e.getElement().getChildValue("url");
if (urle != null && urle.startsWith("http://hl7.org/fhir") && !version.toCode().equals(v)) {
e.getElement().setChildValue("version", version.toCode());
}
}
}
if (e.getElement() != null) {
if (e.getElement().fhirType().equals("Bundle")) {
for (Base b : e.getElement().listChildrenByName("entry")) {
if (b.getChildByName("resource").hasValues()) {
Element res = (Element) b.getChildByName("resource").getValues().get(0);
if (res.fhirType().equals(parts[0]) && parts[1].equals(res.getChildValue("id"))) {
return res;
}
}
}
} else if (e.getElement().fhirType().equals(parts[0]) && e.getId().equals(parts[1])) {
return e.getElement();
}
}
}
try {
if (parts[0].equals("StructureDefinition"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(StructureDefinition.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
if (parts[0].equals("OperationDefinition"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(OperationDefinition.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
if (parts[0].equals("SearchParameter"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(SearchParameter.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
if (parts[0].equals("ValueSet"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(ValueSet.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
if (parts[0].equals("CodeSystem"))
return new ObjectConverter(context).convert(context.fetchResourceWithException(CodeSystem.class, "http://hl7.org/fhir/" + parts[0] + "/" + parts[1]));
} catch (Exception e) {
return null;
}
return null;
} else
return null;
}
use of org.hl7.fhir.r4.model.ValueSet in project kindling by HL7.
the class CDAGenerator method addCDExtensions.
private void addCDExtensions(List<ElementDefinition> list, String n) {
ElementDefinition ed = new ElementDefinition();
ed.setPath(n + ".valueSet");
seePath(ed);
ed.setMin(0);
ed.setMax("1");
ed.addType().setCode("string");
ed.addRepresentation(PropertyRepresentation.XMLATTR);
ed.setDefinition("The valueSet extension adds an attribute for elements with a CD dataType which indicates the particular value set constraining the coded concept");
ed.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:sdtc"));
ed = new ElementDefinition();
ed.setPath(n + ".valueSetVersion");
seePath(ed);
ed.setMin(0);
ed.setMax("1");
ed.addType().setCode("string");
ed.addRepresentation(PropertyRepresentation.XMLATTR);
ed.addExtension().setUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace").setValue(new UriType("urn:hl7-org:sdtc"));
ed.setDefinition("The valueSetVersion extension adds an attribute for elements with a CD dataType which indicates the version of the particular value set constraining the coded concept.");
list.add(ed);
}
Aggregations