# ayushvishnoipro/studyhub architecture

> Architecture diagram of the GitHub repository ayushvishnoipro/studyhub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ayushvishnoipro/studyhub
- Repository: https://github.com/ayushvishnoipro/studyhub

## Overview

##### Project type and purpose
- It provides five core learning tools: MCQ generation, PDF querying, YouTube transcript notes, contest calendar, and ATS resume optimization—each implemented as a menu “page” in Streamlit.

##### File structure
Top-level:
- app.py – Streamlit entry point hosting the navigation menu and routing to feature modules.
- requirements.txt & .gitignore – build and deploy configuration.
- data.txt, faiss_index.bin, faiss_store.pkl – raw data artifacts and persistent FAISS index for document search.
- Response.json – sample API response or debugging artifact.
- logs/ – timestamped log files capturing runtime events.
- images/ – static assets (e.g., logos, flowcharts).
- menu/ – Streamlit pages, one .py file per feature:
– ATS.py, Ask_To_PDF.py, Contest_Calendar.py, NotesMaker.py, mcqgen.py
- src/ – core business logic and utilities:
– mcqgenerator/ – MCQGenerator.py, logger.py, utils.py
– JSON config files (ATS.json, contest.json, etc.)
– style.css – custom styling for Streamlit

##### Extract insights from the README
- Backend uses LangChain and Google Gemini Pro, plus OpenAI GPT for content generation.
- External libraries: PyPDF2, YouTubeTranscriptApi, Pandas, dotenv.
- Frontend is purely Streamlit, no separate React/Vue code.

##### Main components
a. User Interface Layer (Streamlit)
- app.py (router)
- menu/*.py (feature modules)
- style.css (custom UI styling)
b. Application/Business Logic Layer
- src/mcqgenerator (MCQ generation logic, logging, utilities)
- src/utils (PDF processing, transcript parsing, contest fetching)
- ATS analyzer logic (inside menu/ATS.py & config src/ATS.json)
c. Data Storage Layer
- Local files: data.txt, JSON config files
- FAISS index (faiss_index.bin, faiss_store.pkl) for document embedding store
- logs/ for audit and debugging
d. External Services & APIs
- Google Gemini Pro & OpenAI GPT endpoints (for AI generation)
- YouTubeTranscriptApi (for video transcripts)
- Competitive programming sites APIs (for contest calendar)
- PDF processing library (PyPDF2)
e. Environment & Configuration
- .env file (API keys)
- requirements.txt (dependencies)

##### Relationships and interactions
1. User → Streamlit UI (app.py) selects a feature
2. Streamlit menu module calls into src business-logic functions
3. Business logic may:
– Read JSON configs or data.txt
– Call external APIs (AI models, YouTubeTranscriptApi)
– Update or query FAISS index (for “Ask to PDF”)
– Fetch contest data from web APIs
4. Responses flow back up: logic → menu module → UI
5. All operations are logged to logs/
6. Persisted artifacts (faiss_index.bin, faiss_store.pkl) store intermediate vector data

##### Architectural patterns & design principles
- Modular separation: one page/module per feature
- Layered architecture: UI → Application Logic → Data/Storage
- Single process monolith but clearly demarcated components
- External integration via adapter functions in src/utils
- Configuration-driven (JSON) and environment variables for secrets

##### Essential elements
- Component labels (UI, logic modules, data stores, external services)
- Annotations for key technologies (LangChain, Gemini Pro, PyPDF2, etc.)
- Clear grouping of “menu” vs. “src” vs. “data” vs. “external”

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Layer
    User["User"]:::external

    %% Streamlit UI Layer
    subgraph "Streamlit UI"
        UI_app["Streamlit app.py"]:::ui
        style_css["style.css"]:::ui
        mcq_page["MCQ Generation (menu/mcqgen.py)"]:::ui
        pdf_page["PDF Query (menu/Ask_To_PDF.py)"]:::ui
        notes_page["YouTube Notes (menu/NotesMaker.py)"]:::ui
        contest_page["Contest Calendar (menu/Contest_Calendar.py)"]:::ui
        ats_page["ATS Resume (menu/ATS.py)"]:::ui
    end

    %% Application Logic Layer
    subgraph "Application Logic"
        mcq_logic["MCQGenerator.py"]:::logic
        mcq_utils["utils.py"]:::logic
        mcq_logger["logger.py"]:::logic
        utils["src/utils (PDF, Transcript, Contest)"]:::logic
    end

    %% Data Storage Layer
    subgraph "Data Storage"
        data_txt["data.txt"]:::data
        resp["Response.json"]:::data
        req["requirements.txt"]:::data
        config_ATS["ATS.json"]:::data
        config_contest["contest.json"]:::data
        config_home["Home_student.json"]:::data
        config_robot["Robot.json"]:::data
        faiss_bin["faiss_index.bin"]:::data
        faiss_store["faiss_store.pkl"]:::data
        logs["logs/"]:::data
    end

    %% External Services
    subgraph "External Services"
        gpt["OpenAI GPT"]:::external
        gemini["Google Gemini Pro"]:::external
        yt["YouTubeTranscriptApi"]:::external
        cp["Competitive Programming APIs"]:::external
        pdf_lib["PyPDF2"]:::external
    end

    %% Connections
    User -->|"interacts with"| UI_app
    UI_app --> mcq_page
    UI_app --> pdf_page
    UI_app --> notes_page
    UI_app --> contest_page
    UI_app --> ats_page

    mcq_page -->|"triggers"| mcq_logic
    mcq_logic --> mcq_utils
    mcq_logic --> mcq_logger
    mcq_logic --> gpt
    mcq_logic --> gemini
    mcq_logic --> logs
    mcq_logic --> mcq_page

    pdf_page -->|"requests PDF process"| utils
    utils --> pdf_lib
    utils --> faiss_bin
    utils --> faiss_store
    utils --> data_txt
    utils --> logs
    utils --> pdf_page

    notes_page -->|"requests transcript"| utils
    utils --> yt
    utils --> logs
    utils --> notes_page

    contest_page -->|"fetches contests"| utils
    utils --> cp
    contest_page --> config_contest
    utils --> logs
    utils --> contest_page

    ats_page -->|"requests ATS analysis"| utils
    ats_page --> config_ATS
    utils --> logs
    utils --> ats_page

    %% Click Events
    click UI_app "https://github.com/ayushvishnoipro/studyhub/blob/main/app.py"
    click mcq_page "https://github.com/ayushvishnoipro/studyhub/blob/main/menu/mcqgen.py"
    click pdf_page "https://github.com/ayushvishnoipro/studyhub/blob/main/menu/Ask_To_PDF.py"
    click notes_page "https://github.com/ayushvishnoipro/studyhub/blob/main/menu/NotesMaker.py"
    click contest_page "https://github.com/ayushvishnoipro/studyhub/blob/main/menu/Contest_Calendar.py"
    click ats_page "https://github.com/ayushvishnoipro/studyhub/blob/main/menu/ATS.py"
    click style_css "https://github.com/ayushvishnoipro/studyhub/blob/main/src/style.css"
    click mcq_logic "https://github.com/ayushvishnoipro/studyhub/blob/main/src/mcqgenerator/MCQGenerator.py"
    click mcq_utils "https://github.com/ayushvishnoipro/studyhub/blob/main/src/mcqgenerator/utils.py"
    click mcq_logger "https://github.com/ayushvishnoipro/studyhub/blob/main/src/mcqgenerator/logger.py"
    click config_ATS "https://github.com/ayushvishnoipro/studyhub/blob/main/src/ATS.json"
    click config_contest "https://github.com/ayushvishnoipro/studyhub/blob/main/src/contest.json"
    click config_home "https://github.com/ayushvishnoipro/studyhub/blob/main/src/Home_student.json"
    click config_robot "https://github.com/ayushvishnoipro/studyhub/blob/main/src/Robot.json"
    click data_txt "https://github.com/ayushvishnoipro/studyhub/blob/main/data.txt"
    click faiss_bin "https://github.com/ayushvishnoipro/studyhub/blob/main/faiss_index.bin"
    click faiss_store "https://github.com/ayushvishnoipro/studyhub/blob/main/faiss_store.pkl"
    click logs "https://github.com/ayushvishnoipro/studyhub/tree/main/logs/"
    click req "https://github.com/ayushvishnoipro/studyhub/blob/main/requirements.txt"
    click resp "https://github.com/ayushvishnoipro/studyhub/blob/main/Response.json"

    %% Styles
    classDef ui fill:#D6EAF8,stroke:#2980B9,stroke-width:1px
    classDef logic fill:#FCF3CF,stroke:#F1C40F,stroke-width:1px
    classDef data fill:#D5F5E3,stroke:#27AE60,stroke-width:1px
    classDef external fill:#FDEBD0,stroke:#E67E22,stroke-width:1px
```
