Fix problem generating value set spreadsheets

This commit is contained in:
Grahame Grieve 2024-09-03 21:26:53 +08:00
parent 83daa93fbc
commit 7e5014c6d7
2 changed files with 14 additions and 10 deletions

View File

@ -100,7 +100,8 @@ public class SpreadsheetGenerator {
if (name.length() > MAX_SENSITIVE_SHEET_NAME_LEN - 2) {
name = name.substring(0, MAX_SENSITIVE_SHEET_NAME_LEN - 2);
}
String s = fixSheetNameChars(name);
name = fixSheetNameChars(name);
String s = name;
if (sheetNames.containsKey(s)) {
int i = 1;
do {

View File

@ -19,6 +19,7 @@ import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent;
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent;
import org.hl7.fhir.utilities.DebugUtilities;
import org.hl7.fhir.utilities.i18n.I18nConstants;
public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator {
@ -36,11 +37,12 @@ public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator
System.out.println("no valueset!");
}
addValueSetMetadata(renderCanonicalResource(vs, false), vs);
int i = 0;
for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
genInclude(vs, inc, "Include");
genInclude(vs, inc, "Include", i++);
}
for (ConceptSetComponent exc : vs.getCompose().getExclude()) {
genInclude(vs, exc, "Exclude");
genInclude(vs, exc, "Exclude", i++);
}
if (vs.hasExpansion()) {
if (vs.getExpansion().hasParameter()) {
@ -82,11 +84,11 @@ public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator
return value ? "" : "false";
}
private void genInclude(ValueSet vs, ConceptSetComponent inc, String mode) {
private void genInclude(ValueSet vs, ConceptSetComponent inc, String mode, int count) {
if (inc.hasSystem()) {
genIncludeSystem(vs, inc, mode);
genIncludeSystem(vs, inc, mode, count);
} else {
genIncludeValueSets(vs, inc, mode);
genIncludeValueSets(vs, inc, mode, count);
}
// String subname = inc.hasSystem() ? : "ValueSets";
//
@ -107,14 +109,15 @@ public class ValueSetSpreadsheetGenerator extends CanonicalSpreadsheetGenerator
// configureSheet(sheet, sd);
}
private void genIncludeValueSets(ValueSet vs, ConceptSetComponent inc, String mode) {
Sheet sheet = makeSheet(mode+" ValueSets");
private void genIncludeValueSets(ValueSet vs, ConceptSetComponent inc, String mode, int count) {
Sheet sheet = makeSheet(mode+" ValueSet #"+count);
addValueSets(sheet, inc.getValueSet());
configureSheet(sheet);
}
private void genIncludeSystem(ValueSet vs, ConceptSetComponent inc, String mode) {
Sheet sheet = makeSheet(mode+" from "+dr.displaySystem(inc.getSystem()));
private void genIncludeSystem(ValueSet vs, ConceptSetComponent inc, String mode, int count) {
DebugUtilities.ln(inc.getSystem());
Sheet sheet = makeSheet(mode+" #"+count);
if (inc.hasValueSet()) {
addValueSets(sheet, inc.getValueSet());
}