The analysis behind the dashboard, built so the numbers can be checked.
A relational dataset, generated reproducibly. The same metric definitions written three times, in JavaScript, pandas and SQL, with automated tests that fail if they disagree. Power BI tables and DAX prepared from the tested pipeline.
The site's own analytics engine
assets/js/metrics.js computes every figure on the intelligence page from the bundled records. No server, no BI tool.
Python and SQL pipeline
Generation, quality checks, pandas preparation and SQLite queries. Executed and tested; outputs are in the repository.
Power BI model
Star-schema CSVs, relationships and DAX measures with validation targets. No .pbix is included because it was not built in Power BI Desktop.
From one policy file to three reconciled results.
| Step | What it does | File | Result |
|---|
# Rebuild everything and test it npm run data # generate, quality-check, prepare, run SQL, build dictionary and templates npm test # 46 unit and reconciliation tests
Fifteen tables, one grain each.
Relationships
Controls are required per system; tests, evidence, findings and exceptions hang off that pair.
business_units ─┬─< owners
└─< ai_systems >── owners
models ───────────< ai_systems
ai_systems ───────< system_controls >── controls
system_controls ──< control_tests
system_controls ──< evidence
system_controls ──< findings ──< remediation_actions
system_controls ──< exceptions
ai_systems ───────< incidents ──< incident_refunds
ai_systems ───────< model_changes >── models
ai_systems ───────< lifecycle_events
Modeling decision: system_controls is the hinge. Making "this control is required for this system" a row of its own gives every control metric a stable denominator, and lets the schema reject a test or finding against a control that was never required.
| Table | Grain | Rows | Columns |
|---|
Schema with enforced constraints, and twelve analytical queries.
The CSVs are loaded through the schema, so primary keys, foreign keys and CHECK constraints are enforced against the data. Queries use window functions for "latest test per control" and for trailing averages.
| Query | Question it answers |
|---|---|
| control_effectiveness | Of required controls, how many passed their latest test in 210 days? |
| control_coverage_by_business_unit | Where are required controls not implemented? |
| evidence_currency | How much evidence is current, stale or missing? |
| open_findings_aging | How old is the open backlog, by severity? |
| remediation_sla_performance | Are findings closed inside their SLA? |
| high_risk_agent_exposure | Which acting agents have a critical control not effective? |
| pending_reassessments | Which model changes still need reassessment? |
| incidents_monthly_with_moving_average | Is this month a spike against the prior three? |
| leadership_attention | Who owns each open Critical finding? |
-- Control effectiveness: the latest test per required
-- control inside a 210-day window must be a pass.
WITH latest AS (
SELECT system_id, control_id, result,
ROW_NUMBER() OVER (
PARTITION BY system_id, control_id
ORDER BY test_date DESC, test_id DESC) AS rn
FROM control_tests
WHERE test_date <= :as_of
AND test_date > date(:as_of, '-210 days')
)
SELECT COUNT(*) AS required_controls,
SUM(CASE WHEN t.result = 'Pass' THEN 1 ELSE 0 END)
AS effective_controls,
SUM(CASE WHEN t.result IS NULL THEN 1 ELSE 0 END)
AS untested_controls
FROM v_live_systems l
JOIN system_controls sc ON sc.system_id = l.system_id
LEFT JOIN latest t
ON t.system_id = sc.system_id
AND t.control_id = sc.control_id AND t.rn = 1;
-- Result on the shipped dataset: 693 / 564 / 78
Reproducible generation, quality checks and pandas preparation.
# prepare_data.py: effectiveness as of any date
tests = t["control_tests"]
window = tests[(tests.test_date <= as_of) &
(tests.test_date > shift(as_of, -210))]
latest = (window.sort_values(["test_date", "test_id"])
.groupby(["system_id", "control_id"],
as_index=False).last())
sc = sc.merge(latest[["system_id", "control_id", "result"]],
on=["system_id", "control_id"], how="left")
sc["effective"] = sc.result == "Pass"
sc["critical_failing"] = ((sc.is_critical == 1) &
(sc.result == "Fail"))
Synthetic data generation
Standard library only, fixed seed. Each business unit has a maturity parameter that drives implementation, test pass and evidence-refresh probabilities, so units differ for a reason. The generator applies the real policy through a Python port of the engine; a test confirms the Python and JavaScript engines agree on all 75 systems.
Data quality checks
checks: unique keys, resolvable foreign keys, value domains, date order, no record dated after the reporting date, no test before go-live, and that tests, evidence and findings only reference controls actually required for that system.
Analytical decisions worth defending
- Untested controls count as not effective. The alternative flatters whoever tests least.
- Positions are recomputed as of each month end, so trends cannot drift from the definition.
- Ratios always travel with numerator and denominator.
- No composite score. Four measures, reported side by side.
Three implementations, one answer.
The JavaScript column is computed now, in this page. The pandas and SQL columns are read from the pipeline's saved outputs. tests/reconcile.test.js asserts these and every monthly point match.
| Measure, as of | JavaScript (live) | pandas | SQL | Agree |
|---|
What the twelve months show.
Reading it responsibly
September's rise in incidents coincides with a provider's major model version change and with incident INC-0031. In generated data that coincidence was designed in. In a client setting it would be a hypothesis: segment incidents by model and by days since change, compare systems on the changed model with those that were not, and check whether the reassessment backlog predicts the incident rate. The screen flags the month; it does not explain it.
Star schema, relationships and DAX, ready to assemble.
Thirteen tables in analytics/data/powerbi/: three dimensions, nine facts and a bridge. Point-in-time measures come from a monthly snapshot fact so the DAX stays simple and the logic stays in one tested place.
The DAX follows standard semi-additive patterns and has not been executed in Power BI Desktop. The guide lists the value each measure should return so the model can be validated when built.
-- Semi-additive: take the last month end in context,
-- then sum across systems. Never sum across months.
Effective Controls =
VAR LastEnd = MAX ( fact_system_month[month_end] )
RETURN
CALCULATE (
SUM ( fact_system_month[effective] ),
fact_system_month[month_end] = LastEnd
)
Control Effectiveness % =
DIVIDE ( [Effective Controls], [Required Controls] )
-- Flow measure: tests executed in the period
Test Pass Rate % =
DIVIDE ( SUM ( fact_control_tests[passed] ),
COUNTROWS ( fact_control_tests ) )
Findings Closed =
CALCULATE (
COUNTROWS ( fact_findings ),
USERELATIONSHIP ( dim_date[date],
fact_findings[closed_date] ),
NOT ISBLANK ( fact_findings[closed_date] )
)