# daniiizita/disc_assessment architecture

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

- Interactive diagram: https://gitdiagram.com/daniiizita/disc_assessment
- Repository: https://github.com/daniiizita/disc_assessment

## Overview

##### Project Type and Purpose
- This is a full-stack web application built with Django (Python) that implements a behavioral assessment tool based on the DISC model.
- It comprises three Django “apps”:
- core – handles landing pages, contact, static assets and generic content
- disc – implements the interactive DISC questionnaire, processing logic, and result views
- user_auth – extends Django‐allauth for user registration, login/logout, profile management, and stores user results

##### File Structure
- Root:
- manage.py – Django CLI entry point
- assessment_disc_project/ – project settings (asgi.py, wsgi.py, settings.py, urls.py)
- requirements.txt – lists Python dependencies (Django, allauth, etc.)
- db.sqlite3 – development database
- Apps:
- core/, disc/, user_auth/ – each with models.py, views.py, urls.py, templates/, migrations/, (core also has static/)
- templates/account/ – overrides/allauth templates for signup, login, password reset
- Notice MVC / MTV pattern:
- Models → disc/models.py, user_auth/models.py, core/models.py
- Views → app/views.py handle HTTP, orchestrate business logic
- Templates → HTML under templates/ for each app
- Static assets served from core/static/ and possibly collected to a static root in production

##### Key Architectural Insights from README
- Backend: Django & Python
- Frontend: HTML5, CSS3 (custom + Bootstrap), minimal JavaScript
- Auth: allauth extended via custom forms and user model
- DB: SQLite for dev, MySQL for production
- Future: Integration with external recruitment APIs, admin dashboard, automated tests

a. Main Components
- Client (Web Browser)
- Web Server / Application Layer (Django)
– URL Dispatcher (assessment_disc_project/urls.py)
– Apps: core, disc, user_auth
– Django‐allauth Integration
- Data Layer
– Development: SQLite
– Production: MySQL
- Static File Server / CDN
- Email Service (SMTP) – for password resets, contact form notifications
- (Future) External Recruitment API
- (Future) Admin Dashboard & Reporting Module

b. Relationships & Interactions
1. Browser → HTTP(S) → Nginx/Gunicorn/Uvicorn → Django
2. URL Dispatcher routes to appropriate app’s view
3. Views call Models to query/update DB
4. Views render Templates, embed data (profile results, question forms)
5. Static requests served directly by Nginx or CDN
6. Auth flows: Browser ←→ Django-allauth ←→ user_auth.forms/models
7. Email notifications via SMTP relay
8. (Future) DISC result triggers REST call to Recruitment API
9. (Future) Admin Dashboard queries DB, generates reports

c. Architectural Patterns & Principles
- MTV (Model-Template-View) inherent to Django
- Separation of concerns: authentication, core pages, DISC logic in distinct apps
- Layered architecture: presentation, business logic, data access
- Extensibility: apps communicate through Django’s URL routing and signals (for future hooks)

d. Key Technologies & Libraries
- Django framework (ORM, routing, template engine)
- django-allauth for robust auth, extended via custom user model/forms
- SQLite/MySQL as relational DB
- Bootstrap + custom CSS for responsive UI
- Potential: Nginx or Apache as reverse proxy/static server; Gunicorn/Uvicorn as WSGI/ASGI server

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["Web Browser"]:::frontend
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        NGX["Nginx / Gunicorn / Uvicorn"]:::infra
        StaticSrv["Static File Server / CDN"]:::infra
    end

    Browser -->|"HTTPS"| NGX
    Browser -->|"GET static"| StaticSrv

    %% Web Application Layer
    subgraph "Web Application (Django)"
        MG["manage.py"]:::backend
        ASGI["asgi.py"]:::backend
        WSGI["wsgi.py"]:::backend
        Settings["settings.py"]:::backend
        URL["URL Dispatcher"]:::backend

        subgraph "Apps"
            subgraph "Core App"
                CORE_M["models.py"]:::django
                CORE_V["views.py"]:::django
                CORE_U["urls.py"]:::django
            end
            subgraph "DISC App"
                DISC_M["models.py"]:::django
                DISC_F["forms.py"]:::django
                DISC_V["views.py"]:::django
                DISC_U["urls.py"]:::django
            end
            subgraph "Auth App"
                AUTH_M["models.py"]:::django
                AUTH_F["forms.py"]:::django
                AUTH_V["views.py"]:::django
                AUTH_U["urls.py"]:::django
            end
        end

        Template["Template Engine"]:::django
        ORM["Django ORM"]:::django
    end

    NGX -->|"WSGI/ASGI"| URL
    MG -.-> URL
    ASGI -.-> URL
    WSGI -.-> URL
    URL -->|"route to core"| CORE_U
    URL -->|"route to disc"| DISC_U
    URL -->|"route to auth"| AUTH_U

    CORE_U --> CORE_V
    DISC_U --> DISC_V
    AUTH_U --> AUTH_V

    CORE_V --> ORM
    DISC_V --> ORM
    AUTH_V --> ORM

    ORM -->|"queries"| DB
    ORM --> DB

    CORE_V -->|"render templates"| Template
    DISC_V -->|"render templates"| Template
    AUTH_V -->|"render templates"| Template

    Template -->|"HTML"| NGX
    NGX --> Browser

    %% Data Store
    DB["DB: SQLite (dev) / MySQL (prod)"]:::db

    %% External Services
    SMTP["SMTP Email Service"]:::external
    RecruitAPI["External Recruitment API (planned)"]:::external

    CORE_V -->|"send contact form"| SMTP
    AUTH_V -->|"email notifications"| SMTP
    DISC_V -->|"REST call on result"| RecruitAPI

    %% Click Events
    click MG "https://github.com/daniiizita/disc_assessment/blob/main/manage.py"
    click ASGI "https://github.com/daniiizita/disc_assessment/blob/main/assessment_disc_project/asgi.py"
    click WSGI "https://github.com/daniiizita/disc_assessment/blob/main/assessment_disc_project/wsgi.py"
    click Settings "https://github.com/daniiizita/disc_assessment/blob/main/assessment_disc_project/settings.py"
    click URL "https://github.com/daniiizita/disc_assessment/blob/main/assessment_disc_project/urls.py"
    click CORE_M "https://github.com/daniiizita/disc_assessment/blob/main/core/models.py"
    click CORE_V "https://github.com/daniiizita/disc_assessment/blob/main/core/views.py"
    click CORE_U "https://github.com/daniiizita/disc_assessment/blob/main/core/urls.py"
    click DISC_M "https://github.com/daniiizita/disc_assessment/blob/main/disc/models.py"
    click DISC_F "https://github.com/daniiizita/disc_assessment/blob/main/disc/forms.py"
    click DISC_V "https://github.com/daniiizita/disc_assessment/blob/main/disc/views.py"
    click DISC_U "https://github.com/daniiizita/disc_assessment/blob/main/disc/urls.py"
    click AUTH_M "https://github.com/daniiizita/disc_assessment/blob/main/user_auth/models.py"
    click AUTH_F "https://github.com/daniiizita/disc_assessment/blob/main/user_auth/forms.py"
    click AUTH_V "https://github.com/daniiizita/disc_assessment/blob/main/user_auth/views.py"
    click AUTH_U "https://github.com/daniiizita/disc_assessment/blob/main/user_auth/urls.py"

    %% Styles
    classDef frontend fill:#cccccc,stroke:#333,stroke-width:1px
    classDef infra fill:#dddddd,stroke:#333,stroke-width:1px
    classDef backend fill:#add8e6,stroke:#333,stroke-width:1px
    classDef django fill:#1f77b4,stroke:#333,stroke-width:1px
    classDef db fill:#2ca02c,stroke:#333,stroke-width:1px
    classDef external fill:#ff7f0e,stroke:#333,stroke-width:1px
```
