# huythai855/quizvista architecture

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

- Interactive diagram: https://gitdiagram.com/huythai855/quizvista
- Repository: https://github.com/huythai855/quizvista

## Overview

##### Main Components Structure
The system should be represented with these key components:

a. Frontend Layer:
- Class Management Module
- Credential Module
- Study Module (including Chat, Flashcard, Practice, Study Notes)
- Test Management Module

b. Backend Layer:
- API Layer (Routes and Schemas)
- Core Layer (Business Logic)
- Infrastructure Layer (Database)

c. AI Services Layer:
- Chatbot Function Calling
- Question Extraction
- Quiz Generation
- And Mindmap Generation
- RAG (Retrieval-Augmented Generation)

##### Data Flow and Interactions

- Frontend → Backend API communication
- Backend Core → Infrastructure data access
- Backend → AI Services integration
- Database interactions with all components

##### Special Features Integration

Create dedicated sections for:
- Input Processing Pipeline:
- Document Processing (PDF, DOCX, URL, YouTube)
- Image Processing
- Text Extraction
- Quiz Generation Pipeline:
- Multiple Question Types (MCQ, Boolean, Fill-in-blanks, etc.)
- RAG System with Vector Store
- AI Mentor System:
- Chat Interface
- Learning Analytics

##### Database Schema

A simplified database schema showing:
- Users
- Classes
- Tests
- Test Results
- Class Memberships

##### External Services

Connections to:
- File Storage
- AI Models
- Vector Stores

##### Technical Details

Annotations for:
- Python-based implementation
- SQLAlchemy ORM
- FastAPI framework
- AI model integration points

##### Architecture Patterns

Following patterns:
- Clean Architecture (with adapter, core, and infrastructure layers)
- Service-oriented design
- RESTful API structure
- AI pipeline integration

Remember to include the four pipelines shown in the README:

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#e1f5fe,stroke:#01579b
    classDef backend fill:#e8f5e9,stroke:#1b5e20
    classDef ai fill:#f3e5f5,stroke:#4a148c
    classDef database fill:#fff3e0,stroke:#e65100
    classDef pipeline fill:#fce4ec,stroke:#880e4f

    %% Frontend Layer
    subgraph Frontend
        CM["Class Management"]
        CRED["Credential Module"]
        SM["Study Module"]
        TM["Test Management"]
    end
    class CM,CRED,SM,TM frontend

    %% Backend Layer
    subgraph Backend
        subgraph API
            ClassAPI["Class API"]
            CredAPI["Credential API"]
            TestAPI["Test API"]
            MentorAPI["Mentor API"]
        end
        
        subgraph Core
            ClassCore["Class Core"]
            CredCore["Credential Core"]
            TestCore["Test Core"]
            MentorCore["Mentor Core"]
        end
        
        subgraph Infrastructure
            DB[(Database)]
            DBModels["Database Models"]
            DBConn["Database Connection"]
        end
    end
    class ClassAPI,CredAPI,TestAPI,MentorAPI backend
    class ClassCore,CredCore,TestCore,MentorCore backend
    class DB,DBModels,DBConn database

    %% AI Services Layer
    subgraph AIServices
        ChatBot["Chatbot Function Calling"]
        QE["Question Extraction"]
        QG["Quiz Generation"]
        NMG["Note and Mindmap Generation"]
        RAG["RAG System"]
    end
    class ChatBot,QE,QG,NMG,RAG ai

    %% Data Processing Pipeline
    subgraph DataProcessing
        DocProc["Document Processing"]
        PDFProc["PDF Processing"]
        URLProc["URL Processing"]
        YTProc["YouTube Processing"]
        ImgProc["Image Processing"]
    end
    class DocProc,PDFProc,URLProc,YTProc,ImgProc pipeline

    %% Database Schema
    subgraph Schema
        Users["Users"]
        Classes["Classes"]
        Tests["Tests"]
        ClassMem["Class Memberships"]
        TestRes["Test Results"]
    end
    class Users,Classes,Tests,ClassMem,TestRes database

    %% Relationships
    Frontend --> API
    API --> Core
    Core --> Infrastructure
    Core --> AIServices
    AIServices --> DataProcessing
    Infrastructure --> Schema

    %% Click Events
    click CM "https://github.com/huythai855/QuizVista/tree/master/frontend/class/"
    click CRED "https://github.com/huythai855/QuizVista/tree/master/frontend/credential/"
    click SM "https://github.com/huythai855/QuizVista/tree/master/frontend/study/"
    click TM "https://github.com/huythai855/QuizVista/tree/master/frontend/test/"
    click ClassAPI "https://github.com/huythai855/QuizVista/tree/master/server/backend_service/api/classes/"
    click CredAPI "https://github.com/huythai855/QuizVista/tree/master/server/backend_service/api/credentials/"
    click TestAPI "https://github.com/huythai855/QuizVista/tree/master/server/backend_service/api/tests/"
    click MentorAPI "https://github.com/huythai855/QuizVista/tree/master/server/backend_service/api/mentors/"
    click ClassCore "https://github.com/huythai855/QuizVista/tree/master/server/backend_service/core/classes/"
    click CredCore "https://github.com/huythai855/QuizVista/tree/master/server/backend_service/core/credentials/"
    click TestCore "https://github.com/huythai855/QuizVista/tree/master/server/backend_service/core/tests/"
    click MentorCore "https://github.com/huythai855/QuizVista/tree/master/server/backend_service/core/mentors/"
    click DBModels "https://github.com/huythai855/QuizVista/tree/master/server/backend_service/infra/database/models/"
    click DBConn "https://github.com/huythai855/QuizVista/blob/master/server/backend_service/infra/database/sqlalchemy.py"
    click ChatBot "https://github.com/huythai855/QuizVista/tree/master/server/chatbot_function_calling/"
    click QE "https://github.com/huythai855/QuizVista/tree/master/server/question_extraction/"
    click QG "https://github.com/huythai855/QuizVista/tree/master/server/quizgen/"
    click NMG "https://github.com/huythai855/QuizVista/tree/master/server/note_and_mindmap/"
    click RAG "https://github.com/huythai855/QuizVista/tree/master/server/rag/"
    click DocProc "https://github.com/huythai855/QuizVista/tree/master/server/preprocess_data/docx_to_text/"
    click PDFProc "https://github.com/huythai855/QuizVista/tree/master/server/preprocess_data/pdf_to_text/"
    click URLProc "https://github.com/huythai855/QuizVista/tree/master/server/preprocess_data/url_to_text/"
    click YTProc "https://github.com/huythai855/QuizVista/tree/master/server/preprocess_data/youtube_trans_to_text/"
    click ImgProc "https://github.com/huythai855/QuizVista/tree/master/server/preprocess_data/keyword_to_demonstrating_image/"
    click Users "https://github.com/huythai855/QuizVista/blob/master/server/backend_service/infra/database/models/users.py"
    click Classes "https://github.com/huythai855/QuizVista/blob/master/server/backend_service/infra/database/models/classes.py"
    click Tests "https://github.com/huythai855/QuizVista/blob/master/server/backend_service/infra/database/models/tests.py"
    click ClassMem "https://github.com/huythai855/QuizVista/blob/master/server/backend_service/infra/database/models/class_join.py"
    click TestRes "https://github.com/huythai855/QuizVista/blob/master/server/backend_service/infra/database/models/test_taken.py"
```
