fix bug processing empty structure maps

This commit is contained in:
Grahame Grieve 2024-01-17 20:47:10 +11:00
parent 14697210e5
commit ae944151aa
2 changed files with 19 additions and 18 deletions

View File

@ -2119,22 +2119,23 @@ public class StructureMapUtilities {
StructureMapAnalysis result = new StructureMapAnalysis();
TransformContext context = new TransformContext(appInfo);
VariablesForProfiling vars = new VariablesForProfiling(this, false, false);
StructureMapGroupComponent start = map.getGroup().get(0);
for (StructureMapGroupInputComponent t : start.getInput()) {
PropertyWithType ti = resolveType(map, t.getType(), t.getMode());
if (t.getMode() == StructureMapInputMode.SOURCE)
vars.add(VariableMode.INPUT, t.getName(), ti);
else
vars.add(VariableMode.OUTPUT, t.getName(), createProfile(map, result.profiles, ti, start.getName(), start));
if (map.hasGroup()) {
StructureMapGroupComponent start = map.getGroup().get(0);
for (StructureMapGroupInputComponent t : start.getInput()) {
PropertyWithType ti = resolveType(map, t.getType(), t.getMode());
if (t.getMode() == StructureMapInputMode.SOURCE)
vars.add(VariableMode.INPUT, t.getName(), ti);
else
vars.add(VariableMode.OUTPUT, t.getName(), createProfile(map, result.profiles, ti, start.getName(), start));
}
result.summary = new XhtmlNode(NodeType.Element, "table").setAttribute("class", "grid");
XhtmlNode tr = result.summary.addTag("tr");
tr.addTag("td").addTag("b").addText("Source");
tr.addTag("td").addTag("b").addText("Target");
log("Start Profiling Transform " + map.getUrl());
analyseGroup("", context, map, vars, start, result);
}
result.summary = new XhtmlNode(NodeType.Element, "table").setAttribute("class", "grid");
XhtmlNode tr = result.summary.addTag("tr");
tr.addTag("td").addTag("b").addText("Source");
tr.addTag("td").addTag("b").addText("Target");
log("Start Profiling Transform " + map.getUrl());
analyseGroup("", context, map, vars, start, result);
ProfileUtilities pu = new ProfileUtilities(worker, null, pkp);
for (StructureDefinition sd : result.getProfiles())
pu.cleanUpDifferential(sd);

View File

@ -186,7 +186,7 @@ public class ValidationEngineTests {
OperationOutcome op = ve.validate(FhirFormat.JSON, TestingUtilities.loadTestResourceStream("validator", "observation102.json"), null);
if (!TestUtilities.silent)
for (OperationOutcomeIssueComponent iss : op.getIssue()) {
System.out.println(" " + iss.getDetails().getText());
System.out.println(" "+iss.getSeverity().toCode()+": "+ iss.getDetails().getText());
}
int e = errors(op);
int w = warnings(op);
@ -265,12 +265,12 @@ public class ValidationEngineTests {
OperationOutcome op = ve.validate(FhirFormat.JSON, TestingUtilities.loadTestResourceStream("validator", "observation401_ucum.json"), profiles);
if (!TestUtilities.silent)
for (OperationOutcomeIssueComponent issue : op.getIssue())
System.out.println(" - " + issue.getDetails().getText());
System.out.println(" - "+issue.getSeverity().toCode()+": " + issue.getDetails().getText());
int e = errors(op);
int w = warnings(op);
int h = hints(op);
Assertions.assertEquals(0, e);
Assertions.assertEquals(5, w);
Assertions.assertEquals(6, w);
Assertions.assertEquals(2, h);
assertTrue(logger.verifyHasNoRequests(), "Unexpected request to TX server");
if (!TestUtilities.silent)