Skip to content

Commit

Permalink
Fix consistency problem in name presentation generating slices
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Grieve committed Feb 26, 2025
1 parent 7abfd4e commit 1ff49fd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1338,12 +1338,12 @@ else if (isDataType(combined))
nc = sdrRight.genElementNameCell(gen, combined.getRight().getDef(), "??", true, corePath, prefix, root, false, false, combined.getRight().getSrc(), typesRow, row, false, ext, used , ref, sName, null);
}
if (combined.hasLeft()) {
frame(sdrLeft.genElementCells(new RenderingStatus(), gen, combined.getLeft().getDef(), "??", true, corePath, prefix, root, false, false, combined.getLeft().getSrc(), typesRow, row, true, ext, used , ref, sName, nc, false, false, sdrLeft.getContext(), children.size() > 0, defPath, anchorPrefix, new ArrayList<ElementDefinition>(), null), leftColor);
frame(sdrLeft.genElementCells(new RenderingStatus(), gen, combined.getLeft().getDef(), "??", true, corePath, prefix, root, false, false, combined.getLeft().getSrc(), typesRow, row, true, ext, used , ref, nc, false, false, sdrLeft.getContext(), children.size() > 0, defPath, anchorPrefix, new ArrayList<ElementDefinition>(), null), leftColor);
} else {
frame(spacers(row, 4, gen), leftColor);
}
if (combined.hasRight()) {
frame(sdrRight.genElementCells(new RenderingStatus(), gen, combined.getRight().getDef(), "??", true, corePath, prefix, root, false, false, combined.getRight().getSrc(), typesRow, row, true, ext, used, ref, sName, nc, false, false, sdrRight.getContext(), children.size() > 0, defPath, anchorPrefix, new ArrayList<ElementDefinition>(), null), rightColor);
frame(sdrRight.genElementCells(new RenderingStatus(), gen, combined.getRight().getDef(), "??", true, corePath, prefix, root, false, false, combined.getRight().getSrc(), typesRow, row, true, ext, used, ref, nc, false, false, sdrRight.getContext(), children.size() > 0, defPath, anchorPrefix, new ArrayList<ElementDefinition>(), null), rightColor);
} else {
frame(spacers(row, 4, gen), rightColor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ public String buildSummary(ResourceWrapper res) throws UnsupportedEncodingExcept
if (profile == null)
return "unknown resource type " +res.fhirType();
else {
boolean firstElement = true;
boolean last = false;
List<ResourceWrapper> children = res.children();
ContextUtilities cu = res.getContextUtilities();
for (ResourceWrapper p : children) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ public String display(StructureDefinition sd) {
public static final String RIM_MAPPING = "http://hl7.org/v3";
public static final String v2_MAPPING = "http://hl7.org/v2";
public static final String LOINC_MAPPING = "http://loinc.org";
public static final String SNOMED_MAPPING = "http://snomed.info";
public static final String SNOMED_MAPPING = "http://snomed.info";
private static final boolean PREFIX_SLICES = true;

private final boolean ADD_REFERENCE_TO_TABLE = true;

Expand Down Expand Up @@ -819,10 +820,15 @@ else if (element.hasSliceName())
}
UnusedTracker used = new UnusedTracker();
String ref = defPath == null ? null : defPath + element.getId();
String sName = tail(element.getPath());
if (element.hasSliceName()) {
sName = sName +":"+element.getSliceName();
}
String sName = null;
if (PREFIX_SLICES) {
sName = tail(element.getPath());
if (element.hasSliceName()) {
sName = sName + ":" + element.getSliceName();
}
} else {
sName = element.hasSliceName() ? element.getSliceName() : tail(element.getPath());
}
used.used = true;
if (logicalModel) {
if (element.hasRepresentation(PropertyRepresentation.XMLATTR)) {
Expand All @@ -843,7 +849,7 @@ else if (element.hasSliceName())
genElementObligations(gen, element, columns, row, corePath, profile);
break;
case SUMMARY:
genElementCells(status, gen, element, profileBaseFileName, snapshot, corePath, imagePath, root, logicalModel, allInvariants, profile, typesRow, row, hasDef, ext, used, ref, sName, nc, mustSupport, true, rc, children.size() > 0, defPath, anchorPrefix, all, res);
genElementCells(status, gen, element, profileBaseFileName, snapshot, corePath, imagePath, root, logicalModel, allInvariants, profile, typesRow, row, hasDef, ext, used, ref, nc, mustSupport, true, rc, children.size() > 0, defPath, anchorPrefix, all, res);
break;
}
if (element.hasSlicing()) {
Expand Down Expand Up @@ -1132,7 +1138,7 @@ public Cell genElementNameCell(HierarchicalTableGenerator gen, ElementDefinition

public List<Cell> genElementCells(RenderingStatus status, HierarchicalTableGenerator gen, ElementDefinition element, String profileBaseFileName, boolean snapshot, String corePath,
String imagePath, boolean root, boolean logicalModel, boolean allInvariants, StructureDefinition profile, Row typesRow, Row row, boolean hasDef,
boolean ext, UnusedTracker used, String ref, String sName, Cell nameCell, boolean mustSupport, boolean allowSubRows, RenderingContext rc, boolean walksIntoThis, String defPath, String anchorPrefix, List<ElementDefinition> inScopeElements, ResourceWrapper resource) throws IOException {
boolean ext, UnusedTracker used, String ref, Cell nameCell, boolean mustSupport, boolean allowSubRows, RenderingContext rc, boolean walksIntoThis, String defPath, String anchorPrefix, List<ElementDefinition> inScopeElements, ResourceWrapper resource) throws IOException {
List<Cell> res = new ArrayList<>();
Cell gc = gen.new Cell();
row.getCells().add(gc);
Expand Down Expand Up @@ -1178,7 +1184,7 @@ public List<Cell> genElementCells(RenderingStatus status, HierarchicalTableGener
res.add(generateDescription(status, gen, row, element, (ElementDefinition) element.getUserData(UserDataNames.SNAPSHOT_DERIVATION_POINTER), used.used, profile == null ? "" : profile.getUrl(), eurl, profile, corePath, imagePath, root, logicalModel, allInvariants, snapshot, mustSupport, allowSubRows, rc, inScopeElements, resource));
} else {
String name = element.hasSliceName() ? element.getSliceName() : urltail(eurl);
nameCell.getPieces().get(0).setText(name);
// disable 26-02-2025 GDG - this just makes things inconsistent, and why do this? nameCell.getPieces().get(0).setText(name);
// left.getPieces().get(0).setReference((String) extDefn.getExtensionStructure().getTag("filename"));
nameCell.getPieces().get(0).setHint((context.formatPhrase(RenderingContext.STRUC_DEF_EX_URL, extDefn.getUrl())));
res.add(genCardinality(gen, element, row, hasDef, used, extDefn.getElement()));
Expand Down

0 comments on commit 1ff49fd

Please sign in to comment.