use of org.hl7.fhir.definitions.model.Compartment in project kindling by HL7.
the class PageProcessor method compResourceMap.
private String compResourceMap(String name) throws Exception {
String n = name.split("\\-")[1];
StringBuilder in = new StringBuilder();
StringBuilder out = new StringBuilder();
Map<ResourceDefn, String> map = definitions.getCompartmentByName(n).getResources();
for (String rn : definitions.sortedResourceNames()) {
ResourceDefn rd = definitions.getResourceByName(rn);
String rules = map.get(rd);
if (Utilities.noString(rules)) {
out.append(" <li><a href=\"").append(rd.getName().toLowerCase()).append(".html\">").append(rd.getName()).append("</a></li>\r\n");
} else if (!rules.equals("{def}")) {
in.append(" <tr><td><a href=\"").append(rd.getName().toLowerCase()).append(".html\">").append(rd.getName()).append("</a></td><td>").append(rules.replace("|", "or")).append("</td></tr>\r\n");
}
}
return "<p>\r\nThe following resources may be in this compartment:\r\n</p>\r\n" + "<table class=\"grid\">\r\n" + " <tr><td><b>Resource</b></td><td><b>Inclusion Criteria</b></td></tr>\r\n" + in.toString() + "</table>\r\n" + "<p>\r\nA resource is in this compartment if the nominated search parameter (or chain) refers to the patient resource that defines the compartment.\r\n</p>\r\n" + "<p>\r\n\r\n</p>\r\n" + "<p>\r\nThe following resources are never in this compartment:\r\n</p>\r\n" + "<ul>\r\n" + out.toString() + "</ul>\r\n";
}
use of org.hl7.fhir.definitions.model.Compartment 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.definitions.model.Compartment in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generate.
public void generate(CompartmentDefinition cpd) {
StringBuilder in = new StringBuilder();
StringBuilder out = new StringBuilder();
for (CompartmentDefinitionResourceComponent cc : cpd.getResource()) {
CommaSeparatedStringBuilder rules = new CommaSeparatedStringBuilder();
if (!cc.hasParam()) {
out.append(" <li><a href=\"").append(cc.getCode().toLowerCase()).append(".html\">").append(cc.getCode()).append("</a></li>\r\n");
} else if (!rules.equals("{def}")) {
for (StringType p : cc.getParam()) rules.append(p.asStringValue());
in.append(" <tr><td><a href=\"").append(cc.getCode().toLowerCase()).append(".html\">").append(cc.getCode()).append("</a></td><td>").append(rules.toString()).append("</td></tr>\r\n");
}
}
XhtmlNode x;
try {
x = new XhtmlParser().parseFragment("<div><p>\r\nThe following resources may be in this compartment:\r\n</p>\r\n" + "<table class=\"grid\">\r\n" + " <tr><td><b>Resource</b></td><td><b>Inclusion Criteria</b></td></tr>\r\n" + in.toString() + "</table>\r\n" + "<p>\r\nA resource is in this compartment if the nominated search parameter (or chain) refers to the patient resource that defines the compartment.\r\n</p>\r\n" + "<p>\r\n\r\n</p>\r\n" + "<p>\r\nThe following resources are never in this compartment:\r\n</p>\r\n" + "<ul>\r\n" + out.toString() + "</ul></div>\r\n");
inject(cpd, x, NarrativeStatus.GENERATED);
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.hl7.fhir.definitions.model.Compartment in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCapabilityStatementCapabilityStatementRestComponent.
protected void composeCapabilityStatementCapabilityStatementRestComponent(Complex parent, String parentType, String name, CapabilityStatement.CapabilityStatementRestComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "rest", name, element, index);
if (element.hasModeElement())
composeEnum(t, "CapabilityStatement", "mode", element.getModeElement(), -1);
if (element.hasDocumentationElement())
composeMarkdown(t, "CapabilityStatement", "documentation", element.getDocumentationElement(), -1);
if (element.hasSecurity())
composeCapabilityStatementCapabilityStatementRestSecurityComponent(t, "CapabilityStatement", "security", element.getSecurity(), -1);
for (int i = 0; i < element.getResource().size(); i++) composeCapabilityStatementCapabilityStatementRestResourceComponent(t, "CapabilityStatement", "resource", element.getResource().get(i), i);
for (int i = 0; i < element.getInteraction().size(); i++) composeCapabilityStatementSystemInteractionComponent(t, "CapabilityStatement", "interaction", element.getInteraction().get(i), i);
for (int i = 0; i < element.getSearchParam().size(); i++) composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(t, "CapabilityStatement", "searchParam", element.getSearchParam().get(i), i);
for (int i = 0; i < element.getOperation().size(); i++) composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(t, "CapabilityStatement", "operation", element.getOperation().get(i), i);
for (int i = 0; i < element.getCompartment().size(); i++) composeCanonical(t, "CapabilityStatement", "compartment", element.getCompartment().get(i), i);
}
use of org.hl7.fhir.definitions.model.Compartment in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent.
protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(Complex parent, String parentType, String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "compartment", name, element, index);
if (element.hasUseElement())
composeEnum(t, "GraphDefinition", "use", element.getUseElement(), -1);
if (element.hasCodeElement())
composeEnum(t, "GraphDefinition", "code", element.getCodeElement(), -1);
if (element.hasRuleElement())
composeEnum(t, "GraphDefinition", "rule", element.getRuleElement(), -1);
if (element.hasExpressionElement())
composeString(t, "GraphDefinition", "expression", element.getExpressionElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "GraphDefinition", "description", element.getDescriptionElement(), -1);
}
Aggregations