org.hl7.fhir.utilities.xhtml.NodeType Java Examples
The following examples show how to use
org.hl7.fhir.utilities.xhtml.NodeType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public XhtmlNode generateDocumentNarrative(Bundle feed) { /* When the document is presented for human consumption, applications must present the collated narrative portions of the following resources in order: * The Composition resource * The Subject resource * Resources referenced in the section.content */ XhtmlNode root = new XhtmlNode(NodeType.Element, "div"); Composition comp = (Composition) feed.getEntry().get(0).getResource(); root.getChildNodes().add(comp.getText().getDiv()); Resource subject = ResourceUtilities.getById(feed, null, comp.getSubject().getReference()); if (subject != null && subject instanceof DomainResource) { root.hr(); root.getChildNodes().add(((DomainResource)subject).getText().getDiv()); } List<SectionComponent> sections = comp.getSection(); renderSections(feed, root, sections, 1); return root; }
Example #2
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public String generate(ResourceContext rcontext, org.hl7.fhir.dstu3.elementmodel.Element er, boolean showCodeDetails) throws IOException, DefinitionException { if (rcontext == null) rcontext = new ResourceContext(null, er); XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.para().b().tx("Generated Narrative"+(showCodeDetails ? " with Details" : "")); try { ResurceWrapperMetaElement resw = new ResurceWrapperMetaElement(er); BaseWrapperMetaElement base = new BaseWrapperMetaElement(er, null, er.getProperty().getStructure(), er.getProperty().getDefinition()); base.children(); generateByProfile(resw, er.getProperty().getStructure(), base, er.getProperty().getStructure().getSnapshot().getElement(), er.getProperty().getDefinition(), base.children, x, er.fhirType(), showCodeDetails); } catch (Exception e) { e.printStackTrace(); x.para().b().setAttribute("style", "color: maroon").tx("Exception generating Narrative: "+e.getMessage()); } inject(er, x, NarrativeStatus.GENERATED); return new XhtmlComposer(XhtmlComposer.XML).compose(x); }
Example #3
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public String generate(ResourceContext rcontext, org.hl7.fhir.r4.elementmodel.Element er, boolean showCodeDetails, ITypeParser parser) throws IOException, FHIRException { if (rcontext == null) rcontext = new ResourceContext(null, er); this.parser = parser; XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.para().b().tx("Generated Narrative"+(showCodeDetails ? " with Details" : "")); try { ResourceWrapperMetaElement resw = new ResourceWrapperMetaElement(er); BaseWrapperMetaElement base = new BaseWrapperMetaElement(er, null, er.getProperty().getStructure(), er.getProperty().getDefinition()); base.children(); generateByProfile(resw, er.getProperty().getStructure(), base, er.getProperty().getStructure().getSnapshot().getElement(), er.getProperty().getDefinition(), base.children, x, er.fhirType(), showCodeDetails, 0, rcontext); } catch (Exception e) { e.printStackTrace(); x.para().b().setAttribute("style", "color: maroon").tx("Exception generating Narrative: "+e.getMessage()); } inject(er, x, NarrativeStatus.GENERATED); return new XhtmlComposer(XhtmlComposer.XML, pretty).compose(x); }
Example #4
Source File: XmlParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
protected void composeXhtml(String name, XhtmlNode html) throws IOException { if (!Utilities.noString(xhtmlMessage)) { xml.enter(XhtmlComposer.XHTML_NS, name); xml.comment(xhtmlMessage, false); xml.exit(XhtmlComposer.XHTML_NS, name); } else { XhtmlComposer comp = new XhtmlComposer(XhtmlComposer.XML, htmlPretty); // name is also found in the html and should the same // ? check that boolean oldPretty = xml.isPretty(); xml.setPretty(htmlPretty); if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null) xml.namespace(XhtmlComposer.XHTML_NS, null); comp.compose(xml, html); xml.setPretty(oldPretty); } }
Example #5
Source File: XmlParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
protected void composeXhtml(String name, XhtmlNode html) throws IOException { if (!Utilities.noString(xhtmlMessage)) { xml.enter(XhtmlComposer.XHTML_NS, name); xml.comment(xhtmlMessage, false); xml.exit(XhtmlComposer.XHTML_NS, name); } else { XhtmlComposer comp = new XhtmlComposer(XhtmlComposer.XML, htmlPretty); // name is also found in the html and should the same // ? check that boolean oldPretty = xml.isPretty(); xml.setPretty(htmlPretty); if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null) xml.namespace(XhtmlComposer.XHTML_NS, null); comp.compose(xml, html); xml.setPretty(oldPretty); } }
Example #6
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public XhtmlNode generateDocumentNarrative(Bundle feed) { /* When the document is presented for human consumption, applications must present the collated narrative portions of the following resources in order: * The Composition resource * The Subject resource * Resources referenced in the section.content */ XhtmlNode root = new XhtmlNode(NodeType.Element, "div"); Composition comp = (Composition) feed.getEntry().get(0).getResource(); root.getChildNodes().add(comp.getText().getDiv()); Resource subject = ResourceUtilities.getById(feed, null, comp.getSubject().getReference()); if (subject != null && subject instanceof DomainResource) { root.addTag("hr"); root.getChildNodes().add(((DomainResource)subject).getText().getDiv()); } List<SectionComponent> sections = comp.getSection(); renderSections(feed, root, sections, 1); return root; }
Example #7
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public XhtmlNode generateDocumentNarrative(Bundle feed) { /* When the document is presented for human consumption, applications must present the collated narrative portions of the following resources in order: * The Composition resource * The Subject resource * Resources referenced in the section.content */ XhtmlNode root = new XhtmlNode(NodeType.Element, "div"); Composition comp = (Composition) feed.getEntry().get(0).getResource(); root.getChildNodes().add(comp.getText().getDiv()); Resource subject = ResourceUtilities.getById(feed, null, comp.getSubject().getReference()); if (subject != null && subject instanceof DomainResource) { root.hr(); root.getChildNodes().add(((DomainResource)subject).getText().getDiv()); } List<SectionComponent> sections = comp.getSection(); renderSections(feed, root, sections, 1); return root; }
Example #8
Source File: XmlParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
protected void composeXhtml(String name, XhtmlNode html) throws IOException { if (!Utilities.noString(xhtmlMessage)) { xml.enter(XhtmlComposer.XHTML_NS, name); xml.comment(xhtmlMessage, false); xml.exit(XhtmlComposer.XHTML_NS, name); } else { XhtmlComposer comp = new XhtmlComposer(true, htmlPretty); // name is also found in the html and should the same // ? check that boolean oldPretty = xml.isPretty(); xml.setPretty(htmlPretty); if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null) xml.namespace(XhtmlComposer.XHTML_NS, null); comp.compose(xml, html); xml.setPretty(oldPretty); } }
Example #9
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public void generate(ValueSet vs, ValueSet src, boolean header) { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); if (vs.hasExpansion()) { // for now, we just accept an expansion if there is one generateExpansion(x, vs, src, header); // if (!vs.hasCodeSystem() && !vs.hasCompose()) // generateExpansion(x, vs, src, header); // else // throw new DefinitionException("Error: should not encounter value set expansion at this point"); } boolean hasExtensions = false; if (vs.hasCodeSystem()) hasExtensions = generateDefinition(x, vs, header); if (vs.hasCompose()) hasExtensions = generateComposition(x, vs, header) || hasExtensions; inject(vs, x, hasExtensions ? NarrativeStatus.EXTENSIONS : NarrativeStatus.GENERATED); }
Example #10
Source File: XmlParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
protected void composeXhtml(String name, XhtmlNode html) throws IOException { if (!Utilities.noString(xhtmlMessage)) { xml.enter(XhtmlComposer.XHTML_NS, name); xml.comment(xhtmlMessage, false); xml.exit(XhtmlComposer.XHTML_NS, name); } else { XhtmlComposer comp = new XhtmlComposer(true, htmlPretty); // name is also found in the html and should the same // ? check that boolean oldPretty = xml.isPretty(); if (html.getNodeType() != NodeType.Text) xml.namespace(XhtmlComposer.XHTML_NS, null); comp.compose(xml, html); xml.setPretty(oldPretty); } }
Example #11
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public XhtmlNode generateDocumentNarrative(Bundle feed) { /* When the document is presented for human consumption, applications must present the collated narrative portions of the following resources in order: * The Composition resource * The Subject resource * Resources referenced in the section.content */ XhtmlNode root = new XhtmlNode(NodeType.Element, "div"); Composition comp = (Composition) feed.getEntry().get(0).getResource(); root.getChildNodes().add(comp.getText().getDiv()); Resource subject = ResourceUtilities.getById(feed, null, comp.getSubject().getReference()); if (subject != null && subject instanceof DomainResource) { root.addTag("hr"); root.getChildNodes().add(((DomainResource)subject).getText().getDiv()); } List<SectionComponent> sections = comp.getSection(); renderSections(feed, root, sections, 1); return root; }
Example #12
Source File: XmlParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
protected void composeXhtml(String name, XhtmlNode html) throws IOException { if (!Utilities.noString(xhtmlMessage)) { xml.enter(XhtmlComposer.XHTML_NS, name); xml.comment(xhtmlMessage, false); xml.exit(XhtmlComposer.XHTML_NS, name); } else { XhtmlComposer comp = new XhtmlComposer(XhtmlComposer.XML, htmlPretty); // name is also found in the html and should the same // ? check that boolean oldPretty = xml.isPretty(); xml.setPretty(htmlPretty); if (html.getNodeType() != NodeType.Text && html.getNsDecl() == null) xml.namespace(XhtmlComposer.XHTML_NS, null); comp.compose(xml, html); xml.setPretty(oldPretty); } }
Example #13
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public void generate(OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.addTag("h2").addText(opd.getName()); x.addTag("p").addText(Utilities.capitalize(opd.getKind().toString())+": "+opd.getName()); addMarkdown(x, opd.getDescription()); if (opd.getSystem()) x.addTag("p").addText("URL: [base]/$"+opd.getCode()); for (CodeType c : opd.getType()) { x.addTag("p").addText("URL: [base]/"+c.getValue()+"/$"+opd.getCode()); if (opd.getInstance()) x.addTag("p").addText("URL: [base]/"+c.getValue()+"/[id]/$"+opd.getCode()); } x.addTag("p").addText("Parameters"); XhtmlNode tbl = x.addTag("table").setAttribute("class", "grid"); XhtmlNode tr = tbl.addTag("tr"); tr.addTag("td").addTag("b").addText("Use"); tr.addTag("td").addTag("b").addText("Name"); tr.addTag("td").addTag("b").addText("Cardinality"); tr.addTag("td").addTag("b").addText("Type"); tr.addTag("td").addTag("b").addText("Binding"); tr.addTag("td").addTag("b").addText("Documentation"); for (OperationDefinitionParameterComponent p : opd.getParameter()) { genOpParam(tbl, "", p); } addMarkdown(x, opd.getNotes()); inject(opd, x, NarrativeStatus.GENERATED); }
Example #14
Source File: ProfileDrivenRenderer.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private boolean generateByProfile(StructureDefinition profile, boolean showCodeDetails) { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.para().b().tx("Generated Narrative"+(showCodeDetails ? " with Details" : "")); try { generateByProfile(rcontext.getResourceResource(), profile, rcontext.getResourceResource(), profile.getSnapshot().getElement(), profile.getSnapshot().getElement().get(0), getChildrenForPath(profile.getSnapshot().getElement(), rcontext.getResourceResource().getResourceType().toString()), x, rcontext.getResourceResource().getResourceType().toString(), showCodeDetails); } catch (Exception e) { e.printStackTrace(); x.para().b().style("color: maroon").tx("Exception generating Narrative: "+e.getMessage()); } inject(rcontext.getResourceResource(), x, NarrativeStatus.GENERATED); return true; }
Example #15
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private String generateByProfile(Element er, StructureDefinition profile, boolean showCodeDetails) throws IOException { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.addTag("p").addTag("b").addText("Generated Narrative"+(showCodeDetails ? " with Details" : "")); try { generateByProfile(er, profile, er, profile.getSnapshot().getElement(), profile.getSnapshot().getElement().get(0), getChildrenForPath(profile.getSnapshot().getElement(), er.getLocalName()), x, er.getLocalName(), showCodeDetails); } catch (Exception e) { e.printStackTrace(); x.addTag("p").addTag("b").setAttribute("style", "color: maroon").addText("Exception generating Narrative: "+e.getMessage()); } inject(er, x, NarrativeStatus.GENERATED); return new XhtmlComposer(true, pretty).compose(x); }
Example #16
Source File: ArgonautConverter.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private void buildNarrative(DomainResource resource, Element child) { if (!Utilities.noString(child.getTextContent())) { XhtmlNode div = new XhtmlNode(NodeType.Element, "div"); String s = child.getTextContent().trim(); if (Utilities.noString(s)) div.addText("No Narrative provided in the source CDA document"); else div.addText(s); resource.setText(new Narrative().setStatus(NarrativeStatus.ADDITIONAL).setDiv(div)); } }
Example #17
Source File: ResourceComparer.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public XhtmlNode renderErrors(ResourceComparison csc) { XhtmlNode div = new XhtmlNode(NodeType.Element, "div"); XhtmlNode tbl = div.table("grid"); for (ValidationMessage vm : csc.messages) { XhtmlNode tr = tbl.tr(); tr.style("background-color: "+colorForLevel(vm.getLevel())); tr.td().tx(vm.getLocation()); tr.td().tx(vm.getMessage()); tr.td().tx(vm.getLevel().getDisplay()); } return div; }
Example #18
Source File: StructureMapUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * Given a structure map, return a set of analyses on it. * * Returned: * - a list or profiles for what it will create. First profile is the target * - a table with a summary (in xhtml) for easy human undertanding of the mapping * * * @param appInfo * @param map * @return * @throws Exception */ public StructureMapAnalysis analyse(Object appInfo, StructureMap map) throws Exception { ids.clear(); StructureMapAnalysis result = new StructureMapAnalysis(); TransformContext context = new TransformContext(appInfo); VariablesForProfiling vars = new VariablesForProfiling(false, false); StructureMapGroupComponent start = map.getGroup().get(0); for (StructureMapGroupInputComponent t : start.getInput()) { PropertyWithType ti = resolveType(map, t.getType(), t.getMode()); if (t.getMode() == StructureMapInputMode.SOURCE) vars.add(VariableMode.INPUT, t.getName(), ti); else vars.add(VariableMode.OUTPUT, t.getName(), createProfile(map, result.profiles, ti, start.getName(), start)); } result.summary = new XhtmlNode(NodeType.Element, "table").setAttribute("class", "grid"); XhtmlNode tr = result.summary.addTag("tr"); tr.addTag("td").addTag("b").addText("Source"); tr.addTag("td").addTag("b").addText("Target"); log("Start Profiling Transform "+map.getUrl()); analyseGroup("", context, map, vars, start, result); ProfileUtilities pu = new ProfileUtilities(worker, null, pkp); for (StructureDefinition sd : result.getProfiles()) pu.cleanUpDifferential(sd); return result; }
Example #19
Source File: StructureMapUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public StructureMap generateMapFromMappings(StructureDefinition sd) throws IOException, FHIRException { String id = getLogicalMappingId(sd); if (id == null) return null; String prefix = ToolingExtensions.readStringExtension(sd, ToolingExtensions.EXT_MAPPING_PREFIX); String suffix = ToolingExtensions.readStringExtension(sd, ToolingExtensions.EXT_MAPPING_SUFFIX); if (prefix == null || suffix == null) return null; // we build this by text. Any element that has a mapping, we put it's mappings inside it.... StringBuilder b = new StringBuilder(); b.append(prefix); ElementDefinition root = sd.getSnapshot().getElementFirstRep(); String m = getMapping(root, id); if (m != null) b.append(m+"\r\n"); addChildMappings(b, id, "", sd, root, false); b.append("\r\n"); b.append(suffix); b.append("\r\n"); StructureMap map = parse(b.toString()); map.setId(tail(map.getUrl())); if (!map.hasStatus()) map.setStatus(PublicationStatus.DRAFT); map.getText().setStatus(NarrativeStatus.GENERATED); map.getText().setDiv(new XhtmlNode(NodeType.Element, "div")); map.getText().getDiv().addTag("pre").addText(render(map)); return map; }
Example #20
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private boolean generateByProfile(DomainResource r, StructureDefinition profile, boolean showCodeDetails) { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.para().b().tx("Generated Narrative"+(showCodeDetails ? " with Details" : "")); try { generateByProfile(r, profile, r, profile.getSnapshot().getElement(), profile.getSnapshot().getElement().get(0), getChildrenForPath(profile.getSnapshot().getElement(), r.getResourceType().toString()), x, r.getResourceType().toString(), showCodeDetails); } catch (Exception e) { e.printStackTrace(); x.para().b().setAttribute("style", "color: maroon").tx("Exception generating Narrative: "+e.getMessage()); } inject(r, x, NarrativeStatus.GENERATED); return true; }
Example #21
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private String generateByProfile(Element er, StructureDefinition profile, boolean showCodeDetails) throws IOException, org.hl7.fhir.exceptions.FHIRException { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.para().b().tx("Generated Narrative"+(showCodeDetails ? " with Details" : "")); try { generateByProfile(er, profile, er, profile.getSnapshot().getElement(), profile.getSnapshot().getElement().get(0), getChildrenForPath(profile.getSnapshot().getElement(), er.getLocalName()), x, er.getLocalName(), showCodeDetails); } catch (Exception e) { e.printStackTrace(); x.para().b().setAttribute("style", "color: maroon").tx("Exception generating Narrative: "+e.getMessage()); } inject(er, x, NarrativeStatus.GENERATED); return new XhtmlComposer(XhtmlComposer.XML).compose(x); }
Example #22
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public void generate(ResourceContext rcontext, ValueSet vs, ValueSet src, boolean header) throws FHIRException, IOException { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); boolean hasExtensions; if (vs.hasExpansion()) { // for now, we just accept an expansion if there is one hasExtensions = generateExpansion(x, vs, src, header); } else { hasExtensions = generateComposition(rcontext, x, vs, header); } inject(vs, x, hasExtensions ? NarrativeStatus.EXTENSIONS : NarrativeStatus.GENERATED); }
Example #23
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public boolean generate(ResourceContext rcontext, StructureDefinition sd, java.util.Set<String> outputTracker) throws EOperationOutcome, FHIRException, IOException { ProfileUtilities pu = new ProfileUtilities(context, null, pkp); XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.getChildNodes().add(pu.generateTable(definitionsTarget, sd, true, destDir, false, sd.getId(), false, corePath, "", false, false, outputTracker)); inject(sd, x, NarrativeStatus.GENERATED); return true; }
Example #24
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public boolean generate(ResourceContext rcontext, ImplementationGuide ig) throws EOperationOutcome, FHIRException, IOException { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.h2().addText(ig.getName()); x.para().tx("The official URL for this implementation guide is: "); x.pre().tx(ig.getUrl()); addMarkdown(x, ig.getDescription()); inject(ig, x, NarrativeStatus.GENERATED); return true; }
Example #25
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public boolean generate(ResourceContext rcontext, OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.h2().addText(opd.getName()); x.para().addText(Utilities.capitalize(opd.getKind().toString())+": "+opd.getName()); x.para().tx("The official URL for this operation definition is: "); x.pre().tx(opd.getUrl()); addMarkdown(x, opd.getDescription()); if (opd.getSystem()) x.para().tx("URL: [base]/$"+opd.getCode()); for (CodeType c : opd.getResource()) { if (opd.getType()) x.para().tx("URL: [base]/"+c.getValue()+"/$"+opd.getCode()); if (opd.getInstance()) x.para().tx("URL: [base]/"+c.getValue()+"/[id]/$"+opd.getCode()); } x.para().tx("Parameters"); XhtmlNode tbl = x.table( "grid"); XhtmlNode tr = tbl.tr(); tr.td().b().tx("Use"); tr.td().b().tx("Name"); tr.td().b().tx("Cardinality"); tr.td().b().tx("Type"); tr.td().b().tx("Binding"); tr.td().b().tx("Documentation"); for (OperationDefinitionParameterComponent p : opd.getParameter()) { genOpParam(rcontext, tbl, "", p); } addMarkdown(x, opd.getComment()); inject(opd, x, NarrativeStatus.GENERATED); return true; }
Example #26
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public XhtmlNode renderBundle(org.hl7.fhir.dstu3.elementmodel.Element element) throws FHIRException { XhtmlNode root = new XhtmlNode(NodeType.Element, "div"); for (Base b : element.listChildrenByName("entry")) { XhtmlNode c = getHtmlForResource(((org.hl7.fhir.dstu3.elementmodel.Element) b).getNamedChild("resource")); if (c != null) root.getChildNodes().addAll(c.getChildNodes()); root.hr(); } return root; }
Example #27
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private void generateByProfile(DomainResource r, StructureDefinition profile, boolean showCodeDetails) { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.addTag("p").addTag("b").addText("Generated Narrative"+(showCodeDetails ? " with Details" : "")); try { generateByProfile(r, profile, r, profile.getSnapshot().getElement(), profile.getSnapshot().getElement().get(0), getChildrenForPath(profile.getSnapshot().getElement(), r.getResourceType().toString()), x, r.getResourceType().toString(), showCodeDetails); } catch (Exception e) { e.printStackTrace(); x.addTag("p").addTag("b").setAttribute("style", "color: maroon").addText("Exception generating Narrative: "+e.getMessage()); } inject(r, x, NarrativeStatus.GENERATED); }
Example #28
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private String generateByProfile(Element er, StructureDefinition profile, boolean showCodeDetails) throws IOException { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.addTag("p").addTag("b").addText("Generated Narrative"+(showCodeDetails ? " with Details" : "")); try { generateByProfile(er, profile, er, profile.getSnapshot().getElement(), profile.getSnapshot().getElement().get(0), getChildrenForPath(profile.getSnapshot().getElement(), er.getLocalName()), x, er.getLocalName(), showCodeDetails); } catch (Exception e) { e.printStackTrace(); x.addTag("p").addTag("b").setAttribute("style", "color: maroon").addText("Exception generating Narrative: "+e.getMessage()); } inject(er, x, NarrativeStatus.GENERATED); return new XhtmlComposer(true, false).compose(x); }
Example #29
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public void generate(ValueSet vs, ValueSet src, boolean header) { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); if (vs.hasExpansion()) { // for now, we just accept an expansion if there is one generateExpansion(x, vs, src, header); } boolean hasExtensions = generateComposition(x, vs, header); inject(vs, x, hasExtensions ? NarrativeStatus.EXTENSIONS : NarrativeStatus.GENERATED); }
Example #30
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public void generate(OperationDefinition opd) throws EOperationOutcome, FHIRException, IOException { XhtmlNode x = new XhtmlNode(NodeType.Element, "div"); x.addTag("h2").addText(opd.getName()); x.addTag("p").addText(Utilities.capitalize(opd.getKind().toString())+": "+opd.getName()); addMarkdown(x, opd.getDescription()); if (opd.getSystem()) x.addTag("p").addText("URL: [base]/$"+opd.getCode()); for (CodeType c : opd.getType()) { x.addTag("p").addText("URL: [base]/"+c.getValue()+"/$"+opd.getCode()); if (opd.getInstance()) x.addTag("p").addText("URL: [base]/"+c.getValue()+"/[id]/$"+opd.getCode()); } x.addTag("p").addText("Parameters"); XhtmlNode tbl = x.addTag("table").setAttribute("class", "grid"); XhtmlNode tr = tbl.addTag("tr"); tr.addTag("td").addTag("b").addText("Use"); tr.addTag("td").addTag("b").addText("Name"); tr.addTag("td").addTag("b").addText("Cardinality"); tr.addTag("td").addTag("b").addText("Type"); tr.addTag("td").addTag("b").addText("Binding"); tr.addTag("td").addTag("b").addText("Documentation"); for (OperationDefinitionParameterComponent p : opd.getParameter()) { genOpParam(tbl, "", p); } addMarkdown(x, opd.getComment()); inject(opd, x, NarrativeStatus.GENERATED); }