Analyze your executed contract portfolio to extract and benchmark key commercial terms. See how your liability caps, payment terms, warranty periods, and other positions compare to your targets and how they've trended over time.
Coming soon — a hosted version will be available at a public URL.
./start.sh # macOS / Linux
start.bat # WindowsThis automatically installs dependencies, generates sample contracts, starts both the API and frontend, and opens your browser.
Requirements: Python 3.11+ and an Anthropic API key.
Set your API key before running:
export ANTHROPIC_API_KEY=your-key-here # macOS/Linux
set ANTHROPIC_API_KEY=your-key-here # WindowsANTHROPIC_API_KEY=your-key-here docker compose up- Frontend: http://localhost:8501
- API docs: http://localhost:8000/docs
- Fork this repository
- Create a new project on Railway
- Connect your GitHub repo
- Add environment variable:
ANTHROPIC_API_KEY - Deploy — Railway uses
Dockerfile.railwayautomatically
- Bulk contract ingestion — Upload PDF and Word contracts
- AI-powered extraction — Claude extracts liability caps, indemnity scope, payment terms, warranty periods, termination provisions, SLA commitments, and contract value/duration
- Source clause tracking — Every extracted term links back to the exact contract language
- Distribution analysis — See how your terms are distributed across your portfolio
- Trend analysis — Track how your negotiated positions have changed over time
- Counterparty comparison — Compare terms across different counterparties
- Playbook benchmarking — Set target positions and see which contracts deviate
- Compliance scoring — Portfolio-wide compliance rate against your playbook
- Exportable reports — Download portfolio and contract reports as CSV or JSON
contract-analytics/
├── src/contract_analytics/ # FastAPI backend
│ ├── main.py # App entry point
│ ├── config.py # Settings
│ ├── database.py # SQLAlchemy setup
│ ├── models/ # ORM models
│ ├── schemas/ # Pydantic schemas
│ ├── services/ # Business logic
│ └── api/v1/ # API routers
├── ca_frontend/app.py # Streamlit UI
├── tests/ # pytest tests
├── scripts/ # Utilities
│ └── generate_sample_contracts.py
└── data/
├── sample/ # Synthetic sample contracts
└── uploads/ # Uploaded contracts (gitignored)
With the server running, visit http://localhost:8000/docs for interactive Swagger docs.
Key endpoints:
| Endpoint | Description |
|---|---|
POST /api/v1/contracts/upload |
Upload contracts |
POST /api/v1/contracts/{id}/extract |
Extract terms from a contract |
GET /api/v1/analytics/summary |
Portfolio summary stats |
GET /api/v1/analytics/distributions/{term_type} |
Term distribution |
GET /api/v1/analytics/trends/{term_type} |
Term trends over time |
GET /api/v1/analytics/playbook-deviation |
Playbook compliance |
GET /api/v1/reports/portfolio |
Export portfolio report |
pip install -e ".[dev]"
pytest- Backend: Python 3.11+, FastAPI, SQLAlchemy 2.0, Pydantic v2
- AI: Anthropic Claude (Sonnet) via tool_use for structured extraction
- Document parsing: PyMuPDF (PDF), python-docx (Word)
- Frontend: Streamlit with Plotly charts
- Database: SQLite (designed for PostgreSQL migration)
- Deployment: Docker, Railway
MIT License. Copyright (c) 2026 Noam Raz and Pleasant Secret Labs.