LOCAL LOCAL DEV ENVIRONMENT (localhost:8000) — Synthetic / Local Test Data Only
Oven Command
Super AdminSuper Admin
Logged in as: Super Admin (Super Admin · All Outlets · NAN)
Morning cold-chain & hygiene check-in activeSNKComing soonLicencesComing soonDisplaysComing soonFiltersComing soon
Needs you now41
Needs you
UrgentBLR- New Bel Road is offline on ownly
Open
UrgentHarley's Special Mawa Bar Cake (250 Gms) sold out across Vijayawada
Open
More ›● 3.3% below last Thursday at 9:45 pm
🏛 HARLEY'S COMPANY BANNER · Q4 Patisserie Quality & Cold-Chain Zero-Tolerance Drive — Sequence Proof & Rista Top-20 Stock-Out SLA (15m) active across all 29 outlets. Directive O-047 · All Outlets
🚨 NUDGE ALERTS (2 CRITICAL · 3 IMPORTANT):
✓ Open & Ack
Showing: Today · All 4 Cities (29)
← Oven Command📊 INTAKE, DESIGN, INDUSTRY BENCHMARKS & TDD SPEC: CXO & DEPARTMENTAL MANAGEMENT INFORMATION SYSTEM (MIS) ACTION & ADOPTION COCKPIT (MIS-1..14 · ALL 12 MODULES SYNTHESIZED · J26)HOP Readout

📊 INTAKE, DESIGN, INDUSTRY BENCHMARKS & TDD SPEC: CXO & DEPARTMENTAL MANAGEMENT INFORMATION SYSTEM (MIS) ACTION & ADOPTION COCKPIT (MIS-1..14 · ALL 12 MODULES SYNTHESIZED · J26)

🔒 ✅ RATIFIED & LOCKED BY OWNER (2026-10-22 23:58 IST) — Ratified by cfo@harleys.com (Gates A1–A4 100% Locked)

Summary (12 Lines — IM-6 / PROCESS-OWNER-REVIEW.md Mandatory Top Digest)

  • What: Canonical Intake, Industry Benchmark Research, Multi-Level Roll-Up Architecture (Company -> City -> Cluster -> Outlet), and Action/Adoption Engine specification for Harley's CXO & Departmental Management Information System (MIS) Cockpit (MIS-1..14 · /mis).
  • Direct Owner Intake Mandate (23:42 IST): "Take a CX / Management Information Systems intake where you can synthesize all the modules and show a summarized view for their respective departments and view with appropriate roll up summaries etc! Make sure that the goal is to drive action and adoption from here!"
  • Core Law (MIS-1: Zero Dead Charts — Every Roll-Up Tile Drives Action & Adoption): Benchmarked against Danaher Business System (DBS) Weekly Bowler Charts (Red Cell = Mandatory Countermeasure Action Owner), Domino's Pulse Executive Command, Starbucks Regional/DM Atlas, Sweetgreen Ops Scorecard, and Linear / Stripe Operational Reviews. Every MIS card is strictly prohibited from being a passive report: it MUST pair its 4-Level Roll-Up Metric (Company -> City -> Cluster -> Outlet) with its V1–V4 Adoption / Follow-Through Rate % and 1-Click Action Buttons ([🔔 Nudge Owner], [➕ Assign Meeting Action Item (MyTasks)], [📍 Assign Manager Spot-Audit Visit], [✓ Approve / Unblock], [🏪 Open Outlet Summary]).
  • Synthesizes All 12 OneOps/HOP Modules Across 8 Role-Scoped Views (MIS-2..10): Unifies View 0 (👑 CXO / Founder All-Hands Cockpit — All 12 Modules on One Screen) and Views 1..7 (Department-Specific MIS Cockpits: 1. Store Ops & Kiosk, 2. CPU/CK & 7-Stage NPL, 3. Global & China Imports + SCM, 4. People, Roster, Loans & Academy, 5. Finance, Recon & Petty Cash, 6. Café Projects, Assets & Maint CMMS, 7. Legal, Compliance & Audit/Visits) governed by sticky filters (FV-1..12: Period, Cities, Type, Outlet, Brand) and aggregate-only team rollups (OV-6 / A3 — zero individual stack-ranking).
  • Built-In V1–V4 Adoption Engine & Live Meeting Mode (MIS-11..14): Tracks module adoption per outlet (V1 Built -> V2 Enabled -> V3 Active Daily Usage -> V4 Outcome Banked), highlights any outlet/department <85% adoption with a 1-tap [🔔 Send Adoption Nudge], and provides a Live Meeting Mode Bar where clicking any Red/Amber KPI cell opens a pre-filled [➕ Create Committed Meeting Action Item (MyTasks)] with automatic T-24h -> T-0 escalation nudges.
  • Status: READY FOR OWNER SIGN-OFF · Peer-Reviewed by Claude Opus 4.7 Max & Codex Astra Extra High (MIS-11..14 Hardened) · Styled in O-052 (Pastel Aqua #98DDDE + Victorian Gold #C5A059 + Raised Beams + Deep Teal #0D5C63).

1. Industry Benchmark Research: Action-Driven Executive MIS vs. Passive BI Dashboards

Global Operational Excellence BenchmarkCore Management System MechanismWhy Traditional BI Dashboards FailHow Harley's /mis Action & Adoption Cockpit Enforces It (MIS-1..14)
1. Danaher Business System (DBS) Weekly Bowler Charts & Red-Cell CountermeasuresEvery department tracks 6–8 core KPIs on a single weekly "Bowler" grid. Hard Rule: Any cell that turns RED cannot be passed over in a review meeting without recording a bound Countermeasure (Action + Single Named Owner + Due Date).Passive BI tools (Tableau/PowerBI) show red charts in meetings, people nod, and nobody logs a tracked action item inside the operational system.Danaher Red-Cell Rule (MIS-12): Clicking any RED or AMBER cell in /mis opens an inline [➕ Assign Countermeasure Action (MyTasks)] pre-linked to the exact metric, outlet/cluster, and department owner, tracked automatically via HOP's T-24h -> T-0 nudge ladder!
2. Domino's Pulse Executive Command & Store Vital SignsReal-time roll-up from National -> Region -> Franchise/Cluster -> Store uniting Net Sales, OTD %, Make-Line Time, Top-Item Stock-Outs, and OER Field Audit scores on a single screen.Siloed departmental apps force CXOs and HODs to open 9 different tabs to correlate a store's sales drop with its stock-outs, staffing, or chiller breakdown.View 0 CXO All-Hands Cockpit (MIS-2) + 4-Level Drill-Down (Company -> City -> Cluster -> Outlet): Correlates Rista Sales, Top-20 Stock-Outs, Kiosk Adherence, Manager Physical Visits (AUD-VISIT), and Maintenance in one click.
3. Starbucks Regional / District Manager (DM) Atlas & Adoption ScorecardMeasures not only store outcomes (comp sales, QASA score) but system adoption (did the store complete temp logs, inventory counts, and DM weekly store walks on time?).Leaders often blame a software feature when the real problem is 42% field adoption at 3 specific stores.Dual-Metric Tile Architecture (MIS-1 & MIS-11): Every MIS card displays Outcome KPI (Top-20 In-Stock: 91.4%) side-by-side with System Adoption Rate (V3/V4: 94.2% Kiosk Sync & Check-In) + a 1-tap [🔔 Nudge Low-Adoption Outlets (<85%)] button.
4. Sweetgreen Ops Scorecard & Aggregate Team Health (No Individual Blame)Provides transparent store and cluster operational roll-ups (Green / Amber / Red) for leadership coaching while prohibiting toxic individual crew leaderboards on shared screens.Individual worker stack-ranking causes gaming and morale collapse (Principle #3).Strict OV-6 / A3 Roll-Up Governance: /mis rolls up strictly by Company -> City (HYD/BLR/MUM) -> Cluster -> Outlet and Department, never displaying individual ground-staff stack-ranking leaderboards.
5. Linear / Stripe Operational Review (Run the Meeting Out of the Live App)Weekly leadership and departmental standups are run directly out of the live operational cockpit (zero slide decks or manual Excel exports), with previous week's committed actions reviewed first.Teams waste 4 hours every Monday copying numbers into PowerPoint/Excel, and 60% of verbal meeting promises are forgotten by Wednesday.Live Meeting Mode (MIS-12): Every /mis view begins with a collapsible 📌 Last Meeting Commitments & Follow-Through Strip (14 of 16 Closed · 2 Overdue) before reviewing this week's live roll-ups.

2. Synthesizing All 12 Modules into 8 Role-Scoped MIS Views (MIS-2..10)

Every view on /mis respects the Sticky 5-Filter Bar (FV-1..12: Period [Today / WTD / MTD / Custom], Cities [All / HYD / BLR / MUM], Type [Outlet / CK / Warehouse], Outlet, Brand) and drills down seamlessly across 4 hierarchy levels (Company -> City -> Cluster -> Outlet):

2.1 View 0 (MIS-2) — 👑 CXO / Founder All-Hands Meeting Cockpit (Synthesizes All 12 Modules on One Screen)

Tile #Module Pillar SynthesizedPrimary Roll-Up KPIs (Company -> City -> Cluster -> Outlet)Paired Adoption / Follow-Through Metric (V3/V4)1-Click Action & Adoption Drivers on Tile
Tile 1💰 Revenue, Top-20 In-Stock & Lost Sales (Sales / Rista / Odoo)Net Sales (WTD / MTD vs Target %), SSSG %, Channel Mix (Dine-In / Swiggy / Zomato / Direct), Top-20 Hero In-Stock % (91.5%), Estimated Lost Sales (₹) from Ghost Stock-Outs.96.8% Stock-Out Alert Acted-On % (<30m restock response) & Rista 15m Sync Freshness.[🔔 Nudge 3 Ghost Stock-Out Stores] · [📦 View City Top-20 Out Now] · [➕ Assign Sales/Stock Action]
Tile 2🏪 Store Ops, Manager Physical Visits (2–3/Day) & Audit (Ops & Audit)Opening/Closing Checklist On-Time % (93.4%), Manager Daily Visit Quota (18/21 Visits Today · 86%), 7-Day Outlet Visit Coverage (96% — 2 Due Today), Avg Outlet Audit Score (89.4%), Blind Cash/Stock Variances (>±₹200).94.1% Shared Kiosk Active Check-In & Sequence-Proof (SK-16) Adoption across active outlets.[📍 Nudge 2 Managers with Pending Visits Today] · [🗺️ Open 7-Day Visit Coverage Matrix] · [📋 Assign Surprise Spot Audit]
Tile 3👥 People, Roster, Crew Loans & Petty Cash (HR & Store Float)Shift Roster Fill & On-Time Check-In % (95.2%), Active Inter-Outlet Crew Loans (4 active · City Head notified A2), FSSAI Schedule 4 Medical & FoSTaC 1:25 Validity (98.5%), Petty Cash Float Health & Pending Reimbursements (PCR).92.0% Biometric/Selfie+PIN Check-In Adoption & <=48h Petty-Cash Voucher Clearance Rate.[✓ Approve/Review 3 Pending Petty Cash Claims] · [🔄 View Active Crew Loans (A2)] · [🔔 Nudge Expired Medical Renewal]
Tile 4🥐 Central Kitchen (CPU), Cold-Chain & 7-Stage NPL (Production & R&D)CK Morning Crate Fill Rate % (97.1%), CK <=90m Blast-Chill & Reefer <=+5°C Probe Pass % (99.2%), Daily Wastage % of Net Sales (1.8%), Active NPL Launches (L1..L7) & 5-Axis Outlet Rollout Adoption %.89.5% Outlet 5-Axis NPL Readiness Adoption (Training + POS + Recipe + Packaging + First-72h Canary).[🚀 Nudge 4 Lagging Outlets on NPL Launch] · [🌡️ Inspect 1 Cold-Chain Excursion] · [✓ Gate Sign-Off (L1..L7)]
Tile 5🚢 Global & China Imports + SCM (SCM & Imports)Active Import Files (12 across G0–G9), Pre-Shipment 24-Pt QC Pass %, Shipments in Customs / BOE Clearance (G7–G8), Average Landed Cost Multiplier (1.38x EXW via B40), Central Store (CS) Days-of-Cover on Critical Packaging/Ingredients.100% Golden Rule Gate Compliance (E1 Maker-Checker, E3 One-True-Value, 0 unverified bank wires).[✓ Approve Pending Tranche / BOE Gate] · [🚢 Open Import Case Panel (G0–G9)] · [🔔 Nudge CHA / Forwarder]
Tile 6🏗️ Café Projects (NSO) & CapEx Rollout (Projects)Active NSO Store Builds (3 stores across Gates G1–G9), On-Schedule Milestone %, CapEx Budget vs Committed vs Actual (₹), Water TDS <= 80ppm Boiler Gate Status, Pending 4-Photo Site Kiosk GRNs.91.0% Contractor Milestone Evidence Upload & 2nd-Person Site Engineer Verification Rate.[🔓 Review & Unblock G6 MEP/Boiler Gate] · [📸 Inspect Site GRN Photos] · [➕ Assign Project Blocker Task]
Tile 7🔧 Fixed Assets (1,982 QRs) & Maintenance CMMS (Facilities)Asset Uptime % (98.4%), Open P1 Critical Cold-Chain/Oven Breakdowns (2 open · SLA <4h), Pending >40% WDV Repair-vs-Replace CFO Approvals (1 pending), Preventive Maintenance (PM) Adherence %.93.8% Store Operator 2nd-Person Repair Verification (5s operating video + QR scan) Adoption.[✓ CFO Approve >40% WDV Replacement] · [🔧 Escalate P1 Chiller Ticket] · [🔔 Nudge Overdue Vendor SLA]
Tile 8⚖️ Statutory Licences, Legal Risk & CX Loop (Legal, Compliance & CX)Zero-Expired-Licence Mandate (0 Expired · 2 Expiring <=30d), 60s Outlet Inspector Mode Readiness (100%), Rent/Cam Lease Escalations Due, Customer Complaint <2h Recovery SLA %.100% ClamAV CLEAN_VERIFIED Statutory Document Vault Coverage & Renewal Ticketing (DF-4).[📄 Assign Licence Renewal Owner (<=30d)] · [🛡️ Test 60s Inspector Mode] · [🔔 Nudge Unresolved CX Recovery]

2.2 Views 1..7 (MIS-3..9) — Departmental MIS Cockpits (Scoped Automatically via access.for(user))

When a Department Head (HOD), City Head, or Cluster Manager opens /mis, the cockpit defaults to their primary departmental lens while allowing cross-pillar drill-down within their authorized scope:

  1. View 1 · Store Operations & Kiosk Execution MIS (Ops HOD / City Head / Cluster Mgr):
    • City -> Cluster -> Outlet Bowler Table: Columns for Outlet, Net Sales vs Target, Top-20 In Stock (x/20), Opening Check On-Time, Closing Sequence Proof (SK-16), People On Duty vs Roster, Last Physical Manager Visit (Days Ago + Score + Photos), and Open Escalations.
    • Direct Action Bar: [📍 Assign Today's Spot-Audit Route], [🔔 Bulk-Nudge All Late Opening Stores], [🏪 Drill Into Outlet Summary (/outlets/:code)].
  2. View 2 · Central Kitchen (CPU), Cold-Chain & 7-Stage NPL MIS (Production Head / Chef / R&D):
    • Batch & Cold-Chain Matrix: CK Production Plan vs Actual, <=90m Blast-Chill Compliance, Reefer Dispatch Probe <=+5°C, HRL-LOT-* Expiry Near-Misses, and 7-Stage NPL Funnel (L1 Idea -> L7 30/60/90d Margin Gate) with the 5-Axis Store Adoption Matrix showing exactly which outlets are Lagging on a new pastry launch.
  3. View 3 · Global & China Imports + SCM Procurement MIS (SCM Head / Import Controller / CFO):
    • G0–G9 Pipeline & Landed Cost Matrix: Tracks every IMP-CHN-YY-#### file across RFQ -> Spec Freeze -> Bilingual PO -> 24-Pt QC -> Container Plan (BLD-SHIPPLAN) -> 14-Doc Pack -> India BOE -> Blind GRN -> 28-Row Landed Cost, highlighting overdue tranche payments, demurrages at risk, and Central Store stock cover.
  4. View 4 · People, Roster, Crew Loans & Academy MIS (HR Head / Academy Lead):
    • Workforce & Readiness Roll-Up: Rostered vs Checked-In Headcount by City/Cluster, Overtime % vs 4w Baseline, Active Inter-Outlet Crew Loans (with City Head visibility A2), FSSAI Schedule 4 Medical Fitness & FoSTaC 1:25 Ratio by Outlet, and Skill Passport / Hindi Kiosk Copy Certification %.
  5. View 5 · Finance, Revenue Recon, Petty Cash & Reimbursements MIS (CFO / Finance Controller):
    • 3-Way Reconciliation & Cash Integrity Cockpit: Rista POS vs Razorpay/PineLabs vs Odoo Bank Settlement Variance, Blind Cash Drawer Drop Variances (>±₹200), Outlet Petty Cash Float Utilization & Pending Claims (PCR), Import FX Remittance Ledger (E3 One-True-Value), and CapEx / >40% WDV Approvals Queue.
  6. View 6 · Café Projects (NSO), Fixed Assets & Maintenance CMMS MIS (Projects Head / Facilities Lead):
    • NSO Critical Path & Asset Health: 42-Day NSO Gantt & 9-Gate Blocker Matrix, Site Kiosk 4-Photo GRN Queue, 1,982 Fixed Asset QR Audit Verification %, P1/P2 Breakdown MTTR by Vendor, and Cold-Chain Chiller Telemetry Health.
  7. View 7 · Legal, Statutory Compliance & Omnichannel Audit MIS (Legal / QA Head / Internal Audit):
    • Statutory & Audit Assurance Matrix: 60/30/14/7d Licence Expiry Countdown by City/Outlet, 8-Domain Auto-Triggered Audit Pass Rate, Manager 2–3/Day Physical Visit Quota & 7-Day Coverage Compliance, Silent Photo-Replay Fraud Quarantine Queue (CH-3), and 4-Stage CAPA Closure Velocity.

3. Built-In Adoption Engine & Live Meeting Mode (MIS-11..14)

3.1 MIS-11 · The V1–V4 System Adoption Heatmap (Driving 100% Field & Department Adoption)

To prevent any module from becoming shelfware, /mis includes a dedicated 📈 System Adoption & Habit Scorecard (V1 -> V4) across every City, Cluster, Outlet, and Department:

  • V1 (Built & Verified) &rarr; V2 (Enabled & Seeded for Role/Outlet) &rarr; V3 (Active Daily Usage >= 85% of Shifts/Days) &rarr; V4 (Verified Operational Outcome Banked).
  • Composite Outlet Adoption Score (0–100%):
    1. Kiosk Daily Check-In & Handover Usage (25%)
    2. On-Time Checklist & Sequence-Proof (SK-16) Completion (25%)
    3. Stock-Out & Nudge Acted-On Rate <30m (20%)
    4. Manager Weekly Physical Visit & Spot-Audit Coverage (15%)
    5. 2nd-Person M3 Verification & Repair/GRN Closure Compliance (15%)
  • 1-Tap Adoption Nudge (<85% Threshold): Any outlet or cluster scoring <85% adoption is highlighted in Amber/Coral with a 1-tap [🔔 Nudge Cluster & Outlet Manager on Adoption Gap] button that dispatches a targeted WhatsApp + In-App coaching card listing the exact missing habit (e.g., "Closing Sequence Proof skipped on 2 of last 5 shifts at KOK").

3.2 MIS-12 · "Run All Our Meetings Out of /mis" Mode & Danaher Red-Cell Countermeasure Drawer

  1. Toggle [🎯 Live Review Meeting Mode] in Top Header:
    • Pins the 📌 Previous Meeting Commitments Strip at the top (Showing open/overdue action items from last Monday's review with 1-click [✓ Verify Done] or [⚡ Escalate]).
  2. Click Any Red/Amber Cell to Spawn a Bound MyTasks Countermeasure:
    • Clicking any KPI cell or outlet row in /mis opens the ➕ Create Meeting Action Item / Nudge Drawer with pre-populated context:
      • source_module (e.g. 'AUDIT_VISIT_COVERAGE' or 'TOP20_STOCKOUT')
      • scope_outlet_or_cluster (e.g. 'KOK / Cluster-West')
      • metric_snapshot_json (e.g. {"days_since_last_visit": 6, "top20_in_stock": "16/20"})
      • assigned_owner_person_id (auto-suggested from user_assignments / master_data_holders, single named human!)
      • due_at (Default: +48h) + automatic binding into accountability_tasks_checks (T-24h -> T-6h -> T-2h -> T-0 HOP Nudge ladder) and City Head visibility (A2).

4. Peer-Review Hardening (Claude Opus 4.7 Max & Codex Astra Extra High — MIS-11..14)

Challenge IDAdversarial Risk / Bottleneck IdentifiedHardened Architectural & SQL Resolution (MIS-11..14)
MIS-CH-1 (Cross-Module Query Fan-Out Latency on View 0)Querying 12 live transactional tables (sales, stockouts, audit_runs, manager_outlet_visits, import_files, maintenance_cases, compliance_licences) on every filter toggle will cause multi-second p95 latency during an all-hands meeting.15-Minute Incremental Roll-Up Spine (mis_kpi_rollup_15m + mis_adoption_matrix_daily): Background worker refreshes pre-aggregated JSONB/numeric roll-ups keyed by (period_bucket, city_code, cluster_code, outlet_code, brand_code) every 15 minutes (and on event outbox commit), guaranteeing < 80ms p95 response on /mis, with live click-through drill-down to transactional rows.
MIS-CH-2 (Metric Drift Between /mis, /outlets/:code, and /audits)If /mis computes Top-20 In-Stock % or 7-Day Visit Coverage % with a slightly different SQL filter than /outlets/:code (OS-2 / AUD-VISIT-5), executives and store managers will argue over whose number is right in meetings (A513).Single Canonical Reader Functions (metric_dictionary_v2): /mis is forbidden from writing bespoke ad-hoc KPI math; its rollup builder calls the exact same domain readers (outletTop20(), computeOutletVisitCoverage7d(), acctRollupView(), complianceStatusSummary()) that power /outlets/:code, stamping every tile with as_of and data_version.
MIS-CH-3 (Nudge Fatigue from Repeated Meeting Clicks)During an all-hands review, 3 executives might click [🔔 Nudge Owner] on the same red metric tile within 10 minutes, spamming the Cluster Manager with duplicate WhatsApp alerts.Idempotent Nudge Coalescing (ux_mis_action_nudge_dedupe): Nudge dispatches from /mis are deduplicated per (metric_key, scope_code, recipient_person_id, 4h_bucket). If a nudge was already sent in the last 4 hours, the UI shows ✓ Nudged 18m ago by CFO (Receipt #N-8841) and offers [➕ Attach Note to Existing Task] instead of sending duplicate spam.
MIS-CH-4 (Strict Scope & Money-Stripping Isolation Across Views)A Department Head or Cluster Manager switching between Departmental Views must never see out-of-scope cities/outlets or unauthorized payroll/sensitive figures.Fail-Closed access.for(user) + Column Projection Gate: Every /api/v2/mis/view/:view_key query intersects the requested FV-1..12 sticky filters with access.for(user).allowedOutlets. Financial margin/remittance tiles in View 5 and View 3 require role IN ('cfo','finance_controller','coo','ceo').

5. PostgreSQL Schema DDL (MIS-1..14)

-- =============================================================================
-- MIS-1..14: CXO & DEPARTMENTAL MIS ACTION & ADOPTION COCKPIT SCHEMA
-- =============================================================================

CREATE TABLE IF NOT EXISTS mis_kpi_rollup_15m (
  bucket_ts                  TIMESTAMPTZ NOT NULL,
  period_key                 VARCHAR(16) NOT NULL CHECK (period_key IN ('TODAY','WTD','MTD','LAST_7D','LAST_28D')),
  level_key                  VARCHAR(16) NOT NULL CHECK (level_key IN ('COMPANY','CITY','CLUSTER','OUTLET')),
  scope_code                 VARCHAR(32) NOT NULL, -- 'ALL', 'HYD', 'CL-HYD-WEST', 'NAN', etc.
  brand_code                 VARCHAR(24) NOT NULL DEFAULT 'HARLEYS',
  department_view_key        VARCHAR(24) NOT NULL
                             CHECK (department_view_key IN ('CXO_ALL','OPS','CPU_NPL','SCM_IMPORTS','PEOPLE_HR','FINANCE_PCR','PROJECTS_ASSETS','LEGAL_AUDIT')),
  metrics_payload_json       JSONB NOT NULL,
  adoption_score_pct         NUMERIC(5,2) NOT NULL DEFAULT 0.00,
  adoption_stage             VARCHAR(8) NOT NULL DEFAULT 'V3' CHECK (adoption_stage IN ('V1','V2','V3','V4')),
  red_kpi_count              INT NOT NULL DEFAULT 0,
  amber_kpi_count            INT NOT NULL DEFAULT 0,
  open_countermeasures_count INT NOT NULL DEFAULT 0,
  data_version               BIGINT NOT NULL DEFAULT 1,
  computed_at                TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
  PRIMARY KEY (period_key, level_key, scope_code, brand_code, department_view_key)
);

CREATE TABLE IF NOT EXISTS mis_meeting_commitments (
  commitment_id              UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  meeting_date               DATE NOT NULL DEFAULT CURRENT_DATE,
  department_view_key        VARCHAR(24) NOT NULL,
  metric_key                 VARCHAR(64) NOT NULL,
  scope_level                VARCHAR(16) NOT NULL,
  scope_code                 VARCHAR(32) NOT NULL,
  metric_snapshot_json       JSONB NOT NULL,
  countermeasure_title       VARCHAR(240) NOT NULL,
  owner_person_id            VARCHAR(32) NOT NULL REFERENCES users(id),
  created_by_person_id       VARCHAR(32) NOT NULL REFERENCES users(id),
  linked_task_id             UUID NOT NULL, -- FK to accountability_tasks_checks / MyTasks
  due_at                     TIMESTAMPTZ NOT NULL,
  scope_path                 JSONB NOT NULL DEFAULT '{}'::jsonb, -- Opus 4.7 Max P1-5: {company, city, cluster, outlet}
  client_nonce               UUID NOT NULL DEFAULT gen_random_uuid(),
  city_head_notified_at      TIMESTAMPTZ,
  status                     VARCHAR(24) NOT NULL DEFAULT 'OPEN'
                             CHECK (status IN ('OPEN','IN_PROGRESS','VERIFIED_CLOSED','OVERDUE_ESCALATED')),
  created_at                 TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
  closed_at                  TIMESTAMPTZ
);

-- Opus 4.7 Max P1-5: Double-Click Idempotency & Hierarchical Scope Preservation
CREATE UNIQUE INDEX IF NOT EXISTS ux_mis_cm_dedup
  ON mis_meeting_commitments (meeting_date, department_view_key, metric_key, md5(scope_path::text));
CREATE UNIQUE INDEX IF NOT EXISTS ux_mis_cm_nonce
  ON mis_meeting_commitments (created_by_person_id, client_nonce);

-- Opus 4.7 Max P0-4: Materialized Adoption Heatmap (Prevents 384-Aggregate Standup Avalanche)
CREATE MATERIALIZED VIEW IF NOT EXISTS mv_adoption_heatmap AS
SELECT
  business_date,
  level_key,
  scope_code,
  module_key,
  AVG(score_pct) FILTER (WHERE maturity_stage = 'V1') AS v1_pct,
  AVG(score_pct) FILTER (WHERE maturity_stage = 'V2') AS v2_pct,
  AVG(score_pct) FILTER (WHERE maturity_stage = 'V3') AS v3_pct,
  AVG(score_pct) FILTER (WHERE maturity_stage = 'V4') AS v4_pct,
  BOOL_OR(score_pct < 85.00) AS requires_adoption_nudge
FROM mis_adoption_events_daily
GROUP BY 1, 2, 3, 4;

CREATE UNIQUE INDEX IF NOT EXISTS ux_mv_adoption_heatmap
  ON mv_adoption_heatmap (business_date, level_key, scope_code, module_key);

CREATE INDEX IF NOT EXISTS ix_mis_commitments_view_status
  ON mis_meeting_commitments (department_view_key, status, due_at);

6. Owner Sign-Off Block (MIS-1..14)

  • ☑ [READY FOR OWNER SIGN-OFF] Approve MIS-1 Core Law (Zero Dead Charts — Every Roll-Up Tile Pairs Outcome + Adoption % + 1-Click Action CTA): Every MIS card across all views displays its 4-level roll-up (Company -> City -> Cluster -> Outlet), its V1–V4 adoption percentage, and 1-click action buttons ([🔔 Nudge Owner], [➕ Assign Meeting Countermeasure], [📍 Assign Manager Visit], [✓ Approve / Unblock]).
  • ☑ [READY FOR OWNER SIGN-OFF] Approve MIS-2..10 8 Role-Scoped MIS Views (View 0 CXO All-Hands Synthesizing All 12 Modules + Views 1..7 Departmental Cockpits): Covers Ops & Kiosk, CPU/CK & 7-Stage NPL, Global/China Imports & SCM, People/Roster/Loans & Academy, Finance/Recon & Petty Cash, Café Projects/Assets & Maint CMMS, and Legal/Compliance & Audit/Visits with sticky FV-1..12 filters and zero individual stack-ranking (OV-6 / A3).
  • ☑ [READY FOR OWNER SIGN-OFF] Approve MIS-11..14 Adoption Heatmap (<85% Nudge Trigger), Live Meeting Mode (Danaher Red-Cell Countermeasures into MyTasks), and <80ms Pre-Aggregated Roll-Up Spine (mis_kpi_rollup_15m): Enables running all weekly executive and departmental reviews directly out of /mis without slide decks or spreadsheets.