# fashtimedotcom/django-mongdb-echarts architecture

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

- Interactive diagram: https://gitdiagram.com/fashtimedotcom/django-mongdb-echarts
- Repository: https://github.com/fashtimedotcom/django-mongdb-echarts

## Overview

##### Main System Components

a) Web Application Layer
- Django Framework (Core)
- Multiple Django Apps:
- Home App (main application)
- Salt_Demo App (secondary application)
- Settings Module (configuration management)

b) Frontend Components
- Static Assets Structure:
- JavaScript Libraries (jQuery, Highcharts, D3.js)
- CSS Resources
- ECharts Visualization Components (alpha, beta, gamma)

c) Data Layer
- MongoDB Database (evident from MongoDB Schema documentation)
- Data Aggregation Services (multiple aggregation modules)

##### Core Architecture (Top Level)
**[Client Browser] → [Nginx (Static Files)] ↔ [Django Application] ↔ [MongoDB]**

##### Application Layer (Second Level)
**[URLs/Routes] → [Views] → [Templates] → [Static Assets]**
- ↕
- [Aggregation Layer]
- ↕
- [Models/MongoDB]

##### Component Details

a) Frontend Components (Blue Section):
- Templates Layer
- Base Template
- Home Templates
- Salt Demo Templates
- Static Assets
- Visualization Libraries (ECharts, Highcharts, D3.js)
- CSS/JS Resources

b) Backend Components (Green Section):
- Django Apps
- Home App (with aggregation modules)
- Salt Demo App
- Data Processing
- Aggregation Services
- Permission Management

c) Data Layer (Yellow Section):
- MongoDB Connection
- Schema Definitions
- Data Models

##### Flow Indicators

- Data flow between components
- Authentication flow
- Aggregation processing flow
- Template rendering flow

- Blue: Frontend/UI Components
- Green: Backend Processing
- Yellow: Data Storage
- Red: Security/Permission Components
- Gray: Configuration/Settings

Symbols for:
- → Synchronous Data Flow
- ⇢ Asynchronous Data Flow
- ⟲ Data Aggregation Process
- ⚡ API Endpoints

Important Notes:
##### MongoDB schema version management

Remember to include deployment-specific notes regarding:
- Nginx configuration for static files
- Production settings management
- MongoDB connection configuration
- Static file collection process

This will create a comprehensive yet clear representation of the system's architecture while focusing on the data visualization aspects that are central to the project's purpose.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph "Web Server"
        Nginx["Nginx Server"]:::server
    end

    subgraph "Django Application"
        Core["Django Core"]:::core
        click Core "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/udbshow/urls.py"

        subgraph "Frontend Layer"
            Templates["Templates"]
            BaseTemplate["Base Template"]:::template
            click BaseTemplate "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/templates/base.html"
            NavTemplate["Navigation"]:::template
            click NavTemplate "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/templates/nav.html"

            StaticAssets["Static Assets"]
            JQuery["jQuery"]:::js
            click JQuery "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/static/js/jquery-1.11.2.js"
            Highcharts["Highcharts"]:::js
            click Highcharts "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/static/js/highcharts.js"
            D3["D3.js"]:::js
            click D3 "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/static/js/d3.js"
            
            ECharts["ECharts Components"]
            Alpha["Alpha"]:::js
            click Alpha "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/static/echartsjs/alpha.js"
            Beta["Beta"]:::js
            click Beta "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/static/echartsjs/beta.js"
            Gamma["Gamma"]:::js
            click Gamma "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/static/echartsjs/gamma.js"
        end

        subgraph "Application Layer"
            HomeApp["Home App"]:::app
            click HomeApp "https://github.com/FashtimeDotCom/django-mongdb-echarts/tree/master/home/"
            HomeViews["Views"]:::component
            click HomeViews "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/views.py"
            HomeUrls["URLs"]:::component
            click HomeUrls "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/urls.py"
            HomeModels["Models"]:::component
            click HomeModels "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/models.py"

            SaltApp["Salt Demo App"]:::app
            click SaltApp "https://github.com/FashtimeDotCom/django-mongdb-echarts/tree/master/salt_demo/"
            SaltViews["Views"]:::component
            click SaltViews "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/salt_demo/views.py"
            SaltUrls["URLs"]:::component
            click SaltUrls "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/salt_demo/urls.py"

            PermSystem["Permission System"]:::security
            click PermSystem "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/permission.py"
        end

        subgraph "Settings Layer"
            BaseSettings["Base Settings"]:::config
            click BaseSettings "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/settings/base.py"
            DevSettings["Development Settings"]:::config
            click DevSettings "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/settings/dev.py"
            ProdSettings["Production Settings"]:::config
            click ProdSettings "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/settings/production.py"
        end

        subgraph "Data Processing Layer"
            MainAgg["Main Aggregation"]:::data
            click MainAgg "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/aggregation.py"
            CompanyAgg["Company Aggregation"]:::data
            click CompanyAgg "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/aggregation_company.py"
            HAAgg["HA Aggregation"]:::data
            click HAAgg "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/aggregation_ha.py"
            SelfBuildAgg["Self Build Aggregation"]:::data
            click SelfBuildAgg "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/home/aggregation_self_build.py"
        end
    end

    subgraph "Data Storage"
        MongoDB["MongoDB"]:::database
        MongoSchema["MongoDB Schema"]:::schema
        click MongoSchema "https://github.com/FashtimeDotCom/django-mongdb-echarts/blob/master/doc/MongoDB Schema.md"
    end

    %% Relationships
    Browser --> Nginx
    Nginx --> Core
    Core --> HomeApp
    Core --> SaltApp
    
    HomeApp --> HomeViews
    HomeApp --> HomeUrls
    HomeApp --> HomeModels
    HomeViews --> Templates
    
    SaltApp --> SaltViews
    SaltApp --> SaltUrls
    SaltViews --> Templates
    
    Templates --> BaseTemplate
    Templates --> NavTemplate
    Templates --> StaticAssets
    
    StaticAssets --> JQuery
    StaticAssets --> Highcharts
    StaticAssets --> D3
    StaticAssets --> ECharts
    ECharts --> Alpha
    ECharts --> Beta
    ECharts --> Gamma
    
    HomeViews --> MainAgg
    HomeViews --> CompanyAgg
    HomeViews --> HAAgg
    HomeViews --> SelfBuildAgg
    
    MainAgg --> MongoDB
    CompanyAgg --> MongoDB
    HAAgg --> MongoDB
    SelfBuildAgg --> MongoDB
    
    MongoDB --> MongoSchema
    
    Core --> BaseSettings
    BaseSettings --> DevSettings
    BaseSettings --> ProdSettings
    
    HomeApp --> PermSystem
    SaltApp --> PermSystem

    %% Styles
    classDef server fill:#f9f,stroke:#333,stroke-width:2px
    classDef core fill:#f96,stroke:#333,stroke-width:2px
    classDef app fill:#9f9,stroke:#333,stroke-width:2px
    classDef component fill:#fff,stroke:#333,stroke-width:1px
    classDef template fill:#fcf,stroke:#333,stroke-width:1px
    classDef js fill:#ff9,stroke:#333,stroke-width:1px
    classDef security fill:#f66,stroke:#333,stroke-width:2px
    classDef config fill:#69f,stroke:#333,stroke-width:1px
    classDef data fill:#6ff,stroke:#333,stroke-width:1px
    classDef database fill:#ff6,stroke:#333,stroke-width:2px
    classDef schema fill:#f96,stroke:#333,stroke-width:1px
```
