Skip to content

Commit b8b6c08

Browse files
feat: Updated screener results to show parameters and module of CheckConfigs
1 parent 113a0dc commit b8b6c08

File tree

5 files changed

+88
-50
lines changed

5 files changed

+88
-50
lines changed

builder-api/src/main/java/org/acme/controller/DecisionResource.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,13 @@ private Map<String, Object> evaluateBenefit(Benefit benefit, Map<String, Object>
156156
resultsList.add(evaluationResult);
157157

158158
String uniqueCheckKey = checkConfig.getCheckId() + checkNum;
159-
checkResults.put(uniqueCheckKey, Map.of("name", checkConfig.getCheckName(), "result", evaluationResult));
159+
Map<String, Object> checkResultMap = new HashMap<>();
160+
checkResultMap.put("name", checkConfig.getCheckName());
161+
checkResultMap.put("result", evaluationResult);
162+
checkResultMap.put("module", checkConfig.getCheckModule() != null ? checkConfig.getCheckModule() : "");
163+
checkResultMap.put("version", checkConfig.getCheckVersion() != null ? checkConfig.getCheckVersion() : "");
164+
checkResultMap.put("parameters", checkConfig.getParameters() != null ? checkConfig.getParameters() : Map.of());
165+
checkResults.put(uniqueCheckKey, checkResultMap);
160166
checkNum += 1;
161167
}
162168

builder-frontend/src/components/project/preview/Results.tsx

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import { Accessor, For, Match, Show, Switch } from "solid-js";
22

33
import { PreviewFormData, ScreenerResult } from "./types";
4+
import type { ParameterValues } from "@/types";
45

56
import checkIcon from "../../../assets/images/checkIcon.svg";
67
import questionIcon from "../../../assets/images/questionIcon.svg";
78
import xIcon from "../../../assets/images/xIcon.svg";
89

10+
function formatParameters(params: ParameterValues): string {
11+
return Object.entries(params)
12+
.map(([key, value]) => `${key}=${value}`)
13+
.join(", ");
14+
}
15+
916
export default function Results({
1017
inputData,
1118
results,
@@ -80,35 +87,35 @@ export default function Results({
8087
<div class="ml-2">
8188
<For each={Object.entries(benefit.check_results)}>
8289
{([checkKey, check]) => (
83-
<div class="text-md text-gray-700">
84-
{check.name}:{" "}
85-
<Switch>
86-
<Match when={check.result === "TRUE"}>
87-
<img
88-
src={checkIcon}
89-
alt=""
90-
class="inline w-4"
91-
/>
92-
</Match>
93-
<Match when={check.result === "FALSE"}>
94-
<img
95-
src={xIcon}
96-
alt=""
97-
class="inline w-4"
98-
/>
99-
</Match>
100-
<Match
101-
when={
102-
check.result === "UNABLE_TO_DETERMINE"
103-
}
104-
>
105-
<img
106-
src={questionIcon}
107-
alt=""
108-
class="inline w-4"
109-
/>
110-
</Match>
111-
</Switch>
90+
<div class="flex items-center text-md text-gray-700 mb-1">
91+
<div class="flex-shrink-0 w-5 mr-2">
92+
<Switch>
93+
<Match when={check.result === "TRUE"}>
94+
<img src={checkIcon} alt="" class="w-4" />
95+
</Match>
96+
<Match when={check.result === "FALSE"}>
97+
<img src={xIcon} alt="" class="w-4" />
98+
</Match>
99+
<Match when={check.result === "UNABLE_TO_DETERMINE"}>
100+
<img src={questionIcon} alt="" class="w-4" />
101+
</Match>
102+
</Switch>
103+
</div>
104+
<div class="flex flex-col">
105+
<div>
106+
{check.name}
107+
<Show when={check.module || check.version}>
108+
<span class="text-gray-500 ml-1">
109+
({[check.module, check.version].filter(Boolean).join(" v")})
110+
</span>
111+
</Show>
112+
</div>
113+
<Show when={check.parameters && Object.keys(check.parameters).length > 0}>
114+
<div class="text-gray-500 text-sm">
115+
{formatParameters(check.parameters)}
116+
</div>
117+
</Show>
118+
</div>
112119
</div>
113120
)}
114121
</For>

builder-frontend/src/components/project/preview/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ParameterValues } from "@/types";
2+
13
/* Screener Evaluation Results */
24
export interface ScreenerResult {
35
[key: string]: BenefitResult
@@ -12,6 +14,9 @@ interface BenefitResult {
1214
interface CheckResult {
1315
name: string;
1416
result: OptionalBoolean;
17+
module: string;
18+
version: string;
19+
parameters: ParameterValues;
1520
}
1621
type OptionalBoolean = "TRUE" | "FALSE" | "UNABLE_TO_DETERMINE";
1722

builder-frontend/src/components/screener/EligibilityResults.tsx

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
import { Switch, Match, For, Accessor } from "solid-js";
1+
import { Switch, Match, For, Accessor, Show } from "solid-js";
22

33
import type { ScreenerResult, BenefitResult } from "@/types";
44

55
import checkIcon from "@/assets/images/checkIcon.svg";
66
import questionIcon from "@/assets/images/questionIcon.svg";
77
import xIcon from "@/assets/images/xIcon.svg";
88

9+
function formatParameters(params: Record<string, unknown>): string {
10+
return Object.entries(params)
11+
.map(([key, value]) => `${key}=${value}`)
12+
.join(", ");
13+
}
914

1015
export default function EligibilityResults(
1116
{ screenerResult }: { screenerResult: Accessor<ScreenerResult> }
@@ -45,24 +50,36 @@ function BenefitResult({ benefitResult }: { benefitResult: BenefitResult }) {
4550
<h3 class="font-bold text-lg">{benefitResult.name}</h3>
4651
<For each={Object.entries(benefitResult.check_results)}>
4752
{([checkKey, check]) => (
48-
<p class="mb-1">
49-
<Switch>
50-
<Match when={check.result === "TRUE"}>
51-
<img src={checkIcon} alt="" class="inline w-4 mr-2" />
52-
</Match>
53-
<Match when={check.result === "UNABLE_TO_DETERMINE"}>
54-
<img
55-
src={questionIcon}
56-
alt=""
57-
class="inline w-4 mr-2"
58-
/>
59-
</Match>
60-
<Match when={check.result === "FALSE"}>
61-
<img src={xIcon} alt="" class="inline w-4 mr-2" />
62-
</Match>
63-
</Switch>
64-
<span class="text-xs">{check.name}</span>
65-
</p>
53+
<div class="flex items-center mb-1">
54+
<div class="flex-shrink-0 w-5 mr-2">
55+
<Switch>
56+
<Match when={check.result === "TRUE"}>
57+
<img src={checkIcon} alt="" class="w-4" />
58+
</Match>
59+
<Match when={check.result === "UNABLE_TO_DETERMINE"}>
60+
<img src={questionIcon} alt="" class="w-4" />
61+
</Match>
62+
<Match when={check.result === "FALSE"}>
63+
<img src={xIcon} alt="" class="w-4" />
64+
</Match>
65+
</Switch>
66+
</div>
67+
<div class="flex flex-col text-xs">
68+
<div>
69+
{check.name}
70+
<Show when={check.module || check.version}>
71+
<span class="text-gray-500 ml-1">
72+
({[check.module, check.version].filter(Boolean).join(" v")})
73+
</span>
74+
</Show>
75+
</div>
76+
<Show when={check.parameters && Object.keys(check.parameters).length > 0}>
77+
<div class="text-gray-500">
78+
{formatParameters(check.parameters)}
79+
</div>
80+
</Show>
81+
</div>
82+
</div>
6683
)}
6784
</For>
6885
</div>

builder-frontend/src/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ export interface BenefitResult {
106106
[key: string]: CheckResult;
107107
};
108108
}
109-
interface CheckResult {
109+
export interface CheckResult {
110110
name: string;
111111
result: OptionalBoolean;
112+
module: string;
113+
version: string;
114+
parameters: ParameterValues;
112115
}
113116
export type OptionalBoolean = "TRUE" | "FALSE" | "UNABLE_TO_DETERMINE";
114117

0 commit comments

Comments
 (0)