Merge pull request #706 from lmckenzi/IntroChanges

Changes relevant to improving the rendering of artifact intros.  Spec…
This commit is contained in:
Grahame Grieve 2022-01-12 03:44:03 +11:00 committed by GitHub
commit 73737b5b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 18 deletions

View File

@ -2087,6 +2087,8 @@ public class ProfileUtilities extends TranslatingUtilities {
private void removeStatusExtensions(ElementDefinition outcome) { private void removeStatusExtensions(ElementDefinition outcome) {
outcome.removeExtension(ToolingExtensions.EXT_FMM_LEVEL); outcome.removeExtension(ToolingExtensions.EXT_FMM_LEVEL);
outcome.removeExtension(ToolingExtensions.EXT_FMM_SUPPORT);
outcome.removeExtension(ToolingExtensions.EXT_FMM_DERIVED);
outcome.removeExtension(ToolingExtensions.EXT_STANDARDS_STATUS); outcome.removeExtension(ToolingExtensions.EXT_STANDARDS_STATUS);
outcome.removeExtension(ToolingExtensions.EXT_NORMATIVE_VERSION); outcome.removeExtension(ToolingExtensions.EXT_NORMATIVE_VERSION);
outcome.removeExtension(ToolingExtensions.EXT_WORKGROUP); outcome.removeExtension(ToolingExtensions.EXT_WORKGROUP);

View File

@ -1139,9 +1139,11 @@ public class DataRenderer extends Renderer {
protected String displayQuantity(Quantity q) { protected String displayQuantity(Quantity q) {
StringBuilder s = new StringBuilder(); StringBuilder s = new StringBuilder();
s.append("(system = '").append(TerminologyRenderer.describeSystem(q.getSystem())) s.append(q.hasValue() ? q.getValue() : "?");
.append("' code ").append(q.getCode()) if (q.hasUnit())
.append(" = '").append(lookupCode(q.getSystem(), null, q.getCode())).append("')"); s.append(" ").append(q.getUnit());
else if (q.hasCode())
s.append(" ").append(q.getCode());
return s.toString(); return s.toString();
} }
@ -1158,26 +1160,33 @@ public class DataRenderer extends Renderer {
} }
if (q.hasUnit()) if (q.hasUnit())
x.tx(" "+q.getUnit()); x.tx(" "+q.getUnit());
else if (q.hasCode()) else if (q.hasCode() && q.hasSystem()) {
x.tx(" "+q.getCode()); // if there's a code there *shall* be a system, so if we've got one and not the other, things are invalid and we won't bother trying to render
if (q.hasSystem() && q.getSystem().equals("http://unitsofmeasure.org"))
x.tx(" "+q.getCode());
else
x.tx("(unit "+q.getCode()+" from "+q.getSystem()+")");
}
if (showCodeDetails && q.hasCode()) { if (showCodeDetails && q.hasCode()) {
x.span("background: LightGoldenRodYellow", null).tx(" (Details: "+TerminologyRenderer.describeSystem(q.getSystem())+" code "+q.getCode()+" = '"+lookupCode(q.getSystem(), null, q.getCode())+"')"); x.span("background: LightGoldenRodYellow", null).tx(" (Details: "+TerminologyRenderer.describeSystem(q.getSystem())+" code "+q.getCode()+" = '"+lookupCode(q.getSystem(), null, q.getCode())+"')");
} }
} }
public String displayRange(Range q) { public String displayRange(Range q) {
if (!q.hasLow() && !q.hasHigh())
return "?";
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
if (q.hasLow())
b.append(q.getLow().getValue().toString()); boolean sameUnits = (q.getLow().hasUnit() && q.getHigh().hasUnit() && q.getLow().getUnit().equals(q.getHigh().getUnit()))
else || (q.getLow().hasCode() && q.getHigh().hasCode() && q.getLow().getCode().equals(q.getHigh().getCode()));
b.append("?"); String low = "?";
b.append("-"); if (q.hasLow() && q.getLow().hasValue())
if (q.hasHigh()) low = sameUnits ? q.getLow().getValue().toString() : displayQuantity(q.getLow());
b.append(q.getHigh().getValue().toString()); String high = displayQuantity(q.getHigh());
else if (high.isEmpty())
b.append("?"); high = "?";
if (q.getLow().hasUnit()) b.append(low).append("\u00A0to\u00A0").append(high);
b.append(" "+q.getLow().getUnit());
return b.toString(); return b.toString();
} }

View File

@ -142,6 +142,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
} }
} }
} }
Coding foundCoding = null;
if (valueset != null && options.getValueSetMode() != ValueSetMode.NO_MEMBERSHIP_CHECK) { if (valueset != null && options.getValueSetMode() != ValueSetMode.NO_MEMBERSHIP_CHECK) {
Boolean result = false; Boolean result = false;
for (Coding c : code.getCoding()) { for (Coding c : code.getCoding()) {
@ -150,6 +151,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
result = null; result = null;
} else if (ok) { } else if (ok) {
result = true; result = true;
foundCoding = c;
} }
} }
if (result == null) { if (result == null) {
@ -162,8 +164,10 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
return new ValidationResult(IssueSeverity.ERROR, errors.toString()); return new ValidationResult(IssueSeverity.ERROR, errors.toString());
} else if (warnings.size() > 0) { } else if (warnings.size() > 0) {
return new ValidationResult(IssueSeverity.WARNING, warnings.toString()); return new ValidationResult(IssueSeverity.WARNING, warnings.toString());
} else { } else {
return new ValidationResult(IssueSeverity.INFORMATION, null); ConceptDefinitionComponent cd = new ConceptDefinitionComponent(foundCoding.getCode());
cd.setDisplay(foundCoding.getDisplay());
return new ValidationResult(foundCoding.getSystem(), cd);
} }
} }