Release new version 5.0.3

This commit is contained in:
Grahame Grieve 2020-05-26 06:15:36 +10:00
parent 9d317fa9d7
commit ccb6b067b3
36 changed files with 496 additions and 87 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -15,6 +15,7 @@ import org.hl7.fhir.r5.model.Bundle.BundleEntrySearchComponent;
import org.hl7.fhir.r5.model.Bundle.BundleType;
import org.hl7.fhir.r5.model.Composition;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
import org.hl7.fhir.r5.utils.EOperationOutcome;
@ -37,7 +38,7 @@ public class BundleRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return null;
}

View File

@ -6,6 +6,7 @@ import java.io.UnsupportedEncodingException;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.CapabilityStatement;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent;
@ -81,7 +82,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
tr = t.tr();
tr.td().addText(r.getType());
if (r.hasProfile()) {
tr.td().ah(context.getPrefix()+r.getProfile()).addText(r.getProfile());
tr.td().ah(context.getSpecLink()+r.getProfile()).addText(r.getProfile());
}
tr.td().addText(showOp(r, TypeRestfulInteraction.READ));
if (hasVRead)
@ -112,7 +113,7 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return ((CapabilityStatement) r).present();
}

View File

@ -414,7 +414,7 @@ public class CodeSystemRenderer extends TerminologyRenderer {
first = false;
XhtmlNode span = td.span(null, mapping.comp.hasRelationship() ? mapping.comp.getRelationship().toCode() : "");
span.addText(getCharForRelationship(mapping.comp));
a = td.ah(getContext().getPrefix()+m.getLink()+"#"+makeAnchor(mapping.group.getTarget(), mapping.comp.getCode()));
a = td.ah(getContext().getSpecLink()+m.getLink()+"#"+makeAnchor(mapping.group.getTarget(), mapping.comp.getCode()));
a.addText(mapping.comp.getCode());
if (!Utilities.noString(mapping.comp.getComment()))
td.i().tx("("+mapping.comp.getComment()+")");

View File

@ -6,6 +6,7 @@ import java.io.UnsupportedEncodingException;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StringType;
import org.hl7.fhir.r5.model.CompartmentDefinition;
import org.hl7.fhir.r5.model.CompartmentDefinition.CompartmentDefinitionResourceComponent;
@ -67,7 +68,7 @@ public class CompartmentDefinitionRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return ((CompartmentDefinition) r).present();
}

View File

@ -9,6 +9,7 @@ import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.DiagnosticReport;
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper;
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.PropertyWrapper;
@ -126,7 +127,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return display((DiagnosticReport) r);
}

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -19,7 +20,7 @@ public class EncounterRenderer extends ResourceRenderer {
return false;
}
public String display(DomainResource dr) {
public String display(Resource dr) {
return "Not done yet";
}

View File

@ -7,6 +7,7 @@ import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.ImplementationGuide;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -42,7 +43,7 @@ public class ImplementationGuideRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return ((ImplementationGuide) r).present();
}

View File

@ -7,6 +7,7 @@ import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
@ -51,7 +52,7 @@ public class LiquidRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return "not done yet";
}

View File

@ -11,6 +11,7 @@ import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.ListResource;
import org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent;
import org.hl7.fhir.r5.model.Reference;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper;
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
@ -183,7 +184,7 @@ public class ListRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return ((ListResource) r).getTitle();
}

View File

@ -9,6 +9,7 @@ import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.NamingSystem;
import org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent;
import org.hl7.fhir.r5.model.PrimitiveType;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
@ -120,7 +121,7 @@ public class NamingSystemRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return ((NamingSystem) r).present();
}

View File

@ -11,6 +11,7 @@ import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Extension;
import org.hl7.fhir.r5.model.OperationDefinition;
import org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
@ -74,7 +75,7 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return ((OperationDefinition) r).present();
}
@ -104,7 +105,7 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
if (p.hasSearchType()) {
td.br();
td.tx("(");
td.ah( context.getPrefix() == null ? "search.html#"+p.getSearchType().toCode() : Utilities.pathURL(context.getPrefix(), "search.html#"+p.getSearchType().toCode())).tx(p.getSearchType().toCode());
td.ah( context.getSpecLink() == null ? "search.html#"+p.getSearchType().toCode() : Utilities.pathURL(context.getSpecLink(), "search.html#"+p.getSearchType().toCode())).tx(p.getSearchType().toCode());
td.tx(")");
}
td = tr.td();

View File

@ -11,6 +11,7 @@ import org.hl7.fhir.r5.model.ExtensionHelper;
import org.hl7.fhir.r5.model.OperationOutcome;
import org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StringType;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
@ -84,7 +85,7 @@ public class OperationOutcomeRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return display((OperationOutcome) r);
}

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -20,7 +21,7 @@ public class PatientRenderer extends ResourceRenderer {
return false;
}
public String display(DomainResource dr) {
public String display(Resource dr) {
return "Not done yet";
}

View File

@ -110,7 +110,7 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return "todo";
}
//

View File

@ -8,6 +8,7 @@ import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Provenance;
import org.hl7.fhir.r5.model.Provenance.ProvenanceAgentComponent;
import org.hl7.fhir.r5.model.Reference;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -141,7 +142,7 @@ public class ProvenanceRenderer extends ResourceRenderer {
return hasExtensions;
}
public String display(DomainResource dr) throws UnsupportedEncodingException, IOException {
public String display(Resource dr) throws UnsupportedEncodingException, IOException {
return display((Provenance) dr);
}

View File

@ -2,19 +2,25 @@ package org.hl7.fhir.r5.renderers;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Expression;
import org.hl7.fhir.r5.model.Extension;
import org.hl7.fhir.r5.model.Questionnaire;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemInitialComponent;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
import org.hl7.fhir.r5.utils.ToolingExtensions;
@ -28,30 +34,24 @@ import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
public class QuestionnaireRenderer extends TerminologyRenderer {
private boolean tree = false;
public QuestionnaireRenderer(RenderingContext context) {
super(context);
}
public boolean isTree() {
return tree;
}
public void setTree(boolean tree) {
this.tree = tree;
}
public boolean render(XhtmlNode x, DomainResource q) throws UnsupportedEncodingException, IOException {
return render(x, (Questionnaire) q);
}
public boolean render(XhtmlNode x, Questionnaire q) throws UnsupportedEncodingException, IOException {
if (tree) {
return renderTree(x, q);
} else {
return renderForm(x, q);
switch (context.getQuestionnaireMode()) {
case FORM: return renderForm(x, q);
case LINKS: return renderLinks(x, q);
case LOGIC: return renderLogic(x, q);
case DEFNS: return renderDefns(x, q);
case TREE: return renderTree(x, q);
default:
throw new Error("Unknown Questionnaire Renderer Mode");
}
}
@ -59,8 +59,8 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
TableModel model = gen.new TableModel("qtree="+q.getId(), true);
model.setAlternating(true);
model.setDocoImg(context.getPrefix() +"help16.png");
model.setDocoRef(context.getPrefix()+"formats.html#table");
model.setDocoImg(context.getSpecLink() +"help16.png");
model.setDocoRef(context.getSpecLink()+"formats.html#table");
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Cardinality"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0));
@ -87,19 +87,19 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
String txt = (i.hasPrefix() ? i.getPrefix() + ". " : "") + i.getText();
r.getCells().add(gen.new Cell(null, null, txt, null, null));
r.getCells().add(gen.new Cell(null, null, (i.getRequired() ? "1" : "0")+".."+(i.getRepeats() ? "*" : "1"), null, null));
r.getCells().add(gen.new Cell(null, context.getPrefix()+"codesystem-item-type.html#"+i.getType().toCode(), i.getType().toCode(), null, null));
r.getCells().add(gen.new Cell(null, context.getSpecLink()+"codesystem-item-type.html#"+i.getType().toCode(), i.getType().toCode(), null, null));
// flags:
Cell flags = gen.new Cell();
r.getCells().add(flags);
if (i.getReadOnly()) {
flags.addPiece(gen.new Piece(Utilities.pathURL(context.getPrefix(), "questionnaire-definitions.html#Questionnaire.item.readOnly"), null, "Is Readonly").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("src", Utilities.path(context.getDestDir(), "icon-qi-readonly.png"))));
flags.addPiece(gen.new Piece(Utilities.pathURL(context.getSpecLink(), "questionnaire-definitions.html#Questionnaire.item.readOnly"), null, "Is Readonly").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("src", Utilities.path(context.getDestDir(), "icon-qi-readonly.png"))));
}
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) {
flags.addPiece(gen.new Piece("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", null, "Can change the subject of the questionnaire").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("src", Utilities.path(context.getDestDir(), "icon-qi-subject.png"))));
}
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden")) {
flags.addPiece(gen.new Piece(Utilities.pathURL(context.getPrefix(), "extension-questionnaire-hidden.html"), null, "Is a hidden item").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("src", Utilities.path(context.getDestDir(), "icon-qi-hidden.png"))));
flags.addPiece(gen.new Piece(Utilities.pathURL(context.getSpecLink(), "extension-questionnaire-hidden.html"), null, "Is a hidden item").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("src", Utilities.path(context.getDestDir(), "icon-qi-hidden.png"))));
}
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay")) {
flags.addPiece(gen.new Piece("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", null, "Is optional to display").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("src", Utilities.path(context.getDestDir(), "icon-qi-optional.png"))));
@ -210,11 +210,9 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
for (QuestionnaireItemComponent c : i.getItem()) {
hasExt = renderTreeItem(gen, r.getSubRows(), q, c) || hasExt;
}
return hasExt;
return hasExt;
}
private void addExpression(Piece p, Expression exp, String label, String url) {
XhtmlNode x = new XhtmlNode(NodeType.Element, "li").style("font-size: 11px");
p.addHtml(x);
@ -223,6 +221,129 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
x.code(exp.getExpression());
}
private boolean renderLogic(XhtmlNode x, Questionnaire q) throws FHIRException, IOException {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
TableModel model = gen.new TableModel("qtree="+q.getId(), true);
model.setAlternating(true);
model.setDocoImg(context.getSpecLink() +"help16.png");
model.setDocoRef(context.getSpecLink()+"formats.html#table");
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Description & Constraints"), translate("sd.hint", "Additional information about the item"), null, 0));
boolean hasExt = false;
for (QuestionnaireItemComponent i : q.getItem()) {
hasExt = renderLogicItem(gen, model.getRows(), q, i) || hasExt;
}
XhtmlNode xn = gen.generate(model, context.getDestDir(), 1, null);
x.getChildNodes().add(xn);
return hasExt;
}
private boolean renderLogicItem(HierarchicalTableGenerator gen, List<Row> rows, Questionnaire q, QuestionnaireItemComponent i) throws IOException {
Row r = gen.new Row();
rows.add(r);
boolean hasExt = false;
r.setIcon("icon-q-"+i.getType().toCode()+".png", i.getType().getDisplay());
r.getCells().add(gen.new Cell(null, context.getDefinitionsTarget() == null ? "" : context.getDefinitionsTarget()+"-definitions.html#extension."+i.getLinkId(), i.getLinkId(), null, null));
Cell defn = gen.new Cell();
r.getCells().add(defn);
if (i.hasMaxLength()) {
defn.getPieces().add(gen.new Piece(null, "Max Length: ", null));
defn.getPieces().add(gen.new Piece(null, Integer.toString(i.getMaxLength()), null));
}
if (i.hasDefinition()) {
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
defn.getPieces().add(gen.new Piece(null, "Definition: ", null));
defn.getPieces().add(gen.new Piece(null, i.getDefinition(), null));
}
if (i.hasEnableWhen()) {
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
defn.getPieces().add(gen.new Piece(null, "Enable When: ", null));
defn.getPieces().add(gen.new Piece(null, "todo", null));
}
if (i.hasAnswerValueSet()) {
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
defn.getPieces().add(gen.new Piece(null, "Value Set: ", null));
if (i.getAnswerValueSet().startsWith("#")) {
ValueSet vs = (ValueSet) q.getContained(i.getAnswerValueSet().substring(1));
if (vs == null) {
defn.getPieces().add(gen.new Piece(null, i.getAnswerValueSet(), null));
} else {
defn.getPieces().add(gen.new Piece("todo", vs.present(), null));
}
} else {
ValueSet vs = context.getWorker().fetchResource(ValueSet.class, i.getAnswerValueSet());
if (vs == null || !vs.hasUserData("path")) {
defn.getPieces().add(gen.new Piece(null, i.getAnswerValueSet(), null));
} else {
defn.getPieces().add(gen.new Piece(vs.getUserString("path"), vs.present(), null));
}
}
}
if (i.hasAnswerOption()) {
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
defn.getPieces().add(gen.new Piece(null, "Options: ", null));
defn.getPieces().add(gen.new Piece(context.getDefinitionsTarget()+"#"+i.getLinkId(), Integer.toString(i.getAnswerOption().size())+" "+Utilities.pluralize("option", i.getAnswerOption().size()), null));
}
if (i.hasInitial()) {
for (QuestionnaireItemInitialComponent v : i.getInitial()) {
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
defn.getPieces().add(gen.new Piece(null, "Initial Value: ", null));
defn.getPieces().add(gen.new Piece(null, v.getValue().fhirType(), null));
defn.getPieces().add(gen.new Piece(null, " = ", null));
if (v.getValue().isPrimitive()) {
defn.getPieces().add(gen.new Piece(null, v.getValue().primitiveValue(), null));
} else {
defn.getPieces().add(gen.new Piece(null, "{todo}", null));
}
}
}
// still todo
//
//http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn
//
//http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-width
//http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod
//http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl
//http://hl7.org/fhir/StructureDefinition/questionnaire-sliderStepValue
if (i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression") || i.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression")) {
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
defn.getPieces().add(gen.new Piece(null, "Expressions: ", null));
Piece p = gen.new Piece("ul");
defn.getPieces().add(p);
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression")) {
addExpression(p, e.getValueExpression(), "Initial Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression");
}
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression")) {
addExpression(p, e.getValueExpression(), "Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-contextExpression");
}
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext")) {
addExpression(p, e.getValueExpression(), "Item Context", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext");
}
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression")) {
addExpression(p, e.getValueExpression(), "Enable When", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression");
}
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression")) {
addExpression(p, e.getValueExpression(), "Calculated Value", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression");
}
for (Extension e : i.getExtensionsByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression")) {
addExpression(p, e.getValueExpression(), "Candidates", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-candidateExpression");
}
}
for (QuestionnaireItemComponent c : i.getItem()) {
hasExt = renderLogicItem(gen, r.getSubRows(), q, c) || hasExt;
}
return hasExt;
}
public boolean renderForm(XhtmlNode x, Questionnaire q) throws UnsupportedEncodingException, IOException {
boolean hasExt = false;
XhtmlNode d = x.div();
@ -353,7 +474,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
}
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden")) {
hasFlag = true;
flags.ah(Utilities.pathURL(context.getPrefix(), "extension-questionnaire-hidden.html"), "Is a hidden item").img(Utilities.path(context.getDestDir(), "icon-qi-hidden.png"));
flags.ah(Utilities.pathURL(context.getSpecLink(), "extension-questionnaire-hidden.html"), "Is a hidden item").img(Utilities.path(context.getDestDir(), "icon-qi-hidden.png"));
d.style("background-color: #eeeeee");
}
if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay")) {
@ -494,12 +615,207 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
select.option("a", "??", false);
}
public String display(DomainResource dr) throws UnsupportedEncodingException, IOException {
public String display(Resource dr) throws UnsupportedEncodingException, IOException {
return display((Questionnaire) dr);
}
public String display(Questionnaire q) throws UnsupportedEncodingException, IOException {
return "Questionnaire "+q.present();
}
private boolean renderLinks(XhtmlNode x, Questionnaire q) {
x.para().tx("Try this questionnaire out:");
XhtmlNode ul = x.ul();
ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getSelfLink(), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library");
return false;
}
private boolean renderDefns(XhtmlNode x, Questionnaire q) throws IOException {
XhtmlNode tbl = x.table("dict");
boolean ext = false;
for (QuestionnaireItemComponent qi : q.getItem()) {
ext = renderDefinition(tbl, q, qi, new ArrayList<>()) || ext;
}
return ext;
}
private boolean renderDefinition(XhtmlNode tbl, Questionnaire q, QuestionnaireItemComponent qi, List<QuestionnaireItemComponent> parents) throws IOException {
boolean ext = false;
XhtmlNode td = tbl.tr().td("structure").colspan("2").span(null, null).attribute("class", "self-link-parent");
td.an(qi.getLinkId());
for (QuestionnaireItemComponent p : parents) {
td.ah("#"+p.getLinkId()).img(Utilities.path(context.getDestDir(), "icon_q_item.png"));
td.tx(" > ");
}
td.img(Utilities.path(context.getDestDir(), "icon_q_item.png"));
td.tx(" Item ");
td.b().tx(qi.getLinkId());
// general information
defn(tbl, "Link Id", qi.getLinkId());
defn(tbl, "Prefix", qi.getPrefix());
defn(tbl, "Text", qi.getText());
defn(tbl, "Type", qi.getType().getDisplay());
defn(tbl, "Required", qi.getRequired(), true);
defn(tbl, "Repeats", qi.getRepeats(), true);
defn(tbl, "Read Only", qi.getReadOnly(), false);
if (ToolingExtensions.readBoolExtension(qi, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) {
defn(tbl, "Subject", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject", "This element changes who the subject of the question is", null);
}
// content control
defn(tbl, "Max Length", qi.getMaxLength());
if (qi.hasAnswerValueSet()) {
defn(tbl, "Value Set", qi.getDefinition(), context.getWorker().fetchResource(ValueSet.class, qi.getAnswerValueSet()));
}
if (qi.hasAnswerOption()) {
XhtmlNode tr = tbl.tr();
tr.td().tx("Allowed Answers");
XhtmlNode ul = tr.td().ul();
for (QuestionnaireItemAnswerOptionComponent ans : qi.getAnswerOption()) {
XhtmlNode li = ul.li();
render(li, ans.getValue());
if (ans.getInitialSelected()) {
li.tx(" (initially selected)");
}
}
}
if (qi.hasInitial()) {
XhtmlNode tr = tbl.tr();
tr.td().tx(Utilities.pluralize("Initial Answer", qi.getInitial().size()));
if (qi.getInitial().size() == 1) {
render(tr.td(), qi.getInitialFirstRep().getValue());
} else {
XhtmlNode ul = tr.td().ul();
for (QuestionnaireItemInitialComponent ans : qi.getInitial()) {
XhtmlNode li = ul.li();
render(li, ans.getValue());
}
}
}
// appearance
if (qi.hasExtension("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory")) {
XhtmlNode tr = tbl.tr();
tr.td().ah("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory").tx("Display Category");
render(tr.td(), qi.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory").getValue());
}
if (ToolingExtensions.readBoolExtension(qi, "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden")) {
defn(tbl, "Hidden Item", "http://hl7.org/fhir/StructureDefinition/questionnaire-displayCategory", "This item is a hidden question", null);
}
if (ToolingExtensions.readBoolExtension(qi, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay")) {
defn(tbl, "Hidden Item", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-optionalDisplay", "This item is optional to display", null);
}
// formal definitions
if (qi.hasDefinition()) {
defn(tbl, "Definition", qi.getDefinition(), context.getWorker().fetchResource(Resource.class, qi.getDefinition()));
}
if (qi.hasCode()) {
XhtmlNode tr = tbl.tr();
tr.td().tx(Utilities.pluralize("Code", qi.getCode().size()));
XhtmlNode ul = tr.td().ul();
for (Coding c : qi.getCode()) {
renderCoding(ul.li(), c);
}
}
if (qi.hasExtension("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod")) {
XhtmlNode tr = tbl.tr();
tr.td().ah("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod").tx("Observation Link Period");
render(tr.td(), qi.getExtensionByUrl("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod").getValue());
}
// dynamic management
if (qi.hasEnableWhen()) {
XhtmlNode tr = tbl.tr();
tr.td().tx("Enable When");
td = tr.td();
if (qi.getEnableWhen().size() == 1) {
renderEnableWhen(td, qi.getEnableWhen().get(0));
} else {
td.tx(qi.getEnableBehavior().getDisplay()+" are true:");
XhtmlNode ul = td.ul();
for (QuestionnaireItemEnableWhenComponent ew : qi.getEnableWhen()) {
renderEnableWhen(ul.li(), ew);
}
}
}
// other stuff
List<QuestionnaireItemComponent> curr = new ArrayList<>();
curr.addAll(parents);
curr.add(qi);
for (QuestionnaireItemComponent qic : qi.getItem()) {
ext = renderDefinition(tbl, q, qic, curr) || ext;
}
return ext;
}
private void defn(XhtmlNode tbl, String name, String url, Resource res) throws UnsupportedEncodingException, IOException {
if (res != null && res.hasUserData("path")) {
defn(tbl, "Definition", RendererFactory.factory(res, context).display(res), res.getUserString("path"));
} else if (Utilities.isAbsoluteUrl(url)) {
defn(tbl, "Definition", url, url);
} {
defn(tbl, "Definition", url);
}
}
private void renderEnableWhen(XhtmlNode x, QuestionnaireItemEnableWhenComponent ew) {
x.ah("#"+ew.getQuestion()).tx(ew.getQuestion());
x.tx(" ");
x.tx(ew.getOperator().toCode());
x.tx(" ");
x.tx(display(ew.getAnswer()));
}
private void defn(XhtmlNode tbl, String name, int value) {
if (value > 0) {
XhtmlNode tr = tbl.tr();
tr.td().tx(name);
tr.td().tx(value);
}
}
private void defn(XhtmlNode tbl, String name, String value) {
if (!Utilities.noString(value)) {
XhtmlNode tr = tbl.tr();
tr.td().tx(name);
tr.td().tx(value);
}
}
private void defn(XhtmlNode tbl, String name, String value, String url) {
if (!Utilities.noString(value)) {
XhtmlNode tr = tbl.tr();
tr.td().tx(name);
tr.td().ah(url).tx(value);
}
}
private void defn(XhtmlNode tbl, String name, String nurl, String value, String url) {
if (!Utilities.noString(value)) {
XhtmlNode tr = tbl.tr();
tr.td().ah(nurl).tx(name);
if (url != null) {
tr.td().ah(url).tx(value);
} else {
tr.td().tx(value);
}
}
}
private void defn(XhtmlNode tbl, String name, boolean value, boolean ifFalse) {
if (ifFalse || value) {
XhtmlNode tr = tbl.tr();
tr.td().tx(name);
tr.td().tx(Boolean.toString(value));
}
}
}

View File

@ -88,7 +88,7 @@ public abstract class ResourceRenderer extends DataRenderer {
x.tx(display(r));
}
public abstract String display(DomainResource r) throws UnsupportedEncodingException, IOException;
public abstract String display(Resource r) throws UnsupportedEncodingException, IOException;
public static void inject(DomainResource r, XhtmlNode x, NarrativeStatus status) {
if (!x.hasAttribute("xmlns"))
@ -104,7 +104,7 @@ public abstract class ResourceRenderer extends DataRenderer {
r.getText().setStatus(status);
} else {
XhtmlNode n = r.getText().getDiv();
n.hr();
n.clear();
n.getChildNodes().addAll(x.getChildNodes());
}
}

View File

@ -6,6 +6,7 @@ import java.io.UnsupportedEncodingException;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
@ -26,7 +27,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
}
public boolean render(XhtmlNode x, StructureDefinition sd) throws FHIRFormatError, DefinitionException, IOException {
x.getChildNodes().add(context.getProfileUtilities().generateTable(context.getDefinitionsTarget(), sd, true, context.getDestDir(), false, sd.getId(), false, context.getPrefix(), "", false, false, null, false));
x.getChildNodes().add(context.getProfileUtilities().generateTable(context.getDefinitionsTarget(), sd, true, context.getDestDir(), false, sd.getId(), false, context.getSpecLink(), "", false, false, null, false));
return true;
}
@ -39,7 +40,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
}
@Override
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return ((StructureDefinition) r).present();
}

View File

@ -40,7 +40,7 @@ public abstract class TerminologyRenderer extends ResourceRenderer {
super(context, rcontext);
}
public String display(DomainResource r) throws UnsupportedEncodingException, IOException {
public String display(Resource r) throws UnsupportedEncodingException, IOException {
return ((CanonicalResource) r).present();
}
@ -103,7 +103,7 @@ public abstract class TerminologyRenderer extends ResourceRenderer {
for (UsedConceptMap m : maps) {
XhtmlNode td = tr.td();
XhtmlNode b = td.b();
XhtmlNode a = b.ah(getContext().getPrefix()+m.getLink());
XhtmlNode a = b.ah(getContext().getSpecLink()+m.getLink());
a.addText(m.getDetails().getName());
if (m.getDetails().isDoDescription() && m.getMap().hasDescription())
addMarkdown(td, m.getMap().getDescription());
@ -163,11 +163,11 @@ public abstract class TerminologyRenderer extends ResourceRenderer {
XhtmlNode a = li.ah(spec);
a.code(inc.getSystem());
} else if (cs != null && ref != null) {
if (!Utilities.noString(getContext().getPrefix()) && ref.startsWith("http://hl7.org/fhir/"))
if (!Utilities.noString(getContext().getSpecLink()) && ref.startsWith("http://hl7.org/fhir/"))
ref = ref.substring(20)+"/index.html";
else if (addHtml && !ref.contains(".html"))
ref = ref + ".html";
XhtmlNode a = li.ah(getContext().getPrefix()+ref.replace("\\", "/"));
XhtmlNode a = li.ah(getContext().getSpecLink()+ref.replace("\\", "/"));
a.code(inc.getSystem());
} else {
li.code(inc.getSystem());
@ -283,10 +283,10 @@ public abstract class TerminologyRenderer extends ResourceRenderer {
}
private String adjustForPath(String ref) {
if (getContext().getPrefix() == null)
if (getContext().getSpecLink() == null)
return ref;
else
return getContext().getPrefix()+ref;
return getContext().getSpecLink()+ref;
}

View File

@ -207,7 +207,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
if (ref == null)
p.code(vs.getExpansion().getContains().get(0).getSystem());
else
p.ah(getContext().getPrefix()+ref).code(vs.getExpansion().getContains().get(0).getSystem());
p.ah(getContext().getSpecLink()+ref).code(vs.getExpansion().getContains().get(0).getSystem());
}
XhtmlNode t = x.table( "codes");
XhtmlNode tr = t.tr();
@ -638,7 +638,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
} else
td.addText(code);
} else {
String href = getContext().getPrefix()+getCsRef(e);
String href = getContext().getSpecLink()+getCsRef(e);
if (href.contains("#"))
href = href + "-"+Utilities.nmtokenize(code);
else
@ -662,9 +662,9 @@ public class ValueSetRenderer extends TerminologyRenderer {
String cslink = getCsRef(cs);
XhtmlNode a = null;
if (cslink != null)
a = td.ah(getContext().getPrefix()+cslink+"#"+cs.getId()+"-"+code);
a = td.ah(getContext().getSpecLink()+cslink+"#"+cs.getId()+"-"+code);
else
a = td.ah(getContext().getPrefix()+vslink+"#"+code);
a = td.ah(getContext().getSpecLink()+vslink+"#"+code);
a.addText(code);
}
@ -796,7 +796,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
} else {
li.tx(f.getProperty()+" "+describe(f.getOp())+" ");
if (e != null && codeExistsInValueSet(e, f.getValue())) {
String href = getContext().getPrefix()+getCsRef(e);
String href = getContext().getSpecLink()+getCsRef(e);
if (href.contains("#"))
href = href + "-"+Utilities.nmtokenize(f.getValue());
else

View File

@ -33,22 +33,52 @@ public class RenderingContext {
RESOURCE, IG
}
protected IWorkerContext worker;
protected MarkDownProcessor markdown;
protected ResourceRendererMode mode;
public enum QuestionnaireRendererMode {
/**
* A visual presentation of the questionnaire, with a set of property panes that can be toggled on and off.
* Note that this is not the same as how the questionnaire would like on a form filler, since all dynamic behavior is ignored
*/
FORM,
/**
* a structured tree that presents the content of the questionnaire in a logical fashion
*/
TREE,
/**
* A structured tree that presents the enableWhen, terminology and expression bindings for the questionnaire
*/
LOGIC,
/**
* A presentation that lists all the items, with full details about them
*/
DEFNS,
/**
* Rendered links to various openly available Form Filler applications that know how to render a questionnaire published in a package
*/
LINKS
}
private IWorkerContext worker;
private MarkDownProcessor markdown;
private ResourceRendererMode mode;
private IReferenceResolver resolver;
private ILiquidTemplateProvider templateProvider;
private IEvaluationContext services;
private ITypeParser parser;
protected String lang;
protected String prefix;
private String lang;
private String specLink;
private String selfLink; // absolute link to where the content is to be found (only used in a few circumstances when making external references to tools)
private int headerLevelContext;
private boolean canonicalUrlsAsLinks;
private boolean pretty;
private boolean header;
protected ValidationOptions terminologyServiceOptions;
private ValidationOptions terminologyServiceOptions;
private boolean noSlowLookup;
private String tooCostlyNoteEmpty;
private String tooCostlyNoteNotEmpty;
@ -56,26 +86,27 @@ public class RenderingContext {
private String tooCostlyNoteNotEmptyDependent;
private List<String> codeSystemPropList = new ArrayList<>();
protected ProfileUtilities profileUtilities;
private ProfileUtilities profileUtilities;
private String definitionsTarget;
private String destDir;
private boolean inlineGraphics;
private QuestionnaireRendererMode questionnaireMode = QuestionnaireRendererMode.FORM;
/**
*
* @param context - access to all related resources that might be needed
* @param markdown - appropriate markdown processing engine
* @param terminologyServiceOptions - options to use when looking up codes
* @param prefix - path to FHIR specification
* @param specLink - path to FHIR specification
* @param lang - langauage to render in
*/
public RenderingContext(IWorkerContext worker, MarkDownProcessor markdown, ValidationOptions terminologyServiceOptions, String prefix, String lang, ResourceRendererMode mode) {
public RenderingContext(IWorkerContext worker, MarkDownProcessor markdown, ValidationOptions terminologyServiceOptions, String specLink, String lang, ResourceRendererMode mode) {
super();
this.worker = worker;
this.markdown = markdown;
this.lang = lang;
this.prefix = prefix;
this.specLink = specLink;
this.mode = mode;
this.terminologyServiceOptions = terminologyServiceOptions;
profileUtilities = new ProfileUtilities(worker, null, null);
@ -115,8 +146,8 @@ public class RenderingContext {
return lang;
}
public String getPrefix() {
return prefix;
public String getSpecLink() {
return specLink;
}
public ValidationOptions getTerminologyServiceOptions() {
@ -262,7 +293,7 @@ public class RenderingContext {
}
public RenderingContext copy() {
RenderingContext res = new RenderingContext(worker, markdown, terminologyServiceOptions, prefix, lang, mode);
RenderingContext res = new RenderingContext(worker, markdown, terminologyServiceOptions, specLink, lang, mode);
res.resolver = resolver;
res.templateProvider = templateProvider;
@ -302,6 +333,22 @@ public class RenderingContext {
public void setHeader(boolean header) {
this.header = header;
}
public QuestionnaireRendererMode getQuestionnaireMode() {
return questionnaireMode;
}
public void setQuestionnaireMode(QuestionnaireRendererMode questionnaireMode) {
this.questionnaireMode = questionnaireMode;
}
public String getSelfLink() {
return selfLink;
}
public void setSelfLink(String selfLink) {
this.selfLink = selfLink;
}

View File

@ -15,11 +15,14 @@ import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
import org.hl7.fhir.r5.formats.XmlParser;
import org.hl7.fhir.r5.model.DomainResource;
import org.hl7.fhir.r5.model.Questionnaire;
import org.hl7.fhir.r5.renderers.RendererFactory;
import org.hl7.fhir.r5.renderers.ResourceRenderer;
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.RenderingContext.QuestionnaireRendererMode;
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.utilities.TerminologyServiceOptions;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
import org.hl7.fhir.utilities.xml.XMLUtil;
@ -91,6 +94,7 @@ public class NarrativeGenerationTests {
rc.setDestDir("C:\\work\\org.hl7.fhir\\packages\\packages\\hl7.fhir.pubpack\\package\\other\\");
rc.setHeader(test.isHeader());
rc.setDefinitionsTarget("test.html");
rc.setTerminologyServiceOptions(TerminologyServiceOptions.defaults());
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "narrative", test.getId() + "-expected.xml"), new FileOutputStream(TestingUtilities.tempFile("narrative", test.getId() + "-expected.xml")));
DomainResource source = (DomainResource) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "narrative", test.getId() + "-input.xml"));
DomainResource target = (DomainResource) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "narrative", test.getId() + "-expected.xml"));
@ -99,6 +103,14 @@ public class NarrativeGenerationTests {
source = (DomainResource) new XmlParser().parse(new FileInputStream(TestingUtilities.tempFile("narrative", test.getId() + "-actual.xml")));
String html = HEADER+new XhtmlComposer(true).compose(source.getText().getDiv())+FOOTER;
TextFile.stringToFile(html, TestingUtilities.tempFile("narrative", test.getId() + ".html"));
// if (source instanceof Questionnaire) {
// for (QuestionnaireRendererMode mode : QuestionnaireRendererMode.values()) {
// rc.setQuestionnaireMode(mode);
// RendererFactory.factory(source, rc).render(source);
// html = HEADER+new XhtmlComposer(true).compose(source.getText().getDiv())+FOOTER;
// TextFile.stringToFile(html, TestingUtilities.tempFile("narrative", test.getId() +"-"+ mode.toString()+ ".html"));
// }
// }
Assertions.assertTrue(source.equalsDeep(target), "Output does not match expected");
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -506,6 +506,10 @@ public class XhtmlNode implements IBaseXhtml {
return addTag("td");
}
public XhtmlNode td(String clss) {
return addTag("td").attribute("class", clss);
}
public XhtmlNode colspan(String n) {
return setAttribute("colspan", n);
}
@ -545,10 +549,15 @@ public class XhtmlNode implements IBaseXhtml {
public XhtmlNode i() {
return addTag("i");
}
public XhtmlNode tx(String cnt) {
return addText(cnt);
}
public XhtmlNode tx(int cnt) {
return addText(Integer.toString(cnt));
}
public XhtmlNode ah(String href) {
return addTag("a").attribute("href", href);
}
@ -708,6 +717,12 @@ public class XhtmlNode implements IBaseXhtml {
}
public void clear() {
getChildNodes().clear();
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -13,11 +13,11 @@
each other. It is fine to bump the point version of this POM without affecting
HAPI FHIR.
-->
<version>5.0.2-SNAPSHOT</version>
<version>5.0.3-SNAPSHOT</version>
<properties>
<hapi_fhir_version>5.0.0</hapi_fhir_version>
<validator_test_case_version>1.1.14</validator_test_case_version>
<validator_test_case_version>1.1.15</validator_test_case_version>
<junit_jupiter_version>5.6.2</junit_jupiter_version>
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
<jacoco_version>0.8.5</jacoco_version>

View File

@ -6,6 +6,11 @@ title: FHIR Validator Release Notes
## Current (not released yet)
(no changes yet)
## v5.0.3 (2020-05-26)
* Fix for Core issue #95 - recursion on profile definition
## v5.0.2 (2020-05-22)
@ -194,4 +199,4 @@ title: FHIR Validator Release Notes
## v4.1.60 (2020-02-02)
* This r
* This

View File

@ -1,7 +1,7 @@
@echo off
set oldver=4.2.31
set newver=5.0.2
set oldver=5.0.2
set newver=5.0.3
echo ..
echo =========================================================================