Snapshot of the working project as of 2026-10-23 (local 2d4d4fc), one commit with no earlier history: the tracked files were de-identified first (synthetic claim ids and patient data only; see Context.md section 7). Credentials, run logs, screenshots, claim reports and client workbooks are gitignored and not included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4.6 KiB
Results Portal Redesign Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Replace the one-page results table with a Dashboard → Claim status (date cards) → One day (short table + side panel) portal, plus a claim history search, in a navy & blue theme.
Architecture: Server-rendered FastAPI + Jinja pages sharing base.html. Three new read-only queries in web/repo.py group the existing CV_ChargeSummary rows by the day a run started. The Bot run card and /api/* stay as they are; old /?run_at= links redirect to the day page.
Tech Stack: FastAPI, Jinja2, pyodbc (SQL Server), vanilla JS, standalone test scripts (python tests\test_web_app.py).
Spec: docs/superpowers/specs/2026-10-19-results-portal-redesign-design.md
Global Constraints
- Bound to 127.0.0.1; Host allowlist,
no-storeheaders, DB errors by kind — unchanged. - Start / Stop need the page Origin and
X-Run-Token; page runs are VERIFY only. - All new pages read-only; every SQL statement parameterized; values never in SQL text.
- DB text is escaped: Jinja autoescape, panel data via
tojsonin an attribute, written withtextContent. - No claim ids or patient data in tracked docs; tests use made-up ids.
- No git commits unless the operator asks.
Task 1: Day-wise queries in the repo
Files: Modify web/repo.py; Test tests/test_web_app.py
Interfaces — Produces:
-
SqlResultsRepo.days(limit: int = 90) -> list[dict]— keysday(date),claims,runs,pass_count,fail_count,review_count; newest first. -
SqlResultsRepo.day_results(day: date, category=None, claim_no=None) -> list[dict]— full rows (_SELECT_COLUMNS) withrun_at >= day AND run_at < day+1, orderedrun_at, s_no, id. -
SqlResultsRepo.claim_history(claim_no: str) -> list[dict]—TOP 200full rowsWHERE claim_no LIKE ?orderedrun_at DESC, s_no, id. -
_coercealso turns a textdayinto adate. -
Tests: each query's SQL is a parameterized SELECT with the clauses above and the expected params (
[datetime(day), datetime(day)+1 day],["%no%"]); textdaycoerced. -
Implement; run
python tests\test_web_app.py.
Task 2: Routes
Files: Modify web/app.py; Test tests/test_web_app.py
Interfaces — Consumes: Task 1. Produces: routes
-
GET /→dashboard.htmlwithtoday(days() row fordate.today()or zero counts),mode("VERIFY"/"LIVE-WRITE"),run_token.GET /?run_at=<iso>→ 303 to/day/<date>(keepscategory,claim_no); badrun_at→ 400. -
GET /days→days.htmlwithdays. -
GET /day/{day}(YYYY-MM-DD, else 400) withcategory,claim_no,claim→day.htmlwithday,counts(fromdays()row or computed from the unfiltered rows),rows(each withfields= list of[header, display text]anddetails_pretty), filters. -
GET /claim?claim_no=→claim.htmlwithrows(history) andclaim_no; empty search → page with the box only. -
FakeRepo in tests gains
days,day_results,claim_history. -
Tests for each route (data shown, links, filters passed, 400s, redirect, DB down 503, hardening incl. new paths).
-
Implement; run tests.
Task 3: Templates and theme
Files: Create web/templates/base.html, dashboard.html, days.html, day.html, claim.html; delete web/templates/index.html.
-
base.html::rootnavy palette, header (title, mode pill, breadcrumb block),{% block content %},{% block scripts %}, footer PHI note. -
dashboard.html: Bot run card (moved from index.html, with the Live claims panel replacing the old Claim status panel; a saved claim opens/day/<results_run_at date>?claim=<id>), today tiles, Find a claim form, big Claim status button. -
days.html: date cards grid with counts and colour bar; empty state. -
day.html: tiles as filter links, claim search, short table (#, Claim #, Time, Payer, Result, Comments), 10-a-page pager, side panel fromdata-fields(tojson) viatextContent;?claim=opens it. -
claim.html: search box and history table linking to day pages. -
Tests on rendered HTML (ids, links, no inline
style=, theme vars, panel wiring, one-scroll lock, Live claims link target). -
Run
python tests\test_web_app.pyandpython tests\test_run_status.py.
Task 4: Browser check
- Serve the app on a fake repo with sample data (scratch script, made-up ids), open each page in the in-app browser, screenshot, check pager, panel, filters, empty states, narrow width.
- Full suite.