DAMG 7245 β Fall 2025 β Binary Insights
Automates the extraction, embedding, retrieval, and structured-note generation of investment diligence data from all Forbes AI 50 company websites.
Powered by Apache Airflow, OpenAI GPT-4o, Selenium + ChromeDriver, LangChain, Pinecone, FastAPI, Streamlit, and AWS S3, all containerized with Docker + Docker Compose for reproducible cloud deployment.
- OS: macOS, Linux, or Windows (WSL2)
- Git: Latest version
- Docker: 20.10+ and Docker Compose 2.0+
- Python: 3.11+ (for local dev)
- API Keys:
- OpenAI (required)
- Pinecone (required for production)
- AWS S3 (optional but recommended for cloud storage)
git clone https://github.com/Binary-Insights/Assignment_04.git
cd Assignment_04Create a .env file in the project root:
# OpenAI
OPENAI_API_KEY=sk-...
# Pinecone (for RAG pipeline)
PINECONE_API_KEY=your-pinecone-key
PINECONE_INDEX_NAME=bigdata-assignment-04
PINECONE_NAMESPACE=default
# AWS S3 (for cloud storage)
AWS_ACCESS_KEY_ID=your-aws-key-id
AWS_SECRET_ACCESS_KEY=your-aws-secret
AWS_DEFAULT_REGION=us-east-1
S3_BUCKET_NAME=damg-assignment-04-airflow
# Airflow Configuration
AIRFLOW_UID=$(id -u)
AIRFLOW__CORE__LOAD_EXAMPLES=False
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION=True
AIRFLOW__CORE__MAX_ACTIVE_TASKS_PER_DAG=10python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txtcd docker
docker-compose build --no-cache
docker-compose up -dWait 30β60 seconds for all services to initialize.
docker psExpected output:
airflow-schedulerairflow-webserver(http://localhost:8080)fastapi(http://localhost:8000)streamlit(http://localhost:8501)
| Service | URL | Credentials |
|---|---|---|
| Airflow UI | http://localhost:8080 | airflow / airflow |
| FastAPI Docs | http://localhost:8000/docs | N/A (Swagger) |
| Streamlit Dashboard | http://localhost:8501 | N/A (web) |
Full Load (first-time):
docker-compose exec airflow-webserver airflow dags trigger ai50_full_ingest_dagDaily Refresh:
docker-compose exec airflow-webserver airflow dags trigger ai50_daily_refresh_dag| DAG | Command | Purpose |
|---|---|---|
| Discover | airflow dags trigger discover_ai50_dag |
Fetch companies & discover pages |
| Process Pages | airflow dags trigger process_pages_dag |
Scrape with Selenium |
| Store to S3 | airflow dags trigger store_ai50_data_dag |
Upload raw data & metadata |
python src/rag/ingest_to_pinecone.py --all --verboseChunks text (500 chars), generates embeddings, upserts to Pinecone.
python src/rag/structured_extraction.py --all --verboseExtracts company records, events, products, leadership using GPT-4o + Instructor.
FastAPI:
curl -X POST http://localhost:8000/dashboard/rag \
-H "Content-Type: application/json" \
-d '{"company_id": "world-labs"}'Streamlit: Open http://localhost:8501, select company, choose pipeline.
python src/backend/evaluate_rag_vs_structured.pyScores both pipelines on factuality, schema adherence, provenance, hallucination, readability.
docker-compose down -v| Issue | Fix |
|---|---|
| OpenAI error | Check OPENAI_API_KEY in .env |
| Pinecone failed | Verify PINECONE_API_KEY, PINECONE_INDEX_NAME |
| Selenium timeout | Increase timeout or retry problematic sites |
| S3 upload fails | Check AWS credentials and bucket permissions |
| DAG not visible | Restart scheduler: docker-compose restart airflow-scheduler |
| Out of memory | Reduce max_active_tasks_per_dag in .env |
| Docker build fails | Run docker system prune with --no-cache |
Assignment_04/
βββ src/discover/ # Phase 0: Discovery
βββ src/rag/ # Phase 2-5: RAG & Structured
βββ src/backend/ # Phase 4: API
βββ src/frontend/ # Phase 4: UI
βββ src/dags/ # Alternative DAGs
βββ dags/ # Main orchestration DAGs
βββ docker/ # Containerization
βββ data/ # Raw, structured, vectors, payloads
βββ chromedriver/ # Selenium
βββ templates/ # Prompt templates
Generated: 2025-11-08T16:34:53.044297Z
| Company | Method | Factual (0-3) | Schema (0-2) | Provenance (0-2) | Hallucination (0-2) | Readability (0-1) | MRR | Total (0-14) |
|---|---|---|---|---|---|---|---|---|
| Abridge | Structured | 2 | 1 | 0 | 1 | 0 | 1.00 | 6.0 |
| Abridge | Rag | 2 | 1 | 0 | 1 | 0 | 1.00 | 6.0 |
| Anthropic | Structured | 2 | 1 | 0 | 1 | 0 | 1.00 | 6.0 |
| Anthropic | Rag | 2 | 1 | 0 | 1 | 0 | 1.00 | 6.0 |
| World Labs | Structured | 2 | 1 | 0 | 1 | 0 | 1.00 | 6.0 |
| World Labs | Rag | 2 | 1 | 0 | 1 | 0 | 1.00 | 6.0 |
Structured Pipeline: Average Score = 6.00/14 RAG Pipeline: Average Score = 6.00/14
Structured Pipeline Average MRR: 1.000 RAG Pipeline Average MRR: 1.000
MRR measures how well important facts are ranked (higher is better, 1.0 is perfect)
β
End-to-End Automation | β
Dual Pipelines (RAG & Structured)
β
LLM-Powered Discovery | β
JavaScript Rendering
β
Semantic Search (Pinecone) | β
Type-Safe Extraction
β
Airflow Orchestration | β
Streamlit Dashboard
β
Evaluation Framework | β
Cloud-Ready (Docker + S3)
π Full Technical Codelabs β Detailed walkthrough
π Assignment Requirements β Lab breakdown
π₯ Demo Video β Project walkthrough
Selenium | ChromeDriver | BeautifulSoup | AWS S3 | Apache Airflow | Pinecone | LangChain | Pydantic | Instructor | GPT-4o | OpenAI Embeddings | FastAPI | Streamlit | Docker
WE ATTEST THAT WE HAVEN'T USED ANY OTHER STUDENTS' WORK IN OUR ASSIGNMENT AND ABIDE BY THE POLICIES LISTED IN THE STUDENT HANDBOOK.
