How mahanteshimath/bazaaraisaathi works
Project Type and Purpose
• This is a full-stack, AI-driven analytics web app built with Streamlit.
• Purpose: Provide investors with real-time stock data, AI-powered research, portfolio analysis, hypothesis testing, and personalized financial planning.
File Structure
• Top-level entry point: Home.py
• pages/ — Streamlit sub‐apps (UI routes) for each major feature: Architecture, Deep Research, Real-Time Data, Portfolio Analysis, etc.
• utils/ — Business logic modules (data fetch, analysis, OCR, AI integration)
• src/ — Static assets and data sources (CSV market data, book summaries, architecture image)
• config files: requirements.txt, .streamlit/config.toml
Key Architecture Insights from README
• Frontend: Streamlit UI with multiple “pages” modules.
• Backend logic: Python utils + LangChain, Perplexity AI, EasyOCR.
• Data: Local CSVs + external real-time APIs.
• Visualization: Plotly, Pandas.
Main Components
a. User Interface Layer
• Streamlit App (Home.py) & dynamic pages modules.
• UI controls (forms, charts, tables).
b. Application Logic Layer
• Page controllers (pages/*.py) orchestrate flows.
• Utility modules (utils/*.py) that implement:
– RealTime_stock_price_analysis.py → external stock API calls
– deep_research.py, get_market_insights.py → web scraping & AI calls
– finance_utils.py, portfolio_analysis.py → data processing & analytics
– fire_planner.py → financial independence logic
– tip_analysis.py → OCR (EasyOCR) + AI validation
c. Data Layer
• Local CSV data (src/BSE_Equity.csv, NSE_EQUITYS.csv, holdings.csv, Top50Books.csv)
• In-memory Pandas DataFrames
d. External Services
• Perplexity AI & LangChain for NLP/forecasting
• EasyOCR/Docling Parse for image/PDF text extraction
• Third-party stock price APIs
• (Optional) Streamlit Secrets for API keys
e. Visualization Layer
• Plotly for interactive charts
• Streamlit components for tables, forms
Relationships and Data Flows
• User interacts with Streamlit UI → triggers a page controller.
• Controller calls utils module(s) → fetches data from CSV or external API → processes data.
• For AI tasks: controller sends text/data to Perplexity AI via LangChain.
• Results returned → passed back to UI → rendered as charts/tables.
Highlighted Architectural Patterns
• Modular MVC-like separation:
• View = Streamlit pages
• Controller = pages/*.py orchestration
• Model = utils/*.py data and business logic
• Layered architecture: Presentation, Business Logic, Data Access, External Services
• Pluggable AI & data sources