Merge pull request #1117 from hapifhir/gg-202302-searchparam-rendering

Gg 202302 searchparam rendering
This commit is contained in:
Grahame Grieve 2023-02-15 20:26:02 +11:00 committed by GitHub
commit 8bca8a9408
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 15 deletions

View File

@ -110,12 +110,7 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
XhtmlNode td = tr.td(); XhtmlNode td = tr.td();
td.addText(path+p.getName()); td.addText(path+p.getName());
StandardsStatus ss = ToolingExtensions.getStandardsStatus(p); StandardsStatus ss = ToolingExtensions.getStandardsStatus(p);
if (ss != null) { genStandardsStatus(td, ss);
td.tx(" ");
XhtmlNode a = td.ah("versions.html#std-process", "Standards Status = "+ss.toDisplay());
a.style("padding-left: 3px; padding-right: 3px; border: 1px grey solid; font-weight: bold; color: black; background-color: "+ss.getColor());
a.tx(ss.getAbbrev());
}
td = tr.td(); td = tr.td();
if (p.hasScope()) { if (p.hasScope()) {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
@ -161,4 +156,5 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
} }
} }
} }

View File

@ -6,8 +6,10 @@ import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode; import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
import org.hl7.fhir.r5.utils.TranslatingUtilities; import org.hl7.fhir.r5.utils.TranslatingUtilities;
import org.hl7.fhir.utilities.MarkDownProcessor; import org.hl7.fhir.utilities.MarkDownProcessor;
import org.hl7.fhir.utilities.StandardsStatus;
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect; import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
import org.hl7.fhir.utilities.validation.ValidationOptions; import org.hl7.fhir.utilities.validation.ValidationOptions;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
/** /**
* Rendering framework: * Rendering framework:
@ -71,4 +73,13 @@ public class Renderer extends TranslatingUtilities {
return context.getWorker().formatMessage(theMessage, theMessageArguments); return context.getWorker().formatMessage(theMessage, theMessageArguments);
} }
public void genStandardsStatus(XhtmlNode td, StandardsStatus ss) {
if (ss != null) {
td.tx(" ");
XhtmlNode a = td.ah("versions.html#std-process", "Standards Status = "+ss.toDisplay());
a.style("padding-left: 3px; padding-right: 3px; border: 1px grey solid; font-weight: bold; color: black; background-color: "+ss.getColor());
a.tx(ss.getAbbrev());
}
}
} }

View File

@ -19,6 +19,8 @@ import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType;
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext; import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
import org.hl7.fhir.r5.utils.EOperationOutcome; import org.hl7.fhir.r5.utils.EOperationOutcome;
import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.utilities.StandardsStatus;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -37,7 +39,12 @@ public class SearchParameterRenderer extends TerminologyRenderer {
} }
public boolean render(XhtmlNode x, SearchParameter spd) throws IOException, FHIRException, EOperationOutcome { public boolean render(XhtmlNode x, SearchParameter spd) throws IOException, FHIRException, EOperationOutcome {
x.h2().addText(spd.getName()); XhtmlNode h2 = x.h2();
h2.addText(spd.getName());
StandardsStatus ss = ToolingExtensions.getStandardsStatus(spd);
if (ss != context.getDefaultStandardsStatus()) {
genStandardsStatus(h2, ss);
}
XhtmlNode p = x.para(); XhtmlNode p = x.para();
p.tx("Parameter "); p.tx("Parameter ");
p.code().tx(spd.getCode()); p.code().tx(spd.getCode());
@ -52,9 +59,11 @@ public class SearchParameterRenderer extends TerminologyRenderer {
for (CodeType t : spd.getBase()) { for (CodeType t : spd.getBase()) {
StructureDefinition sd = context.getWorker().fetchTypeDefinition(t.toString()); StructureDefinition sd = context.getWorker().fetchTypeDefinition(t.toString());
if (sd != null && sd.hasUserData("path")) { if (sd != null && sd.hasUserData("path")) {
td.ah(sd.getUserString("path")).sep(", ").tx(t.getCode()); td.sep(", ");
td.ah(sd.getUserString("path")).tx(t.getCode());
} else { } else {
td.sep(", ").tx(t.getCode()); td.sep(", ");
td.tx(t.getCode());
} }
} }
tr = tbl.tr(); tr = tbl.tr();
@ -66,7 +75,7 @@ public class SearchParameterRenderer extends TerminologyRenderer {
} }
if (spd.hasProcessingMode()) { if (spd.hasProcessingMode()) {
tr = tbl.tr(); tr = tbl.tr();
tr.td().tx("Usage"); tr.td().tx("Processing Mode");
tr.td().tx(spd.getProcessingMode().getDisplay()); tr.td().tx(spd.getProcessingMode().getDisplay());
} }
if (spd.hasTarget()) { if (spd.hasTarget()) {

View File

@ -22,6 +22,7 @@ import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext;
import org.hl7.fhir.utilities.FhirPublication; import org.hl7.fhir.utilities.FhirPublication;
import org.hl7.fhir.utilities.MarkDownProcessor; import org.hl7.fhir.utilities.MarkDownProcessor;
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect; import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
import org.hl7.fhir.utilities.StandardsStatus;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationOptions; import org.hl7.fhir.utilities.validation.ValidationOptions;
@ -143,6 +144,7 @@ public class RenderingContext {
private String definitionsTarget; private String definitionsTarget;
private String destDir; private String destDir;
private boolean inlineGraphics; private boolean inlineGraphics;
private StandardsStatus defaultStandardsStatus;
private QuestionnaireRendererMode questionnaireMode = QuestionnaireRendererMode.FORM; private QuestionnaireRendererMode questionnaireMode = QuestionnaireRendererMode.FORM;
private StructureDefinitionRendererMode structureMode = StructureDefinitionRendererMode.SUMMARY; private StructureDefinitionRendererMode structureMode = StructureDefinitionRendererMode.SUMMARY;
@ -184,6 +186,7 @@ public class RenderingContext {
// default to US locale - discussion here: https://github.com/hapifhir/org.hl7.fhir.core/issues/666 // default to US locale - discussion here: https://github.com/hapifhir/org.hl7.fhir.core/issues/666
this.locale = new Locale.Builder().setLanguageTag("en-US").build(); this.locale = new Locale.Builder().setLanguageTag("en-US").build();
} }
public RenderingContext copy() { public RenderingContext copy() {
RenderingContext res = new RenderingContext(worker, markdown, terminologyServiceOptions, getLink(KnownLinkType.SPEC), localPrefix, lang, mode, rules); RenderingContext res = new RenderingContext(worker, markdown, terminologyServiceOptions, getLink(KnownLinkType.SPEC), localPrefix, lang, mode, rules);
@ -223,6 +226,7 @@ public class RenderingContext {
res.showComments = showComments; res.showComments = showComments;
res.copyButton = copyButton; res.copyButton = copyButton;
res.pkp = pkp; res.pkp = pkp;
res.defaultStandardsStatus = defaultStandardsStatus;
res.terminologyServiceOptions = terminologyServiceOptions.copy(); res.terminologyServiceOptions = terminologyServiceOptions.copy();
return res; return res;
@ -660,5 +664,12 @@ public class RenderingContext {
public void setRules(GenerationRules rules) { public void setRules(GenerationRules rules) {
this.rules = rules; this.rules = rules;
} }
public StandardsStatus getDefaultStandardsStatus() {
return defaultStandardsStatus;
}
public RenderingContext setDefaultStandardsStatus(StandardsStatus defaultStandardsStatus) {
this.defaultStandardsStatus = defaultStandardsStatus;
return this;
}
} }

View File

@ -208,7 +208,7 @@ public class ToolingExtensions {
public static final String EXT_REND_MD = "http://hl7.org/fhir/StructureDefinition/rendering-markdown"; public static final String EXT_REND_MD = "http://hl7.org/fhir/StructureDefinition/rendering-markdown";
public static final String EXT_CAP_STMT_EXPECT = "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation"; public static final String EXT_CAP_STMT_EXPECT = "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation";
public static final String EXT_ED_HEIRARCHY = "http://hl7.org/fhir/StructureDefinition/elementdefinition-heirarchy"; public static final String EXT_ED_HEIRARCHY = "http://hl7.org/fhir/StructureDefinition/elementdefinition-heirarchy";
public static final String EXT_SD_DEPENDENCY = "http://hl7.org/fhir/StructureDefinition/structuredefinition-dependencies"; public static final String EXT_SD_IMPOSE_PROFILE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-imposeProfile";
public static final String EXT_XML_NO_ORDER = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-no-order"; public static final String EXT_XML_NO_ORDER = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-no-order";
public static final String EXT_DEF_TYPE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype"; public static final String EXT_DEF_TYPE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype";
public static final String EXT_TYPE_SPEC = "http://hl7.org/fhir/tools/StructureDefinition/type-specifier"; public static final String EXT_TYPE_SPEC = "http://hl7.org/fhir/tools/StructureDefinition/type-specifier";

View File

@ -863,8 +863,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
int i = 0; int i = 0;
while (i < profiles.size()) { while (i < profiles.size()) {
StructureDefinition sd = profiles.get(i); StructureDefinition sd = profiles.get(i);
if (sd.hasExtension(ToolingExtensions.EXT_SD_DEPENDENCY)) { if (sd.hasExtension(ToolingExtensions.EXT_SD_IMPOSE_PROFILE)) {
for (Extension ext : sd.getExtensionsByUrl(ToolingExtensions.EXT_SD_DEPENDENCY)) { for (Extension ext : sd.getExtensionsByUrl(ToolingExtensions.EXT_SD_IMPOSE_PROFILE)) {
StructureDefinition dep = context.fetchResource( StructureDefinition.class, ext.getValue().primitiveValue(), sd); StructureDefinition dep = context.fetchResource( StructureDefinition.class, ext.getValue().primitiveValue(), sd);
if (dep == null) { if (dep == null) {
warning(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), false, I18nConstants.VALIDATION_VAL_PROFILE_DEPENDS_NOT_RESOLVED, ext.getValue().primitiveValue(), sd.getVersionedUrl()); warning(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), false, I18nConstants.VALIDATION_VAL_PROFILE_DEPENDS_NOT_RESOLVED, ext.getValue().primitiveValue(), sd.getVersionedUrl());
@ -4794,8 +4794,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
if (pctOwned) { if (pctOwned) {
pct.done(); pct.done();
} }
if (sd.hasExtension(ToolingExtensions.EXT_SD_DEPENDENCY)) { if (sd.hasExtension(ToolingExtensions.EXT_SD_IMPOSE_PROFILE)) {
for (Extension ext : sd.getExtensionsByUrl(ToolingExtensions.EXT_SD_DEPENDENCY)) { for (Extension ext : sd.getExtensionsByUrl(ToolingExtensions.EXT_SD_IMPOSE_PROFILE)) {
StructureDefinition sdi = context.fetchResource(StructureDefinition.class, ext.getValue().primitiveValue()); StructureDefinition sdi = context.fetchResource(StructureDefinition.class, ext.getValue().primitiveValue());
if (sdi == null) { if (sdi == null) {
warning(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath() + ".meta.profile[" + i + "]", false, I18nConstants.VALIDATION_VAL_PROFILE_DEPENDS_NOT_RESOLVED, ext.getValue().primitiveValue(), sd.getVersionedUrl()); warning(errors, NO_RULE_DATE, IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath() + ".meta.profile[" + i + "]", false, I18nConstants.VALIDATION_VAL_PROFILE_DEPENDS_NOT_RESOLVED, ext.getValue().primitiveValue(), sd.getVersionedUrl());