use of org.hl7.fhir.r4b.model.ImplementationGuide in project org.hl7.fhir.core by hapifhir.
the class Scanner method genScanOutput.
protected void genScanOutput(String folder, List<ScanOutputItem> items) throws IOException, FHIRException, EOperationOutcome {
String f = Utilities.path(folder, "comparison.zip");
download("http://fhir.org/archive/comparison.zip", f);
unzip(f, folder);
for (int i = 0; i < items.size(); i++) {
items.get(i).setId("c" + i);
genScanOutputItem(items.get(i), Utilities.path(folder, items.get(i).getId() + ".html"));
}
StringBuilder b = new StringBuilder();
b.append("<html>");
b.append("<head>");
b.append("<title>Implementation Guide Scan</title>");
b.append("<link rel=\"stylesheet\" href=\"fhir.css\"/>\r\n");
b.append("<style>\r\n");
b.append("th \r\n");
b.append("{\r\n");
b.append(" vertical-align: bottom;\r\n");
b.append(" text-align: center;\r\n");
b.append("}\r\n");
b.append("\r\n");
b.append("th span\r\n");
b.append("{\r\n");
b.append(" -ms-writing-mode: tb-rl;\r\n");
b.append(" -webkit-writing-mode: vertical-rl;\r\n");
b.append(" writing-mode: vertical-rl;\r\n");
b.append(" transform: rotate(180deg);\r\n");
b.append(" white-space: nowrap;\r\n");
b.append("}\r\n");
b.append("</style>\r\n");
b.append("</head>");
b.append("<body>");
b.append("<h2>Implementation Guide Scan</h2>");
// organise
Set<String> refs = new HashSet<>();
Set<String> igs = new HashSet<>();
Map<String, Set<String>> profiles = new HashMap<>();
for (ScanOutputItem item : items) {
refs.add(item.getRef());
if (item.getIg() != null) {
igs.add(item.getIg().getUrl());
if (!profiles.containsKey(item.getIg().getUrl())) {
profiles.put(item.getIg().getUrl(), new HashSet<>());
}
if (item.getProfile() != null)
profiles.get(item.getIg().getUrl()).add(item.getProfile().getUrl());
}
}
b.append("<h2>By reference</h2>\r\n");
b.append("<table class=\"grid\">");
b.append("<tr><th></th><th></th>");
for (String s : sort(igs)) {
ImplementationGuide ig = getContext().fetchResource(ImplementationGuide.class, s);
b.append("<th colspan=\"" + Integer.toString(profiles.get(s).size() + 1) + "\"><b title=\"" + s + "\">" + ig.present() + "</b></th>");
}
b.append("</tr>\r\n");
b.append("<tr><th><b>Source</b></th><th><span>Core Spec</span></th>");
for (String s : sort(igs)) {
ImplementationGuide ig = getContext().fetchResource(ImplementationGuide.class, s);
b.append("<th><span>Global</span></th>");
for (String sp : sort(profiles.get(s))) {
StructureDefinition sd = getContext().fetchResource(StructureDefinition.class, sp);
b.append("<th><b title=\"" + sp + "\"><span>" + sd.present() + "</span></b></th>");
}
}
b.append("</tr>\r\n");
for (String s : sort(refs)) {
b.append("<tr>");
b.append("<td>" + s + "</td>");
b.append(genOutcome(items, s, null, null));
for (String si : sort(igs)) {
ImplementationGuide ig = getContext().fetchResource(ImplementationGuide.class, si);
b.append(genOutcome(items, s, si, null));
for (String sp : sort(profiles.get(ig.getUrl()))) {
b.append(genOutcome(items, s, si, sp));
}
}
b.append("</tr>\r\n");
}
b.append("</table>\r\n");
b.append("<h2>By IG</h2>\r\n");
b.append("<table class=\"grid\">");
b.append("<tr><th></th><th></th>");
for (String s : sort(refs)) {
b.append("<th><span>" + s + "</span></th>");
}
b.append("</tr>\r\n");
b.append("<tr><td></td><td>Core Spec</td>");
for (String s : sort(refs)) {
b.append(genOutcome(items, s, null, null));
}
b.append("</tr>\r\n");
for (String si : sort(igs)) {
b.append("<tr>");
ImplementationGuide ig = getContext().fetchResource(ImplementationGuide.class, si);
b.append("<td><b title=\"" + si + "\">" + ig.present() + "</b></td>");
b.append("<td>Global</td>");
for (String s : sort(refs)) {
b.append(genOutcome(items, s, si, null));
}
b.append("</tr>\r\n");
for (String sp : sort(profiles.get(ig.getUrl()))) {
b.append("<tr>");
StructureDefinition sd = getContext().fetchResource(StructureDefinition.class, sp);
b.append("<td></td><td><b title=\"" + sp + "\">" + sd.present() + "</b></td>");
for (String s : sort(refs)) {
b.append(genOutcome(items, s, si, sp));
}
b.append("</tr>\r\n");
}
}
b.append("</table>\r\n");
b.append("</body>");
b.append("</html>");
TextFile.stringToFile(b.toString(), Utilities.path(folder, "scan.html"));
}
use of org.hl7.fhir.r4b.model.ImplementationGuide in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCapabilityStatement.
protected void composeCapabilityStatement(Complex parent, String parentType, String name, CapabilityStatement element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "CapabilityStatement", name, element, index);
if (element.hasUrlElement())
composeUri(t, "CapabilityStatement", "url", element.getUrlElement(), -1);
if (element.hasVersionElement())
composeString(t, "CapabilityStatement", "version", element.getVersionElement(), -1);
if (element.hasNameElement())
composeString(t, "CapabilityStatement", "name", element.getNameElement(), -1);
if (element.hasTitleElement())
composeString(t, "CapabilityStatement", "title", element.getTitleElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "CapabilityStatement", "status", element.getStatusElement(), -1);
if (element.hasExperimentalElement())
composeBoolean(t, "CapabilityStatement", "experimental", element.getExperimentalElement(), -1);
if (element.hasDateElement())
composeDateTime(t, "CapabilityStatement", "date", element.getDateElement(), -1);
if (element.hasPublisherElement())
composeString(t, "CapabilityStatement", "publisher", element.getPublisherElement(), -1);
for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "CapabilityStatement", "contact", element.getContact().get(i), i);
if (element.hasDescriptionElement())
composeMarkdown(t, "CapabilityStatement", "description", element.getDescriptionElement(), -1);
for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "CapabilityStatement", "useContext", element.getUseContext().get(i), i);
for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "CapabilityStatement", "jurisdiction", element.getJurisdiction().get(i), i);
if (element.hasPurposeElement())
composeMarkdown(t, "CapabilityStatement", "purpose", element.getPurposeElement(), -1);
if (element.hasCopyrightElement())
composeMarkdown(t, "CapabilityStatement", "copyright", element.getCopyrightElement(), -1);
if (element.hasKindElement())
composeEnum(t, "CapabilityStatement", "kind", element.getKindElement(), -1);
for (int i = 0; i < element.getInstantiates().size(); i++) composeCanonical(t, "CapabilityStatement", "instantiates", element.getInstantiates().get(i), i);
for (int i = 0; i < element.getImports().size(); i++) composeCanonical(t, "CapabilityStatement", "imports", element.getImports().get(i), i);
if (element.hasSoftware())
composeCapabilityStatementCapabilityStatementSoftwareComponent(t, "CapabilityStatement", "software", element.getSoftware(), -1);
if (element.hasImplementation())
composeCapabilityStatementCapabilityStatementImplementationComponent(t, "CapabilityStatement", "implementation", element.getImplementation(), -1);
if (element.hasFhirVersionElement())
composeEnum(t, "CapabilityStatement", "fhirVersion", element.getFhirVersionElement(), -1);
for (int i = 0; i < element.getFormat().size(); i++) composeCode(t, "CapabilityStatement", "format", element.getFormat().get(i), i);
for (int i = 0; i < element.getPatchFormat().size(); i++) composeCode(t, "CapabilityStatement", "patchFormat", element.getPatchFormat().get(i), i);
for (int i = 0; i < element.getImplementationGuide().size(); i++) composeCanonical(t, "CapabilityStatement", "implementationGuide", element.getImplementationGuide().get(i), i);
for (int i = 0; i < element.getRest().size(); i++) composeCapabilityStatementCapabilityStatementRestComponent(t, "CapabilityStatement", "rest", element.getRest().get(i), i);
for (int i = 0; i < element.getMessaging().size(); i++) composeCapabilityStatementCapabilityStatementMessagingComponent(t, "CapabilityStatement", "messaging", element.getMessaging().get(i), i);
for (int i = 0; i < element.getDocument().size(); i++) composeCapabilityStatementCapabilityStatementDocumentComponent(t, "CapabilityStatement", "document", element.getDocument().get(i), i);
}
use of org.hl7.fhir.r4b.model.ImplementationGuide in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeImplementationGuideManifestResourceComponent.
protected void composeImplementationGuideManifestResourceComponent(Complex parent, String parentType, String name, ImplementationGuide.ManifestResourceComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "resource", name, element, index);
if (element.hasReference())
composeReference(t, "ImplementationGuide", "reference", element.getReference(), -1);
if (element.hasExample())
composeType(t, "ImplementationGuide", "example", element.getExample(), -1);
if (element.hasRelativePathElement())
composeUrl(t, "ImplementationGuide", "relativePath", element.getRelativePathElement(), -1);
}
use of org.hl7.fhir.r4b.model.ImplementationGuide in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeImplementationGuideImplementationGuideDefinitionPageComponent.
protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(Complex parent, String parentType, String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "page", name, element, index);
if (element.hasName())
composeType(t, "ImplementationGuide", "name", element.getName(), -1);
if (element.hasTitleElement())
composeString(t, "ImplementationGuide", "title", element.getTitleElement(), -1);
if (element.hasGenerationElement())
composeEnum(t, "ImplementationGuide", "generation", element.getGenerationElement(), -1);
for (int i = 0; i < element.getPage().size(); i++) composeImplementationGuideImplementationGuideDefinitionPageComponent(t, "ImplementationGuide", "page", element.getPage().get(i), i);
}
use of org.hl7.fhir.r4b.model.ImplementationGuide in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeImplementationGuideImplementationGuideDefinitionResourceComponent.
protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(Complex parent, String parentType, String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "resource", name, element, index);
if (element.hasReference())
composeReference(t, "ImplementationGuide", "reference", element.getReference(), -1);
for (int i = 0; i < element.getFhirVersion().size(); i++) composeEnum(t, "ImplementationGuide", "fhirVersion", element.getFhirVersion().get(i), i);
if (element.hasNameElement())
composeString(t, "ImplementationGuide", "name", element.getNameElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "ImplementationGuide", "description", element.getDescriptionElement(), -1);
if (element.hasExample())
composeType(t, "ImplementationGuide", "example", element.getExample(), -1);
if (element.hasGroupingIdElement())
composeId(t, "ImplementationGuide", "groupingId", element.getGroupingIdElement(), -1);
}
Aggregations