Fully automated AI-powered system for generating professional EB-1A (Extraordinary Ability) visa petition attorney letters from client evidence folders.
Aurigo processes client-provided evidence folders containing diverse document formats (PDFs, images, certificates, scanned documents) and automatically generates professional attorney support letters with auto-numbered exhibits following the official EB-1A format.
- Multi-format Document Processing: Handles PDFs, DOCX, images, PPTX, HTML, and scanned documents with OCR
- Intelligent Criteria Mapping: Automatically maps client folder names to official EB-1A criteria using pattern matching and LLM analysis
- Structured Information Extraction: Extracts key facts, entities, and summaries from all evidence documents
- Auto-Exhibit Management: Systematic exhibit numbering (A-1, A-2... B-1, B-2...) with descriptive titles
- Professional Letter Generation: Creates attorney letters following legal formatting standards
- DOCX Export: Generates formatted attorney letter and exhibit index documents
- Background Processing: Async case processing with real-time progress tracking
- Backend: Python 3.11+ + FastAPI
- Frontend: Next.js 14 + React + TypeScript
- Database: SQLAlchemy (SQLite/PostgreSQL)
- LLM: Gemini 2.5 Flash (primary), Claude Sonnet 4 (optional polish)
- Document Parser: Docling (97.9% accuracy with OCR)
- UI: Tailwind CSS
- Python 3.11 or higher
- pip (Python package manager)
- Node.js 18+ and npm (for frontend)
- Tesseract OCR (for document parsing with OCR)
- Gemini API key (required) - Get from Google AI Studio
- Claude API key (optional) - Get from Anthropic Console
# 1. Navigate to backend directory
cd backend
# 2. Create virtual environment
python -m venv venv
# 3. Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# 4. Install dependencies
pip install -r requirements.txt
# 5. Configure environment variables
cp .env.example .env
# Edit .env and add your API keys:
# GEMINI_API_KEY=your-gemini-api-key-here
# CLAUDE_API_KEY=your-claude-api-key-here-optional
# USE_CLAUDE_POLISH=false
# 6. Run database migrations (creates tables)
python -c "from app.database import engine, Base; from app.models import *; Base.metadata.create_all(bind=engine)"
# 7. Start the backend server
python run.pyBackend will be available at http://localhost:8000
API Documentation: http://localhost:8000/docs
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Configure environment
cp .env.example .env.local
# Edit .env.local and ensure NEXT_PUBLIC_API_URL points to your backend
# Start development server
npm run devFrontend will be available at http://localhost:3000
Features:
- Modern responsive UI with dark/light theme toggle
- Case upload with drag-and-drop support
- Real-time processing progress tracking
- Letter preview with exhibit index
- Complete case management dashboard
- Upload: Client uploads a ZIP file containing case folder with
Case_Overview.docxandEvidence/subfolder - Validation: System validates folder structure and checks for required documents
- Criteria Mapping: Automatically maps evidence folder names to EB-1A criteria
- Document Parsing: Extracts text, tables, and metadata from all documents using Docling
- Information Extraction: Uses Gemini 2.5 Flash to extract structured information (key facts, entities, summaries)
- Exhibit Management: Assigns exhibit IDs (A-1, A-2... B-1, B-2...) systematically
- Letter Generation: Generates professional attorney letter following legal template
- Export: Creates formatted DOCX files for attorney letter and exhibit index
- Document Parser (
document_parser.py) - Docling-based multi-format parsing with OCR - Folder Validator (
folder_validator.py) - Validates case folder structure - Criteria Mapper (
criteria_mapper.py) - Maps folder names to EB-1A criteria - Information Extractor (
information_extractor.py) - Extracts structured data using Gemini - Exhibit Manager (
exhibit_manager.py) - Auto-assigns exhibit IDs and tracks mappings - Letter Generator (
letter_generator.py) - Generates complete attorney letters - Document Exporter (
document_exporter.py) - Creates formatted DOCX files - Case Orchestrator (
case_orchestrator.py) - Coordinates complete workflow
- Gemini 2.5 Flash (
gemini.py) - Primary LLM for document analysis and generation - Claude Sonnet 4 (
claude.py) - Optional letter polishing for legal tone - LLM Factory (
factory.py) - Flexible provider switching
- User Authentication - JWT-based auth with signup/login
- Database Models - Case, Document, CaseExhibit, GeneratedLetter models
- REST API Endpoints - Upload, process, status, preview, download, list, delete
- Background Processing - Async case processing with progress tracking
POST /api/cases/upload- Upload case folder (ZIP)POST /api/cases/{id}/process- Start background processingGET /api/cases/{id}/status- Get processing statusGET /api/cases/{id}/preview- Preview generated letterGET /api/cases/{id}/download- Get download links for DOCX filesGET /api/cases- List all casesDELETE /api/cases/{id}- Delete case
- Authentication Pages - Login and registration with JWT auth
- Dashboard - Overview with case statistics and recent activity
- Case Upload - Drag-and-drop ZIP upload with validation
- Case List - View all cases with status indicators
- Case Detail - Real-time processing progress with live updates
- Letter Preview - View generated letter with exhibit index
- Dark/Light Theme - Seamless theme switching with persistence
- Responsive Design - Optimized for desktop, tablet, and mobile
aurigo/
├── backend/
│ ├── app/
│ │ ├── llm/ # LLM integrations
│ │ │ ├── gemini.py # Gemini 2.5 Flash
│ │ │ ├── claude.py # Claude Sonnet 4
│ │ │ └── factory.py # LLM factory
│ │ ├── services/ # Core business logic
│ │ │ ├── document_parser.py # Docling parser
│ │ │ ├── folder_validator.py # Folder validation
│ │ │ ├── criteria_mapper.py # Criteria mapping
│ │ │ ├── information_extractor.py # Info extraction
│ │ │ ├── exhibit_manager.py # Exhibit management
│ │ │ ├── letter_generator.py # Letter generation
│ │ │ ├── document_exporter.py # DOCX export
│ │ │ └── case_orchestrator.py # Workflow orchestration
│ │ ├── routers/ # API endpoints
│ │ │ ├── auth.py # Authentication
│ │ │ ├── llm.py # LLM endpoints
│ │ │ └── cases.py # Case management
│ │ ├── models.py # Database models
│ │ ├── database.py # Database connection
│ │ ├── auth.py # Authentication logic
│ │ ├── config.py # Configuration
│ │ └── main.py # FastAPI app
│ ├── requirements.txt # Python dependencies
│ ├── .env.example # Environment template
│ └── run.py # Server runner
├── frontend/ # Next.js frontend (planned)
├── Pranav_Case_Data/ # Sample case data
├── docs/ # Sample documents
└── README.md # This file
All core functionality is organized into modular services that can be tested and modified independently:
# Example: Processing a case
orchestrator = CaseOrchestrator(db)
result = await orchestrator.process_case(
case_id=case_id,
folder_path=folder_path,
beneficiary_name=beneficiary_name
)Easy to swap between Gemini and Claude:
# Gemini for analysis
gemini = GeminiLLM()
extracted = await gemini.analyze_document(document_text, criterion)
# Claude for polishing (optional)
claude = ClaudeLLM()
polished = await claude.polish_letter(draft_letter)Long-running case processing happens in the background with real-time progress updates:
# Start processing
background_tasks.add_task(orchestrator.process_case, ...)
# Check status anytime
GET /api/cases/{id}/status
# Returns: {"status": "processing", "progress": 45, "current_step": "extracting_information"}Comprehensive tracking of cases, documents, exhibits, and generated letters:
- Case: Main entity with status, progress, criteria matched, output paths
- Document: Individual files with parsed text, extracted info, exhibit assignment
- CaseExhibit: Exhibit assignments with group-based numbering
- GeneratedLetter: Version tracking for attorney letters
Your case folder should follow this structure:
Client_Case_Folder/
├── Case_Overview.docx # Beneficiary background and overview
└── Evidence/
├── 1. Awards and Prizes/ # Evidence folder for criterion 1
│ ├── certificate1.pdf
│ └── award_letter.jpg
├── 2. Membership/ # Evidence folder for criterion 2
│ └── membership_card.pdf
├── 3. Critical Role/ # Evidence folder for criterion 8
│ ├── job_offer.docx
│ └── org_chart.png
└── ...
Supported Document Formats: PDF, DOCX, JPG, PNG, TIFF, PPTX, HTML, MD
The system automatically maps evidence to these 10 official EB-1A criteria:
- Awards / Prizes - Recognition for excellence
- Membership - Elite associations requiring outstanding achievements
- Published Material - Media coverage about the applicant
- Judging - Judging work of others in the field
- Original Contributions - Major significance to the field
- Authorship - Published scholarly articles
- Exhibitions - Artistic displays
- Leading or Critical Role - Critical positions in distinguished organizations
- High Salary - High remuneration compared to others
- Performing Arts Success - Commercial success in performing arts
Note: EB-1A visa requires meeting at least 3 out of 10 criteria.
You can test the system using the provided Pranav case data:
# 1. Start the backend server
cd backend
python run.py
# 2. Create a test user via API
curl -X POST http://localhost:8000/api/auth/signup \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","username":"test","password":"test123","full_name":"Test User"}'
# 3. Login and get token
curl -X POST http://localhost:8000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"test","password":"test123"}'
# 4. ZIP the Pranav_Case_Data folder
# 5. Upload via API (see API docs at http://localhost:8000/docs)Full interactive API documentation is available at http://localhost:8000/docs when the backend is running.
Authentication
POST /api/auth/signup- Register new userPOST /api/auth/login- Login and get JWT token
Case Management
POST /api/cases/upload- Upload case folder (ZIP)POST /api/cases/{id}/process- Start processingGET /api/cases/{id}/status- Check progressGET /api/cases/{id}/preview- Preview letterGET /api/cases/{id}/download- Download files
Configure the system via .env file:
# Database
DATABASE_URL=sqlite:///./aurigo.db
# LLM Provider
LLM_PROVIDER=gemini
GEMINI_API_KEY=your-gemini-api-key
GEMINI_MODEL=gemini-2.0-flash-exp
# Optional Claude Polishing
CLAUDE_API_KEY=your-claude-api-key
CLAUDE_MODEL=claude-sonnet-4-20250514
USE_CLAUDE_POLISH=false
# Server
HOST=0.0.0.0
PORT=8000
DEBUG=True# Backend (with hot reload)
cd backend
python run.py
# Run specific service tests
python -m pytest tests/
# Frontend (with hot reload) - Coming Soon
cd frontend
npm run devProcessing a typical case with 143 documents (~500KB total):
- Gemini 2.5 Flash: ~$0.40 per case
- Claude Sonnet 4 (if enabled): ~$3-5 per case for polishing
Total cost per case: $0.40 - $5.40 depending on configuration
- Document parsing and extraction
- Criteria mapping
- Exhibit management
- Letter generation
- REST API
- Case upload interface
- Processing dashboard
- Letter preview
- Export functionality
- Dark/light theme support
- Responsive design
- Manual exhibit reordering
- Letter section editing
- Template customization
- Multiple letter versions
- Physical exhibit assembly guidance
Issue: ImportError: cannot import name 'Document' from 'docling'
Solution: Install Docling: pip install docling==2.9.1
Issue: Tesseract not found for OCR Solution: Install Tesseract OCR:
- Windows: Download from GitHub releases
- macOS:
brew install tesseract - Linux:
sudo apt-get install tesseract-ocr
Issue: API returns 401 Unauthorized
Solution: Ensure you're passing the JWT token in Authorization header: Authorization: Bearer <token>
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
MIT License - See LICENSE file for details
For issues, questions, or feature requests, please open an issue on GitHub.