Fix presentation issues and union and intersection links in previous version comparison
This commit is contained in:
parent
69b96d8d3e
commit
3adbd00209
|
@ -9,6 +9,8 @@ import java.util.Map;
|
|||
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.comparison.StructureDefinitionComparer.ProfileComparison;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.CodeSystemFilterComponent;
|
||||
|
@ -16,16 +18,26 @@ import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
|||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.PropertyComponent;
|
||||
import org.hl7.fhir.r5.renderers.StructureDefinitionRenderer;
|
||||
import org.hl7.fhir.r5.renderers.CodeSystemRenderer;
|
||||
import org.hl7.fhir.r5.renderers.Renderer.RenderingStatus;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
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.ResourceWrapper;
|
||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row;
|
||||
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlDocument;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
||||
public class CodeSystemComparer extends CanonicalResourceComparer {
|
||||
|
@ -628,4 +640,14 @@ public class CodeSystemComparer extends CanonicalResourceComparer {
|
|||
return "CodeSystem";
|
||||
}
|
||||
|
||||
public XhtmlNode renderUnion(CodeSystemComparison comp, String id, String prefix, String corePath) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome {
|
||||
CodeSystemRenderer csr = new CodeSystemRenderer(new RenderingContext(session.getContextLeft(), null, new ValidationOptions(), corePath, prefix, null, ResourceRendererMode.TECHNICAL, GenerationRules.IG_PUBLISHER));
|
||||
return csr.buildNarrative(ResourceWrapper.forResource(csr.getContext(), comp.union));
|
||||
}
|
||||
|
||||
public XhtmlNode renderIntersection(CodeSystemComparison comp, String id, String prefix, String corePath) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome {
|
||||
CodeSystemRenderer csr = new CodeSystemRenderer(new RenderingContext(session.getContextLeft(), null, new ValidationOptions(), corePath, prefix, null, ResourceRendererMode.TECHNICAL, GenerationRules.IG_PUBLISHER));
|
||||
return csr.buildNarrative(ResourceWrapper.forResource(csr.getContext(), comp.intersection));
|
||||
}
|
||||
|
||||
}
|
|
@ -12,7 +12,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.exceptions.PathEngineException;
|
||||
import org.hl7.fhir.r5.comparison.CapabilityStatementComparer.CapabilityStatementComparison;
|
||||
import org.hl7.fhir.r5.comparison.CodeSystemComparer.CodeSystemComparison;
|
||||
|
@ -32,6 +34,7 @@ import org.hl7.fhir.r5.model.Base;
|
|||
import org.hl7.fhir.r5.model.StringType;
|
||||
import org.hl7.fhir.r5.model.Tuple;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||
import org.hl7.fhir.r5.utils.LiquidEngine;
|
||||
import org.hl7.fhir.r5.utils.LiquidEngine.LiquidDocument;
|
||||
import org.hl7.fhir.utilities.FhirPublication;
|
||||
|
@ -109,7 +112,7 @@ public class ComparisonRenderer implements IEvaluationContext {
|
|||
if (comp.fhirType().equals(name)) {
|
||||
if (first) {
|
||||
first = false;
|
||||
b.append("<tr><td colspan=\"4\"><b>"+Utilities.pluralize(name, 2)+"</b></td></tr>\r\n");
|
||||
b.append("<tr><td colspan=\"6\"><b>"+Utilities.pluralize(name, 2)+"</b></td></tr>\r\n");
|
||||
}
|
||||
try {
|
||||
renderComparison(id, comp);
|
||||
|
@ -143,7 +146,7 @@ public class ComparisonRenderer implements IEvaluationContext {
|
|||
}
|
||||
}
|
||||
|
||||
private void renderComparison(String id, ResourceComparison comp) throws IOException {
|
||||
private void renderComparison(String id, ResourceComparison comp) throws IOException, FHIRFormatError, DefinitionException, FHIRException, EOperationOutcome {
|
||||
if (comp instanceof ProfileComparison) {
|
||||
renderProfile(id, (ProfileComparison) comp);
|
||||
} else if (comp instanceof ValueSetComparison) {
|
||||
|
@ -169,7 +172,7 @@ public class ComparisonRenderer implements IEvaluationContext {
|
|||
TextFile.stringToFile(cnt, file(comp.getId()+".html"));
|
||||
}
|
||||
|
||||
private void renderCodeSystem(String id, CodeSystemComparison comp) throws IOException {
|
||||
private void renderCodeSystem(String id, CodeSystemComparison comp) throws IOException, FHIRFormatError, DefinitionException, FHIRException, EOperationOutcome {
|
||||
String template = templates.get("CodeSystem");
|
||||
Map<String, Base> vars = new HashMap<>();
|
||||
CodeSystemComparer cs = new CodeSystemComparer(session);
|
||||
|
@ -183,17 +186,32 @@ public class ComparisonRenderer implements IEvaluationContext {
|
|||
vars.put("errors", new StringType(new XhtmlComposer(true).compose(cs.renderErrors(comp))));
|
||||
vars.put("metadata", new StringType(new XhtmlComposer(true).compose(cs.renderMetadata(comp, "", ""))));
|
||||
vars.put("concepts", new StringType(new XhtmlComposer(true).compose(cs.renderConcepts(comp, "", ""))));
|
||||
|
||||
String cnt = processTemplate(template, "CodeSystem", vars);
|
||||
TextFile.stringToFile(cnt, file(comp.getId()+".html"));
|
||||
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(ManagedFileAccess.outStream(Utilities.path(folder, comp.getId() + "-union.json")), comp.getUnion());
|
||||
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(ManagedFileAccess.outStream(Utilities.path(folder, comp.getId() + "-intersection.json")), comp.getIntersection());
|
||||
|
||||
String union = new XhtmlComposer(true).compose(cs.renderUnion(comp, "", folder, "http://hl7.org/fhir"));
|
||||
String intersection = new XhtmlComposer(true).compose(cs.renderIntersection(comp, "", folder, "http://hl7.org/fhir"));
|
||||
vars.put("union", new StringType(union));
|
||||
vars.put("intersection", new StringType(intersection));
|
||||
|
||||
template = templates.get("CodeSystem-Union");
|
||||
cnt = processTemplate(template, "CodeSystem-Union", vars);
|
||||
TextFile.stringToFile(cnt, file(comp.getId()+"-union.html"));
|
||||
|
||||
template = templates.get("CodeSystem-Intersection");
|
||||
cnt = processTemplate(template, "CodeSystem-Intersection", vars);
|
||||
TextFile.stringToFile(cnt, file(comp.getId()+"-intersection.html"));
|
||||
|
||||
}
|
||||
|
||||
private String file(String name) throws IOException {
|
||||
return Utilities.path(folder, name);
|
||||
}
|
||||
|
||||
private void renderValueSet(String id, ValueSetComparison comp) throws FHIRException, IOException {
|
||||
private void renderValueSet(String id, ValueSetComparison comp) throws FHIRException, IOException, EOperationOutcome {
|
||||
String template = templates.get("ValueSet");
|
||||
Map<String, Base> vars = new HashMap<>();
|
||||
ValueSetComparer cs = new ValueSetComparer(session);
|
||||
|
@ -212,6 +230,19 @@ public class ComparisonRenderer implements IEvaluationContext {
|
|||
TextFile.stringToFile(cnt, file(comp.getId()+".html"));
|
||||
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(ManagedFileAccess.outStream(Utilities.path(folder, comp.getId() + "-union.json")), comp.getUnion());
|
||||
new org.hl7.fhir.r5.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(ManagedFileAccess.outStream(Utilities.path(folder, comp.getId() + "-intersection.json")), comp.getIntersection());
|
||||
|
||||
String union = new XhtmlComposer(true).compose(cs.renderUnion(comp, "", folder, "http://hl7.org/fhir"));
|
||||
String intersection = new XhtmlComposer(true).compose(cs.renderIntersection(comp, "", folder, "http://hl7.org/fhir"));
|
||||
vars.put("union", new StringType(union));
|
||||
vars.put("intersection", new StringType(intersection));
|
||||
|
||||
template = templates.get("ValueSet-Union");
|
||||
cnt = processTemplate(template, "ValueSet-Union", vars);
|
||||
TextFile.stringToFile(cnt, file(comp.getId()+"-union.html"));
|
||||
|
||||
template = templates.get("ValueSet-Intersection");
|
||||
cnt = processTemplate(template, "ValueSet-Intersection", vars);
|
||||
TextFile.stringToFile(cnt, file(comp.getId()+"-intersection.html"));
|
||||
}
|
||||
|
||||
private void renderProfile(String id, ProfileComparison comp) throws IOException {
|
||||
|
|
|
@ -202,7 +202,7 @@ public class ResourceComparer {
|
|||
s = s + "<td><a href=\""+getId()+".html\">Failed<a></td>";
|
||||
color = COLOR_ISSUE;
|
||||
}
|
||||
s = s + "<td>"+(e != null ? Utilities.escapeXml(e.getMessage()) : "")+"</td>";
|
||||
s = s + "<td colspan=\"3\">"+(e != null ? Utilities.escapeXml(e.getMessage()) : "")+"</td>";
|
||||
return "<tr style=\"background-color: "+color+"\">"+s+"</tr>\r\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.comparison.CodeSystemComparer.CodeSystemComparison;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
import org.hl7.fhir.r5.model.Element;
|
||||
|
@ -16,10 +18,18 @@ import org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent;
|
|||
import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.renderers.CodeSystemRenderer;
|
||||
import org.hl7.fhir.r5.renderers.ValueSetRenderer;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.ResourceWrapper;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
||||
import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.RenderingI18nContext;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
||||
|
@ -904,4 +914,15 @@ public class ValueSetComparer extends CanonicalResourceComparer {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
public XhtmlNode renderUnion(ValueSetComparison comp, String id, String prefix, String corePath) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome {
|
||||
ValueSetRenderer vsr = new ValueSetRenderer(new RenderingContext(session.getContextLeft(), null, new ValidationOptions(), corePath, prefix, null, ResourceRendererMode.TECHNICAL, GenerationRules.IG_PUBLISHER));
|
||||
return vsr.buildNarrative(ResourceWrapper.forResource(vsr.getContext(), comp.union));
|
||||
}
|
||||
|
||||
public XhtmlNode renderIntersection(ValueSetComparison comp, String id, String prefix, String corePath) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome {
|
||||
ValueSetRenderer vsr = new ValueSetRenderer(new RenderingContext(session.getContextLeft(), null, new ValidationOptions(), corePath, prefix, null, ResourceRendererMode.TECHNICAL, GenerationRules.IG_PUBLISHER));
|
||||
return vsr.buildNarrative(ResourceWrapper.forResource(vsr.getContext(), comp.intersection));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue