-
An intelligent Retrieval-Augmented Generation (RAG) system that enables natural language querying of SEC 10-K filings for comprehensive financial document analysis. Built with Flask backend and powered by Google Gemini AI, this application transforms complex financial documents into accessible insights through an intuitive web interface.
-
The system processes SEC filings from 10 well-known companies across selected industries, creating a searchable knowledge base that allows users to ask questions and receive accurate, contextual answers backed by official financial disclosures.
-
Multi-Company Coverage: Analyzes SEC 10-K filings from 10 major companies in chosen industries
-
Document Upload & Processing: Seamless PDF upload functionality for additional financial documents
-
Real-time Q&A Interface: Interactive chatbot for natural language queries about financial data
-
Cross-Company Comparisons: Compare financial metrics and disclosures across multiple organizations
-
Google Gemini AI Integration: Leverages cutting-edge language models for accurate financial analysis
-
Contextual Responses: Provides detailed answers with source citations from specific SEC filings
-
Risk Assessment: Identifies and explains risk factors mentioned in company filings
-
Financial Trend Analysis: Extracts insights about company performance and future outlook
-
Flask-Powered Backend: Robust server architecture for reliable document processing
-
Responsive Frontend: Clean, user-friendly interface with dashboard, upload, and analytics pages
-
Interactive Dashboard: Visual representation of key financial metrics and insights
-
Document Management: Organized storage and retrieval of processed SEC filings
-
RAG Architecture: Retrieval-Augmented Generation for accurate, source-backed responses
-
Vector Database Integration: Efficient document embedding and similarity search capabilities
-
Smart Text Extraction: Processes complex SEC filing structures and formats
-
Multi-format Support: Handles various document types including HTML, XBRL, and PDF formats
-
Flask: Web framework for API and routing
-
Google Gemini AI: Advanced language model for document analysis
-
LangChain: RAG framework for document processing and retrieval
-
Vector Database: Document embedding storage and retrieval
-
BeautifulSoup: HTML/XBRL parsing for SEC filings
-
HTML/CSS/JavaScript: Responsive web interface
-
Bootstrap: Modern UI components and styling
-
Chart.js: Data visualization for financial metrics
-
AJAX: Dynamic content loading and user interactions
-
EDGAR API: SEC filings data acquisition
-
PDF Processing: Document text extraction and parsing
-
Natural Language Processing: Text preprocessing and analysis
-
Document Chunking: Intelligent text splitting for optimal retrieval
sec-filings-rag/
├── app.py # Flask application entry point
├── templates/
│ ├── dashboard.html # Main dashboard interface
│ ├── upload.html # Document upload page
│ ├── analytics.html # Analytics and insights page
│ └── base.html # Base template with navigation
├── static/
│ ├── css/ # Stylesheets
│ ├── js/ # JavaScript functionality
│ └── uploads/ # Uploaded document storage
├── src/
│ ├── document_processor.py # SEC filing processing logic
│ ├── rag_engine.py # RAG implementation with Gemini AI
│ ├── vector_store.py # Vector database operations
│ └── api_handlers.py # External API integrations
├── data/
│ ├── processed/ # Processed SEC filings
│ └── embeddings/ # Document vector embeddings
├── config/
│ └── settings.py # Configuration and API keys
├── requirements.txt # Python dependencies
└── README.md- Python 3.8+
- Google Gemini AI API key
- EDGAR API access (optional for additional filings)
- Clone the repository
git clone https://github.com/yourusername/sec-filings-rag.git
cd sec-filings-rag- Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Configure API keys
# Create .env file
echo "GOOGLE_API_KEY=your_gemini_api_key" > .env
echo "FLASK_SECRET_KEY=your_secret_key" >> .envFlask>=2.3.0
google-generativeai>=0.3.0
langchain>=0.1.0
langchain-community>=0.0.10
beautifulsoup4>=4.12.0
requests>=2.31.0
pandas>=1.5.0
numpy>=1.24.0
faiss-cpu>=1.7.0
python-dotenv>=1.0.0- Start the Flask server
python app.py- Access the web interface
- Open browser to http://localhost:5000
- Navigate through dashboard, upload, and analytics pages
-
Document Upload
-
Use the upload page to add new SEC filings or financial documents
-
Supported formats: PDF, HTML, TXT
- Example queries:
-
"What are the main risk factors for Apple's business?"
-
"Compare revenue growth between Microsoft and Google"
-
"What regulatory challenges does Tesla face?"
-
View processed document summaries
-
Explore key financial metrics across companies
-
Access comparative analysis tools
- Financial Performance
-
"What was the revenue growth rate for [Company] in the last fiscal year?"
-
"Analyze the profitability trends mentioned in recent filings"
-
"Compare operating margins between technology companies"
- Risk Analysis
-
"What are the primary business risks identified by [Company]?"
-
"How do companies address cybersecurity concerns in their filings?"
-
"What regulatory risks affect the pharmaceutical industry?"
- Strategic Insights
-
"What expansion plans are mentioned in recent SEC filings?"
-
"How do companies describe their competitive advantages?"
-
"What R&D investments are highlighted in 10-K reports?"
-
Document Ingestion: SEC filings processed and chunked for optimal retrieval
-
Vector Embedding: Text converted to embeddings using advanced models
-
Query Processing: User questions analyzed and matched with relevant document sections
-
Response Generation: Google Gemini AI generates contextual answers with source citations
SEC Filings → Document Processing → Vector Embeddings → Vector Store
↓
User Query → Query Processing → Similarity Search → Context Retrieval
↓
Context + Query → Google Gemini AI → Generated Response → User Interface-
API Key Protection: Secure environment variable management
-
Data Privacy: Local document processing with no external data sharing
-
SEC Compliance: Proper attribution and citation of official filings
-
Rate Limiting: API usage optimization and throttling
-
Real-time Filing Updates: Automatic processing of new SEC submissions
-
Advanced Analytics: Machine learning insights and trend predictions
-
Multi-language Support: International filing analysis capabilities
-
API Development: RESTful API for third-party integrations
-
Mobile Application: Responsive mobile interface for on-the-go analysis
- Fork the repository
Create a feature branch (git checkout -b feature/financial-analysis)
Commit changes (git commit -m 'Add financial analysis feature')
Push to branch (git push origin feature/financial-analysis)
Open a Pull Request- This project is licensed under the MIT License - see the LICENSE file for details.
-
SEC EDGAR Database: Official source for SEC filings and financial disclosures
-
Google Gemini AI: Advanced language model powering the RAG system
-
LangChain Community: Framework and tools for RAG implementation
-
Flask Community: Web framework enabling seamless deployment
- Project Link: https://github.com/yourusername/sec-filings-rag
Transforming financial document analysis through AI-powered insights