Files
proxmox/scripts/jvmtm/export-transaction-compliance-matrix-csv.py
defiQUG 7ac74f432b chore: sync docs, config schemas, scripts, and meta task alignment
- Institutional / JVMTM / reserve-provenance / GRU transport + standards JSON
- Validation and verify scripts (Blockscout labels, x402, GRU preflight, P1 local path)
- Wormhole wiring in AGENTS, MCP_SETUP, MASTER_INDEX, 04-configuration README
- Meta docs, integration gaps, live verification log, architecture updates
- CI validate-config workflow updates

Operator/LAN items, submodule working trees, and public token-aggregation edge
routes remain follow-up (see TODOS_CONSOLIDATED P1).

Made-with: Cursor
2026-03-31 22:31:39 -07:00

84 lines
2.5 KiB
Python
Executable File

#!/usr/bin/env python3
"""Export the JVMTM transaction-grade compliance matrix JSON to CSV."""
from __future__ import annotations
import csv
import json
import sys
from pathlib import Path
FIELDNAMES = [
"control_id",
"phase",
"domain",
"requirement",
"validation_method",
"blocking_level",
"applies_to_rail",
"source_audit_rows",
"repo_evidence_artifacts",
"validator_command",
"failure_action",
"high_value_override",
"notes",
]
def format_artifacts(artifacts: list[dict[str, str]]) -> str:
return " | ".join(f'{artifact["artifact_type"]}:{artifact["ref"]}' for artifact in artifacts)
def render_rows(matrix: dict) -> list[dict[str, str]]:
rows: list[dict[str, str]] = []
for control in matrix["controls"]:
rows.append(
{
"control_id": control["control_id"],
"phase": control["phase"],
"domain": control["domain"],
"requirement": control["requirement"],
"validation_method": control["validation_method"],
"blocking_level": control["blocking_level"],
"applies_to_rail": " | ".join(control["applies_to_rail"]),
"source_audit_rows": " | ".join(control["source_audit_rows"]),
"repo_evidence_artifacts": format_artifacts(control["repo_evidence_artifacts"]),
"validator_command": control["validator_command"],
"failure_action": control["failure_action"],
"high_value_override": control["high_value_override"],
"notes": control["notes"],
}
)
return rows
def main() -> int:
repo_root = Path(__file__).resolve().parents[2]
matrix_path = (
Path(sys.argv[1])
if len(sys.argv) > 1
else repo_root / "config/jvmtm-regulatory-closure/transaction-compliance-matrix.json"
)
csv_path = (
Path(sys.argv[2])
if len(sys.argv) > 2
else repo_root / "config/jvmtm-regulatory-closure/transaction-compliance-matrix.csv"
)
matrix = json.loads(matrix_path.read_text(encoding="utf-8"))
rows = render_rows(matrix)
csv_path.parent.mkdir(parents=True, exist_ok=True)
with csv_path.open("w", encoding="utf-8", newline="") as handle:
writer = csv.DictWriter(handle, fieldnames=FIELDNAMES, lineterminator="\n")
writer.writeheader()
writer.writerows(rows)
print(f"Wrote {csv_path} ({len(rows)} controls)")
return 0
if __name__ == "__main__":
raise SystemExit(main())