# pranay898/ai_automated_question_bulider- architecture

> Architecture diagram of the GitHub repository pranay898/ai_automated_question_bulider-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pranay898/ai_automated_question_bulider-
- Repository: https://github.com/pranay898/ai_automated_question_bulider-

## Overview

AI Question Builder is a Streamlit application for administrators, trainers, and employees. Users register or log in, then the app routes them to role-specific dashboards. Trainers upload curriculum and generate, edit, or download question banks; employees use learning materials, self-assessments, and submit requests or issues. Administrators manage users and review system activity and reports. Firebase/Firestore provides shared persistence, while Gemini powers question generation. Some dashboard features are only partially excerpted, so their internal steps are represented at subsystem level.

Main entry points: [`db.py`](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/db.py) (Firestore collections), [`app.py`](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/app.py) (Streamlit entry), [`trainer_dashboard.py`](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/trainer_dashboard.py) (Trainer dashboard), [`employee_dashboard.py`](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py) (Employee dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application and access"]
  node_app["Streamlit entry<br/>[app.py]"]
  node_auth["Authentication<br/>[auth.py]"]
end

subgraph group_learning["Question bank workflow"]
  node_trainer["Trainer dashboard"]
  node_curriculum["Curriculum upload"]
  node_bankgen["Question bank generation<br/>[ques_bank_gen.py]"]
  node_review["Question review"]
  node_bankdownload["Bank downloads"]
end

subgraph group_employee["Employee learning"]
  node_employee["Employee dashboard"]
  node_assessment["Self-assessment"]
  node_learningmaterials["Learning materials"]
  node_learningrequest["Learning requests"]
  node_issues["Issue reporting"]
  node_certificate["Certificate output"]
end

subgraph group_admin["Administration"]
  node_admin["Admin dashboard<br/>[admin_functions.py]"]
  node_useradmin["User administration<br/>[admin_functions.py]"]
  node_reports["Monitoring and reports<br/>[admin_functions.py]"]
  node_feedbackissues["Feedback and issue review<br/>[admin_functions.py]"]
end

subgraph group_platform["Shared services"]
  node_questiongen["Question generation<br/>[utils.py]"]
  node_firestore[("Firestore collections<br/>[db.py]")]
end

node_user(("User"))
node_gemini{{"Gemini service"}}
node_smtp{{"Email service"}}

node_user -->|"uses"| node_app
node_app -->|"authenticates"| node_auth
node_app -->|"routes admin"| node_admin
node_app -->|"routes trainer"| node_trainer
node_app -->|"routes employee"| node_employee
node_app -->|"reads users"| node_firestore
node_auth -->|"reads and writes"| node_firestore
node_auth -->|"sends OTP"| node_smtp
node_trainer -->|"offers upload"| node_curriculum
node_trainer -->|"dispatches generation"| node_bankgen
node_trainer -->|"provides editing"| node_review
node_trainer -->|"provides downloads"| node_bankdownload
node_curriculum -->|"stores curriculum"| node_firestore
node_bankgen -->|"reads and saves banks"| node_firestore
node_bankgen -->|"requests generation"| node_questiongen
node_questiongen -->|"invokes model"| node_gemini
node_review -->|"updates banks"| node_firestore
node_bankdownload -->|"reads banks"| node_firestore
node_employee -->|"offers assessment"| node_assessment
node_employee -->|"offers materials"| node_learningmaterials
node_employee -->|"accepts requests"| node_learningrequest
node_employee -->|"accepts reports"| node_issues
node_assessment -->|"reads question banks"| node_firestore
node_assessment -->|"creates certificate"| node_certificate
node_learningmaterials -->|"reads question banks"| node_firestore
node_learningrequest -->|"stores request"| node_firestore
node_issues -->|"stores issue"| node_firestore
node_admin -->|"provides user management"| node_useradmin
node_admin -->|"provides reporting"| node_reports
node_admin -->|"provides review"| node_feedbackissues
node_useradmin -->|"updates users"| node_firestore
node_reports -->|"queries metrics"| node_firestore
node_feedbackissues -->|"queries records"| node_firestore

click node_app "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/app.py"
click node_auth "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/auth.py"
click node_trainer "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/trainer_dashboard.py"
click node_curriculum "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/trainer_dashboard.py"
click node_bankgen "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/ques_bank_gen.py"
click node_questiongen "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/utils.py"
click node_review "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/trainer_dashboard.py"
click node_bankdownload "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/trainer_dashboard.py"
click node_employee "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py"
click node_assessment "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py"
click node_learningmaterials "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py"
click node_learningrequest "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py"
click node_issues "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py"
click node_certificate "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py"
click node_admin "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/admin_functions.py"
click node_useradmin "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/admin_functions.py"
click node_reports "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/admin_functions.py"
click node_feedbackissues "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/admin_functions.py"
click node_firestore "https://github.com/pranay898/ai_automated_question_bulider-/blob/main/db.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_auth,node_user toneBlue
class node_trainer,node_curriculum,node_bankgen,node_review,node_bankdownload toneAmber
class node_employee,node_assessment,node_learningmaterials,node_learningrequest,node_issues,node_certificate toneMint
class node_admin,node_useradmin,node_reports,node_feedbackissues toneRose
class node_questiongen,node_firestore,node_gemini,node_smtp toneIndigo
```

## Components

### Application and access

- [Streamlit entry](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/app.py): `app.py`
- [Authentication](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/auth.py): `auth.py`

### Question bank workflow

- [Trainer dashboard](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/trainer_dashboard.py): `trainer_dashboard.py`
- [Curriculum upload](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/trainer_dashboard.py): `trainer_dashboard.py`
- [Question bank generation](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/ques_bank_gen.py): `ques_bank_gen.py`
- [Question review](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/trainer_dashboard.py): `trainer_dashboard.py`
- [Bank downloads](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/trainer_dashboard.py): `trainer_dashboard.py`

### Employee learning

- [Employee dashboard](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py): `employee_dashboard.py`
- [Self-assessment](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py): `employee_dashboard.py`
- [Learning materials](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py): `employee_dashboard.py`
- [Learning requests](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py): `employee_dashboard.py`
- [Issue reporting](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py): `employee_dashboard.py`
- [Certificate output](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/employee_dashboard.py): `employee_dashboard.py`

### Administration

- [Admin dashboard](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/admin_functions.py): `admin_functions.py`
- [User administration](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/admin_functions.py): `admin_functions.py`
- [Monitoring and reports](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/admin_functions.py): `admin_functions.py`
- [Feedback and issue review](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/admin_functions.py): `admin_functions.py`

### Shared services

- [Question generation](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/utils.py): `utils.py`
- [Firestore collections](https://github.com/pranay898/ai_automated_question_bulider-/blob/main/db.py): `db.py`

### Other components

- **User**
- **Gemini service**
- **Email service**

## Connections

- User → Streamlit entry: uses
- Streamlit entry → Authentication: authenticates (evidence: `app.py`)
- Streamlit entry → Admin dashboard: routes admin (evidence: `app.py`)
- Streamlit entry → Trainer dashboard: routes trainer (evidence: `app.py`)
- Streamlit entry → Employee dashboard: routes employee (evidence: `app.py`)
- Streamlit entry → Firestore collections: reads users (evidence: `app.py`)
- Authentication → Firestore collections: reads and writes (evidence: `auth.py`)
- Authentication → Email service: sends OTP (evidence: `auth.py`)
- Trainer dashboard → Curriculum upload: offers upload (evidence: `trainer_dashboard.py`)
- Trainer dashboard → Question bank generation: dispatches generation (evidence: `trainer_dashboard.py`)
- Trainer dashboard → Question review: provides editing (evidence: `trainer_dashboard.py`)
- Trainer dashboard → Bank downloads: provides downloads (evidence: `trainer_dashboard.py`)
- Curriculum upload → Firestore collections: stores curriculum (evidence: `trainer_dashboard.py`)
- Question bank generation → Firestore collections: reads and saves banks (evidence: `ques_bank_gen.py`)
- Question bank generation → Question generation: requests generation (evidence: `ques_bank_gen.py`)
- Question generation → Gemini service: invokes model (evidence: `utils.py`)
- Question review → Firestore collections: updates banks (evidence: `trainer_dashboard.py`)
- Bank downloads → Firestore collections: reads banks (evidence: `trainer_dashboard.py`)
- Employee dashboard → Self-assessment: offers assessment (evidence: `employee_dashboard.py`)
- Employee dashboard → Learning materials: offers materials (evidence: `employee_dashboard.py`)
- Employee dashboard → Learning requests: accepts requests (evidence: `employee_dashboard.py`)
- Employee dashboard → Issue reporting: accepts reports (evidence: `employee_dashboard.py`)
- Self-assessment → Firestore collections: reads question banks (evidence: `employee_dashboard.py`)
- Self-assessment → Certificate output: creates certificate (evidence: `employee_dashboard.py`)
- Learning materials → Firestore collections: reads question banks (evidence: `employee_dashboard.py`)
- Learning requests → Firestore collections: stores request (evidence: `employee_dashboard.py`)
- Issue reporting → Firestore collections: stores issue (evidence: `employee_dashboard.py`)
- Admin dashboard → User administration: provides user management (evidence: `admin_functions.py`)
- Admin dashboard → Monitoring and reports: provides reporting (evidence: `admin_functions.py`)
- Admin dashboard → Feedback and issue review: provides review (evidence: `admin_functions.py`)
- User administration → Firestore collections: updates users (evidence: `admin_functions.py`)
- Monitoring and reports → Firestore collections: queries metrics (evidence: `admin_functions.py`)
- Feedback and issue review → Firestore collections: queries records (evidence: `admin_functions.py`)
