seubert-claims/ondeck
lorentz 30fe43fbf6 feat(imageright): two-pass metadata + content-inspection audit model
Replace the single-pass, exact-match-only audit with the two-pass model from
imageright_claim_review_audit_methodology.md, applied across all 10 SHAPE
checklist items:

- TaskAudit.status (3-state) -> TaskAuditClassification (7-state): PASS,
  PASS_WITH_NAMING_EXCEPTION, MANUAL_REVIEW, FAIL_MISSING, FAIL_LATE,
  FAIL_WRONG_ARTIFACT, NOT_APPLICABLE. New columns for confidence score,
  evidence bucket, naming-exception/manual-review flags, msg subject/sent
  date, attachment filenames, a human-readable evidence summary, and the
  full scoring signal trail (matched_signals).
- New audit-scoring.ts: weighted metadata + content scoring per the
  methodology's table, generalized to use each spec item's own
  keywords/docTypes rather than a hardcoded claim-specific list.
- New content-inspector.ts: downloads and parses `.msg` (subject, sender,
  sent date, body, attachments via @kenjiuno/msgreader), `.xlsx` (sheet
  names/cell text via xlsx), and `.pdf` (text-layer only via pdf-parse,
  no OCR) — recursing one level into email attachments.
- ImageRightClient: new getPageImageContent() using the v2 REST API
  (`/api/v2/pages/{pageId}/images/{imageId}/{version}`) — the only endpoint
  that returns raw file bytes; v1 only exposes JSON metadata. Verified live
  against a real .msg (correct OLE2 signature, exact byte-size match).
- audit-matching.ts: matchesKeywords is now plural/singular-tolerant
  (normalizeForMatch) — fixes false negatives like "Open Claims Review" not
  matching keyword "CLAIM REVIEW". Added docTypesToExtensions, mapping the
  spec's generic doc_types labels to real file extensions (evidence shows
  these labels describe file format, not ImageRight's document-type
  taxonomy).
- audit-engine.ts: auditSpecItem() replaces findBestMatch() — scores every
  in-window candidate, falls back to strict exact-match (fast path, no
  content download) when possible, otherwise deep-inspects the top
  candidate and only confirms PASS_WITH_NAMING_EXCEPTION when content
  positively confirms (not merely "score didn't decrease"). Also fixes a
  real accuracy bug: unscoped whole-file document search silently truncates
  at ~1000 docs on high-volume accounts (verified live) — ALL_TIME spec
  items now iterate every folder instead (findDocumentsSafe).
- UI/API updated for the new classification taxonomy and evidence fields.

Verified end-to-end live against the methodology doc's own worked example
(American Marine Express, Inc., IR document 12884779): real API calls, real
.msg download/parse (found both a signature image and the actual Excel
attachment), correctly classified PASS_WITH_NAMING_EXCEPTION.

68 new/updated tests covering scoring, content parsing (real xlsx bytes;
mocked msgreader/pdf-parse), fuzzy keyword matching, and all 6+1
classification outcomes via auditSpecItem with a fake ImageRight client.

Known follow-up (not resolved here): this client's stored Client.renewalDate
(2026-10-07) and PolicyGroup renewal date (2027-03-02) don't match the
2026-04-04 renewal date used in the methodology doc's own example — worth
reconciling separately, since it determines which target-date windows the
live app actually computes for this client.
2026-07-08 14:36:23 +00:00
..
.claude Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
docs feat(automation): move task auto-generate to post-sync + admin config UI 2026-07-07 18:26:12 +00:00
prisma feat(imageright): two-pass metadata + content-inspection audit model 2026-07-08 14:36:23 +00:00
public Signin: use black logo with CSS invert for white rendering on green panel 2026-04-13 02:52:33 +00:00
scripts feat(imageright): Task Audit feature for SHAPE clients 2026-07-08 10:39:12 +00:00
src feat(imageright): two-pass metadata + content-inspection audit model 2026-07-08 14:36:23 +00:00
.gitignore fix: Prisma where clause conflict causing old non-terminal tasks to bypass dueDate cutoff 2026-04-08 18:38:07 +00:00
ARCHITECTURE.md Fix: open overdue tasks no longer hidden by 7-day age cutoff 2026-05-19 03:24:14 +00:00
components.json Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
docker-compose.yml Remove obsolete docker-compose version attribute 2026-04-13 01:28:40 +00:00
Dockerfile Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
eslint.config.mjs Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
jest.config.js Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
jest.setup.js Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
next.config.ts Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
package-lock.json feat(imageright): two-pass metadata + content-inspection audit model 2026-07-08 14:36:23 +00:00
package.json feat(imageright): two-pass metadata + content-inspection audit model 2026-07-08 14:36:23 +00:00
postcss.config.mjs Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
prisma.config.ts Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
README.md Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
restart-dev.sh Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00
SERVER.md Rebrand: rename ondeck->horizon in package.json, docker-compose, SERVER.md, docs; production stack at /opt/stacks/horizon 2026-04-12 23:59:20 +00:00
tsconfig.json Initial commit: OnDeck project 2026-02-18 13:20:52 +00:00

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.