An LLM-driven financial document intelligence system that automates earnings report analysis extracting structured metrics, generating analyst-grade narratives, and enabling interactive document exploration via multi-turn Q&A.
Built to reduce manual earnings review time and accelerate insight generation for financial analysis workflows.
## Demo
$ python earnings_analyzer.py apple_q4_2024.pdf
============================================================
EARNINGS REPORT ANALYZER
============================================================
Loading PDF: apple_q4_2024.pdf
Extracted 42,891 characters from 18 pages.
[1/2] Extracting structured metrics...
[2/2] Writing analyst narrative summary...
============================================================
STRUCTURED EXTRACTION
============================================================
Company: Apple Inc.
Period: Q4 FY2024
Revenue: $94.9B
YoY: +6.1%
vs Est: Beat by ~$1.2B
EPS: $1.64
YoY: +12%
vs Est: Beat
Key Metrics:
• Services Revenue: $24.97B — Record quarter, up 12% YoY
• iPhone Revenue: $46.2B — Up 6% YoY
• Mac Revenue: $7.7B — Up 2% YoY
Guidance:
Next Q: Revenue in the range of $89B–$93B
Key Themes: Services growth | AI integration | Emerging markets
Risks: China competition | Regulatory pressure
Mgmt Tone: Bullish — Management emphasized record Services performance and AI-driven product roadmap
============================================================
ANALYST SUMMARY
============================================================
Apple reported strong fourth-quarter results, with revenue of $94.9B exceeding consensus by approximately
$1.2B and EPS of $1.64 beating estimates by $0.08...
[continues...]
============================================================
Q&A Mode — Ask anything about Apple's earnings
Type 'exit' or 'quit' to stop.
You: What drove the Services beat?
Analyst: Services revenue of $24.97B, a record quarter, was driven by growth across the App Store,
Apple Music, iCloud, and AppleCare. Management cited 1B+ paid subscriptions globally...
\---
\## Setup
\*\*Requirements:\*\* Python 3.9+, Anthropic API key (\[get one here](https://console.anthropic.com))
```bash
\# Clone the repo
git clone https://github.com/Chidvy/earnings-report-analyzer.git
cd earnings-analyzer
\# Install dependencies
pip install -r requirements.txt
\# Set your API key
export ANTHROPIC\_API\_KEY=your\_key\_here
\# Or copy .env.example to .env and fill it in
---
## Usage
\# Analyze a PDF (full workflow: extract + summarize + Q\&A)
python earnings\_analyzer.py report.pdf
\# Skip the interactive Q\&A
python earnings\_analyzer.py report.pdf --no-qa
\# Save structured JSON output
python earnings\_analyzer.py report.pdf --output results.json
\# Analyze raw text instead of a PDF
python earnings\_analyzer.py --text "Revenue was $5.2B, up 12% YoY..."
**Where to get earnings PDFs:**
- [SEC EDGAR](https://www.sec.gov/cgi-bin/browse-edgar) — search any public company, look for 10-Q/10-K filings
- Company investor relations pages (e.g. Apple, Microsoft, J&J, CVS Health)
- Earnings call transcripts from [Motley Fool](https://www.fool.com/earnings-call-transcripts/) (copy/paste text)
---
## Example JSON Output
{
  "structured\_metrics": {
  "company": "Apple Inc.",
  "period": "Q4 FY2024",
  "revenue": {
  "actual": "$94.9B",
  "yoy\_change": "+6.1%",
  "vs\_estimate": "Beat by \~$1.2B"
  },
  "earnings\_per\_share": {
  "actual": "$1.64",
  "yoy\_change": "+12%",
  "vs\_estimate": "Beat"
  },
  "key\_metrics": \[...],
  "guidance": {...},
  "key\_themes": \[...],
  "management\_tone": "Bullish — ..."
  },
  "narrative\_summary": "Apple reported strong fourth-quarter results..."
}
---
## Design Decisions
| Choice | Rationale |
|---|---|
Fast and cost-effective for document extraction tasks |
| Two-pass architecture | Separate structured extraction from narrative generation for cleaner outputs |
| 80K char truncation | Stays safely within context limits while covering most earnings docs |
| Multi-turn Q&A | Maintains conversation history to support follow-up questions |
| JSON-first extraction | Structured output enables downstream use (dashboards, alerts, comparisons) |
---
## Potential Extensions
- **Batch processing** — run across multiple quarters and track metric trends over time
- **Comparison mode** — compare two companies' earnings side-by-side
- **Alerts** — flag when guidance misses consensus by a threshold
- **Healthcare variant** — adapt extraction schema for clinical trial readouts or hospital earnings (CMS reporting)
- **Streamlit UI** — drag-and-drop PDF interface with charts
---
## Tech Stack
Large Language Model API (Claude / OpenAI compatible)
- Python 3.9+
- [Anthropic Python SDK]
---
## Author
**Durga Meduri** — Business Analytics Manager | MS Business Analytics, UMass Boston
[LinkedIn](https://www.linkedin.com/in/durga-c-meduri/) | [GitHub](https://github.com/Chidvy)