diff --git a/src/report.mjs b/src/report.mjs new file mode 100644 index 0000000..97ea9e0 --- /dev/null +++ b/src/report.mjs @@ -0,0 +1,8 @@ +export function summarize(result) { + const outstanding = [], anomalies = []; + for (const [key, state] of result.groups) { + if (state.open) outstanding.push({ key, since: state.firstAlarm, acknowledged: state.acknowledged }); + for (const reason of state.anomalies) anomalies.push({ key, reason }); + } + return { outstanding, anomalies, rejected: result.rejected }; +}