fix value set expansion bugs

This commit is contained in:
Grahame Grieve 2024-06-14 21:56:23 +10:00
parent e731c0c059
commit e4abcd1be3
2 changed files with 8 additions and 6 deletions

View File

@ -216,7 +216,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
if (vs.getExpansion().hasTotal()) { if (vs.getExpansion().hasTotal()) {
if (count != vs.getExpansion().getTotal()) { if (count != vs.getExpansion().getTotal()) {
x.para().style("border: maroon 1px solid; background-color: #FFCCCC; font-weight: bold; padding: 8px") x.para().style("border: maroon 1px solid; background-color: #FFCCCC; font-weight: bold; padding: 8px")
.addText(context.formatPhrase(hasFragment ? RenderingContext.VALUE_SET_HAS_AT_LEAST : RenderingContext.VALUE_SET_HAS, vs.getExpansion().getTotal())); .addText(context.formatPhrase(hasFragment ? RenderingContext.VALUE_SET_HAS_AT_LEAST : RenderingContext.VALUE_SET_HAS, vs.getExpansion().getTotal(), count));
} else { } else {
x.para().tx(context.formatPhrase(hasFragment ? RenderingContext.VALUE_SET_CONTAINS_AT_LEAST : RenderingContext.VALUE_SET_CONTAINS, vs.getExpansion().getTotal())); x.para().tx(context.formatPhrase(hasFragment ? RenderingContext.VALUE_SET_CONTAINS_AT_LEAST : RenderingContext.VALUE_SET_CONTAINS, vs.getExpansion().getTotal()));
} }

View File

@ -319,7 +319,9 @@ public class ValueSetExpander extends ValueSetProcessBase {
} }
String s = key(n); String s = key(n);
if (wc.getMap().containsKey(s) || wc.getExcludeKeys().contains(s)) { if (wc.getExcludeKeys().contains(s)) {
return null;
} else if (wc.getMap().containsKey(s)) {
wc.setCanBeHierarchy(false); wc.setCanBeHierarchy(false);
} else { } else {
wc.getCodes().add(n); wc.getCodes().add(n);
@ -832,8 +834,9 @@ public class ValueSetExpander extends ValueSetProcessBase {
throws ETooCostly, FileNotFoundException, IOException, FHIRException, CodeSystemProviderExtension { throws ETooCostly, FileNotFoundException, IOException, FHIRException, CodeSystemProviderExtension {
compose.checkNoModifiers("ValueSet.compose", "expanding"); compose.checkNoModifiers("ValueSet.compose", "expanding");
// Exclude comes first because we build up a map of things to exclude // Exclude comes first because we build up a map of things to exclude
for (ConceptSetComponent inc : compose.getExclude()) for (ConceptSetComponent inc : compose.getExclude()) {
excludeCodes(dwc, inc, expParams, exp, valueSet); excludeCodes(dwc, inc, expParams, exp, valueSet);
}
dwc.setCanBeHierarchy(!expParams.getParameterBool("excludeNested") && dwc.getExcludeKeys().isEmpty() && dwc.getExcludeSystems().isEmpty() && dwc.getOffsetParam() == 0); dwc.setCanBeHierarchy(!expParams.getParameterBool("excludeNested") && dwc.getExcludeKeys().isEmpty() && dwc.getExcludeSystems().isEmpty() && dwc.getOffsetParam() == 0);
includeAbstract = !expParams.getParameterBool("excludeNotForUI"); includeAbstract = !expParams.getParameterBool("excludeNotForUI");
boolean first = true; boolean first = true;
@ -898,9 +901,8 @@ public class ValueSetExpander extends ValueSetProcessBase {
} }
} }
} }
if (evs.hasTotal()) { if (!evs.hasTotal()) {
dwc.incTotal(evs.getTotal()); // because if there's no total, we can't know if we got everything
} else {
dwc.setNoTotal(true); dwc.setNoTotal(true);
} }
for (ValueSetExpansionParameterComponent p : evs.getParameter()) { for (ValueSetExpansionParameterComponent p : evs.getParameter()) {