# jevansbio/arise-mds-sensor-portal architecture

> Architecture diagram of the GitHub repository jevansbio/arise-mds-sensor-portal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jevansbio/arise-mds-sensor-portal
- Repository: https://github.com/jevansbio/arise-mds-sensor-portal

## Overview

##### Main Components

a) Backend (Django Application):
- Core Django Application Layer
- API Layer (REST Framework)
- Multiple Django Apps:
- data_models
- frontend_viewer
- user_management
- utils

b) Database Layer:
- Indicated by Django models and migrations
- Should show relationships between different data models

c) Frontend Components:
- Static Files
- Templates
- JavaScript utilities

d) Authentication/Authorization System:
- Custom user management system
- Device authentication
- Profiles

**[Client Layer]**
- ↕
**[Application Layer]**
- ↕
**[Data Layer]**

##### Detailed Component Breakdown

Client Layer:
- JavaScript utilities (fetch_functions.js, timezone_functions.js)
- REST API consumers

Application Layer:
- data_models (core functionality)
- frontend_viewer (presentation layer)
- user_management (authentication/authorization)
- utils (shared utilities)
- Celery worker (indicated by celery.py)
- API endpoints and viewsets

Data Layer:
- Database tables/models
- Relationships between:
- User models
- Device models
- Deployment models
- Data files
- Profiles

##### Important Relationships to Highlight

- Frontend viewer → API endpoints
- API endpoints → Data models
- User Management → Authentication
- Device authentication → Data models
- Celery tasks → Data processing

##### Additional Elements

- Docker container boundaries (indicated by docker-compose files)
- Static file serving configuration
- API authentication flow
- Async capabilities (ASGI configuration)

##### Specific Implementation Details

- REST Framework integration
- Debug toolbar (development environment)
- GIS capabilities (indicated by GIS static files)
- Custom management commands
- Permission system
- File handling system

##### Notes

- Keep the main components at a high level but include sub-components
- Clear separation between authenticated and public areas
- Scalable components
- Async vs sync operations
- Security boundaries

- Nested components
- Custom styling
- Container boundaries
- Proper spacing and alignment

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that impact the system's operation and maintenance.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        FE[Frontend Templates]:::frontend
        JS[JavaScript Utilities]:::frontend
        REST_UI[REST Framework UI]:::frontend
        ADMIN_UI[Admin Interface]:::frontend
        GIS_UI[GIS Components]:::frontend
    end

    subgraph Application
        subgraph Django_Core
            SETTINGS[Settings]:::core
            URLS[URL Configuration]:::core
            ASGI[Async Support]:::core
        end

        subgraph API_Layer
            API[API Endpoints]:::api
            VS[Viewsets]:::api
            SER[Serializers]:::api
        end

        subgraph Apps
            DM[Data Models]:::app
            FV[Frontend Viewer]:::app
            UM[User Management]:::app
            UTILS[Utils]:::app
        end

        subgraph Services
            CELERY[Celery Worker]:::service
            DEBUG[Debug Toolbar]:::service
        end

        subgraph Auth_System
            AUTH[Authentication Rules]:::auth
            PERM[Permissions]:::auth
        end
    end

    subgraph Data_Layer
        DB[(Database)]:::db
        STATIC[Static Files]:::storage
    end

    %% Relationships
    FE --> API
    JS --> API
    REST_UI --> API
    ADMIN_UI --> API
    GIS_UI --> API

    API --> DM
    VS --> DM
    SER --> DM

    FV --> API
    UM --> AUTH
    AUTH --> API
    PERM --> API

    DM --> DB
    UM --> DB
    CELERY --> DB

    %% Click Events
    click SETTINGS "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/sensor_portal/settings.py"
    click URLS "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/sensor_portal/urls.py"
    click ASGI "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/sensor_portal/asgi.py"
    click API "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/data_models/api.py"
    click VS "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/data_models/viewsets.py"
    click SER "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/data_models/serializers.py"
    click DM "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/data_models/models.py"
    click FV "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/frontend_viewer/views.py"
    click UM "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/user_management/models.py"
    click UTILS "https://github.com/jevansbio/ARISE-MDS-sensor-portal/tree/main/sensor_portal/utils"
    click CELERY "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/sensor_portal/celery.py"
    click AUTH "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/data_models/rules.py"
    click PERM "https://github.com/jevansbio/ARISE-MDS-sensor-portal/blob/main/sensor_portal/data_models/permissions.py"
    click FE "https://github.com/jevansbio/ARISE-MDS-sensor-portal/tree/main/sensor_portal/templates"
    click JS "https://github.com/jevansbio/ARISE-MDS-sensor-portal/tree/main/sensor_portal/static_files/javascript"
    click REST_UI "https://github.com/jevansbio/ARISE-MDS-sensor-portal/tree/main/sensor_portal/static/rest_framework"
    click ADMIN_UI "https://github.com/jevansbio/ARISE-MDS-sensor-portal/tree/main/sensor_portal/static/admin"
    click GIS_UI "https://github.com/jevansbio/ARISE-MDS-sensor-portal/tree/main/sensor_portal/static/gis"
    click DEBUG "https://github.com/jevansbio/ARISE-MDS-sensor-portal/tree/main/sensor_portal/static/debug_toolbar"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef api fill:#e74c3c,stroke:#c0392b,color:white
    classDef app fill:#9b59b6,stroke:#8e44ad,color:white
    classDef service fill:#f1c40f,stroke:#f39c12,color:black
    classDef auth fill:#e67e22,stroke:#d35400,color:white
    classDef db fill:#34495e,stroke:#2c3e50,color:white
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white
```
