Skip to content
lenzencPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

fshare — AI Document Extraction POC

A financial-services proof of concept that eliminates manual data entry from client onboarding. Clients upload a financial document; Claude classifies it and extracts every relevant field as structured data — no analyst opening PDFs and typing values by hand.

Demo

fshare-demo.mp4

(If the player doesn't load, download the demo.)

How it works

  1. Client uploads a financial document (PDF, JPEG, PNG, or WebP).
  2. Claude classifies the document type (W-2, Form 1040, brokerage statement, etc.).
  3. Claude extracts every advisor-relevant field using a type-specific Pydantic schema enforced at the API level — wages, AGI, account balances, holdings, withholdings, and more.
  4. Structured data is persisted to a per-client unified record (Income / Tax / Assets).
  5. The original file is not retained in production — only the extracted fields are stored.

Two Claude API calls are made per document (classify → extract). The full prompt, enforced JSON schema, raw response, latency, and token counts are logged to the LLM Activity page for complete auditability.

Supported document types

Document Unified record section
IRS Form W-2 Income
Pay Stub Income
IRS Form 1040 Income + Tax
IRS Form 1099 (INT / DIV / R) Tax
Brokerage Statement Assets
401k / IRA Statement Assets

Pages

Route Description
/ Home — overview and navigation
/upload Upload a document and watch it get classified and extracted in real time
/records Unified client profile (Income, Tax, Assets) + per-document extraction history
/data-model Live schema reference — every extractable field, typed and described
/activity Full LLM audit log — prompt, schema, response, latency, token counts

Stack

  • Backend: FastAPI + SQLite (via sqlite3)
  • AI: Anthropic Python SDK — client.messages.parse() with Pydantic v2 structured output
  • Frontend: Vanilla HTML / CSS / JS (no build step)
  • Tooling: uv

Requirements

  • Python ≥ 3.14
  • uv
  • An Anthropic API key

Setup

# 1. Install dependencies
uv sync

# 2. Set your API key
echo "ANTHROPIC_API_KEY=sk-ant-..." > .env

# 3. Start the server
uv run uvicorn app.main:app --reload

Open http://localhost:8000.

Demo mode vs. production mode

By default the app runs in demo mode (FSHARE_RETAIN_FILES=1): uploaded files are kept in a doc_files SQLite table so they can be previewed on the Records page.

Set FSHARE_RETAIN_FILES=0 to switch to production behavior: file bytes are held in memory only for the duration of the request and are never written to disk.

Generating the demo

The narrated demo video is produced by a Playwright script. It starts a local server, uploads three sample documents, walks through every page, and muxes macOS say narration onto the recording with ffmpeg.

Prerequisites: ffmpeg installed (brew install ffmpeg), macOS (for say TTS).

# Install Playwright browsers (one-time)
uv run playwright install chromium

# Generate sample documents (if not already present)
uv run scripts/gen_samples.py

# Record the demo  →  demo/fshare-demo.mp4
uv run scripts/record_demo.py

Optional env vars:

Variable Default Description
FSHARE_TTS_VOICE Daniel (English (UK)) macOS voice name (e.g. "Samantha")
FSHARE_TTS_RATE 175 Words per minute
FSHARE_AUDIO_LEAD 0.5 Seconds of audio lead before each caption

Install a Premium or Siri voice in System Settings → Accessibility → Spoken Content for higher-quality narration, then point FSHARE_TTS_VOICE at it.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages