# davizzz-bot/estilodeaprendizaje architecture

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

- Interactive diagram: https://gitdiagram.com/davizzz-bot/estilodeaprendizaje
- Repository: https://github.com/davizzz-bot/estilodeaprendizaje

## Overview

##### Project Type and Purpose
- This is a full-stack, modular Django web application (“Detector de Estilos de Aprendizaje”) whose goal is to evaluate students’ learning styles via an interactive test and deliver AI-driven recommendations to both students and teachers.
- Key functional domains are: user authentication/dashboards, student profile management, teacher management, group management, activity management, and an AI/ML API for recommendation generation.

##### File Structure
- **Top-level**
- manage.py, requirements.txt, .gitignore
- Detector_Proyecto (Django project config: settings, URLs, ASGI/WSGI)
- **Apps**
- auth_app – handles login/logout and main dashboards
- Academico.* – a suite of six apps named Estudiantes, Docentes, Grupos, Actividades, Estudiantes_en_Grupos (M2M), each with models, views, forms, templates, static assets, migrations
- llm_api – interfaces with Google Gemini AI, processes PDF docs, uses embeddings and ML libraries
- **Static & Templates**
- Each app contains its own /static/css, /static/js (llm_api stores PDF docs) and /templates for UI views
- **Configuration**
- Detector_Proyecto/settings split into base/development/production
- .env variables for SECRET_KEY, database, Google API key
- requirements.txt lists Django REST Framework, google-generativeai, sentence-transformers, scikit-learn, psycopg2

##### README for Additional Insights
- System uses PostgreSQL as primary data store
- AI layer comprised of Google Generative AI API + local ML pipelines (embedding + cosine similarity) + PDF processing via PDF Plumber
- Core user roles: Student, Teacher, Admin
- Workflow: test → store encrypted results → generate visual analysis + IA recommendations

##### Diagramming the Architecture
a. Main Components
1. Client Browsers (Students, Teachers, Admins)
2. Frontend (HTML/CSS/JS served by Django templates; optional REST endpoints via DRF)
3. Django Backend
– URL Router → Views → Forms/Serializers
– Apps: auth_app, Academico.*, llm_api
4. PostgreSQL Database (models from all apps)
5. External Services:
– Google Gemini AI API
6. ML Pipeline (in llm_api):
– PDF Plumber extractor → Sentence Transformer embeddings → Scikit-learn similarity → Recommendation engine
b. Relationships & Data Flows
- User submits test → auth_app view → form validation → model.save() → DB
- On viewing dashboard → view queries DB → context → template → chart JS
- Teacher requests group analysis → view in Academico.Grupos → aggregated DB query → visual report
- Recommendation request → llm_api view → (a) fetch PDF docs → extract text → compute embeddings → call Google API for context → combine results → return JSON → frontend renders suggestions
c. Architectural Patterns & Principles
- Modular Django apps (separation of concerns)
- MVC (Django-ish MTV) pattern
- Layered AI pipeline separated into llm_api
- Environment-based configuration
- Secure data handling (encrypted fields, Django hashers, CSRF)
d. Key Technologies & Frameworks
- Django 5.1.3 (+ Django REST Framework)
- PostgreSQL
- Google Generative AI (via google-generativeai)
- Sentence Transformers & Scikit-learn
- PDF Plumber
- HTML5/CSS3/JS (Bootstrap implicitly in templates)

##### Detailed Elements to Capture
- Static assets served by Django’s staticfiles vs. templates rendering
- ML subcomponents: PDF ingestion, embeddings, similarity search, Google AI calls
- Roles & permissions: Student vs. Teacher dashboards controlled by auth_app
- Environment variables loaded via django-environ
- Deployment aspects (e.g., Gunicorn/WSGI, optional Docker, if in scope)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    Browser["Client Browsers<br/>(Students, Teachers, Admins)"]:::frontend
    Presentation["Django Templates & Static Files"]:::frontend

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        AuthApp["auth_app"]:::backend
        Students["Academico.Estudiantes"]:::backend
        Teachers["Academico.Docentes"]:::backend
        Groups["Academico.Grupos"]:::backend
        EstGroup["Academico.Estudiantes_en_Grupos"]:::backend
        Activities["Academico.Actividades"]:::backend
        LLMApp["llm_api"]:::ai
        Settings["Detector_Proyecto Config"]:::backend
        Manage["manage.py & requirements.txt"]:::backend
    end

    %% Database
    DB["PostgreSQL Database"]:::database

    %% AI Services Layer
    subgraph "AI Services Layer"
        direction TB
        PDF["PDF Plumber Extractor"]:::ai
        Embedding["Sentence-Transformers Embeddings"]:::ai
        Similarity["Scikit-learn Similarity"]:::ai
        RecoEngine["Recommendation Engine"]:::ai
        External["Google Gemini AI API"]:::external
    end

    %% Data Flows
    Browser -->|HTTPS Request| Presentation
    Presentation -->|Django Request| AuthApp
    Presentation -->|Django Request| Students
    Presentation -->|Django Request| Teachers
    Presentation -->|Django Request| Groups
    Presentation -->|Django Request| EstGroup
    Presentation -->|Django Request| Activities
    Presentation -->|AJAX/JSON| LLMApp

    AuthApp -->|SQL Queries| DB
    Students -->|SQL Queries| DB
    Teachers -->|SQL Queries| DB
    Groups -->|SQL Queries| DB
    EstGroup -->|SQL Queries| DB
    Activities -->|SQL Queries| DB

    LLMApp -->|Fetch PDFs| PDF
    PDF --> Embedding
    Embedding --> Similarity
    Similarity --> RecoEngine
    RecoEngine -->|Return Recommendations| LLMApp
    LLMApp -->|Call API| External
    LLMApp -->|Store Analysis| DB
    LLMApp -->|JSON Response| Presentation

    Settings --> AuthApp
    Settings --> Students
    Settings --> Teachers
    Settings --> Groups
    Settings --> EstGroup
    Settings --> Activities
    Settings --> LLMApp

    Manage --> Settings

    %% Click Events
    click AuthApp "https://github.com/davizzz-bot/estilodeaprendizaje/tree/main/auth_app/"
    click Students "https://github.com/davizzz-bot/estilodeaprendizaje/tree/main/Academico/Estudiantes/"
    click Teachers "https://github.com/davizzz-bot/estilodeaprendizaje/tree/main/Academico/Docentes/"
    click Groups "https://github.com/davizzz-bot/estilodeaprendizaje/tree/main/Academico/Grupos/"
    click EstGroup "https://github.com/davizzz-bot/estilodeaprendizaje/tree/main/Academico/Estudiantes_en_Grupos/"
    click Activities "https://github.com/davizzz-bot/estilodeaprendizaje/tree/main/Academico/Actividades/"
    click LLMApp "https://github.com/davizzz-bot/estilodeaprendizaje/tree/main/llm_api/"
    click Settings "https://github.com/davizzz-bot/estilodeaprendizaje/tree/main/Detector_Proyecto/"
    click Manage "https://github.com/davizzz-bot/estilodeaprendizaje/blob/main/manage.py"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef database fill:#FFA500,stroke:#333,stroke-width:1px
    classDef ai fill:#D8BFD8,stroke:#333,stroke-width:1px
    classDef external fill:#EEE8AA,stroke:#333,stroke-width:1px
```
