# openutm/flight-blender architecture

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

- Interactive diagram: https://gitdiagram.com/openutm/flight-blender
- Repository: https://github.com/openutm/flight-blender

## Overview

##### Main Components Identification
- Core Backend Server (Flight Blender)
- Central Django application (flight_blender folder) which ties together the system.
- Central “API” layer (see the api folder with the API spec YAML and Postman collection), indicating how external clients (or even internal modules) interact via HTTP endpoints.
- Modular Sub-Applications:
- Create distinct blocks for each major module—such as auth_helper, conformance_monitoring_operations, flight_declaration_operations, flight_feed_operations, geo_fence_operations, notification_operations, rid_operations, scd_operations, uss_operations, utm_adapter, and weather_monitoring_operations.
- Each of these should be shown as distinct components (often implemented as Django apps) that encapsulate specific business logic.
- Background Task Processing:
- A Celery worker component (noted by flight_blender/celery.py) which handles asynchronous tasks across modules (e.g., sending notifications, processing flight data feeds, etc.).
- Data Stores and Caching:
- Databases (implicit from the migrations in each module) and specify a caching/backend store such as Redis (config/redis.conf), which supports performance and state management.
- Containerization and Deployment:
- Deployment layer using Docker – include Dockerfile, docker-compose, and entrypoint scripts (found in the entrypoints folder) that delineate production vs. non-database startup flows.
- External Interfaces & Integrations:
- Integration with DSS and interoperability components (e.g., auth_helper/dss_auth_helper.py, and DSS connectivity modules mentioned in the README).
- Mention AMQP or messaging queues indicated by the “Operator Notifications” functionality.
- Indication of front-end components (Flight Spotlight display) that are external client applications consuming data from this backend.

##### Relationships and Interactions
- From external data sources (flight tracking feeds, geofence inputs, flight declarations) entering the system via API endpoints.
- Between the core flight_blender server and modular apps (each handling a specific piece of data or processing).
- From the core server and modules to the task queue (Celery) and then to background processing workers.
- Between the application and external systems (DSS, external APIs, and messaging systems).
- That the modules communicate indirectly through shared data stores (databases and caches) and via scheduled jobs or event signals (for instance, conformance monitoring tasks or operator notifications).

##### Architectural Patterns and Design Principles
- That the project follows a modular monolith architecture where each major domain (e.g., flight declaration, flight feed, geo-fence) is implemented as an independent Django app, facilitating separation of concerns.
- Use of asynchronous task processing (Celery) to decouple heavy or long-running processes from the synchronous request–response cycle.
- Containerization (with Docker and docker-compose) which facilitates consistent deployment and scaling.

##### Relevant Technologies, Frameworks, and Tools
- Django as the web framework.
- Celery for task processing.
- Redis for caching and potentially as a Celery broker.
- Docker (Dockerfile, docker-compose, entrypoint scripts) for containerization and orchestration.
- Deployment-specific configurations (Procfile, configuration files in .vscode, pre-commit configuration, and GitHub workflows).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Integration
    extData["External Data Sources (ADS-B,RemoteID,DSS,etc.)"]:::external
    extClients["External Clients (Flight Spotlight,etc.)"]:::external

    %% API Layer
    apiLayer["API Layer for External Clients"]:::api

    %% Core Django Server
    coreServer["Core Django Server (Flight Blender)"]:::backend

    %% Modular Django Apps Subgraph
    subgraph "Modular Django Apps"
        authHelper["Auth Helper / DSS Integration"]:::module
        conformance["Conformance Monitoring Operations"]:::module
        flightDec["Flight Declaration Operations"]:::module
        flightFeed["Flight Feed Operations"]:::module
        geoFence["Geo-Fence Operations"]:::module
        notification["Notification Operations"]:::module
        ridOps["Remote ID (RID) Operations"]:::module
        scdOps["Scheduled (SCD) Operations"]:::module
        ussOps["USS Operations"]:::module
        utmAdapter["UTM Adapter"]:::module
        weatherMon["Weather Monitoring Operations"]:::module
    end

    %% Asynchronous Task Processing and Cache
    taskWorker["Celery Worker (Async Task Processing)"]:::async
    cacheStore["Redis (Caching & Broker)"]:::cache

    %% Deployment - Containerization
    deployDockerfile["Dockerfile"]:::deploy
    deployCompose["docker-compose.yml"]:::deploy
    deployEntrypoints["Entrypoints"]:::deploy

    %% Data Flow Connections
    extData -->|"ingest"| apiLayer
    extClients -->|"request"| apiLayer
    apiLayer -->|"routes"| coreServer
    coreServer -->|"delegates"| authHelper
    coreServer -->|"delegates"| conformance
    coreServer -->|"delegates"| flightDec
    coreServer -->|"delegates"| flightFeed
    coreServer -->|"delegates"| geoFence
    coreServer -->|"delegates"| notification
    coreServer -->|"delegates"| ridOps
    coreServer -->|"delegates"| scdOps
    coreServer -->|"delegates"| ussOps
    coreServer -->|"delegates"| utmAdapter
    coreServer -->|"delegates"| weatherMon

    %% Modules async processing connections
    authHelper -->|"async"| taskWorker
    conformance -->|"async"| taskWorker
    flightDec -->|"async"| taskWorker
    flightFeed -->|"async"| taskWorker
    geoFence -->|"async"| taskWorker
    notification -->|"async"| taskWorker
    ridOps -->|"async"| taskWorker
    scdOps -->|"async"| taskWorker
    ussOps -->|"async"| taskWorker
    utmAdapter -->|"async"| taskWorker
    weatherMon -->|"async"| taskWorker

    %% Core and TaskWorker use Cache
    coreServer -->|"cache"| cacheStore
    taskWorker -->|"broker"| cacheStore

    %% Deployment connections (containerization applies to main components)
    deployDockerfile ---|"containerizes"| apiLayer
    deployCompose ---|"orchestrates"| coreServer
    deployEntrypoints ---|"initializes"| taskWorker

    %% Click Events
    click coreServer "https://github.com/openutm/flight-blender/tree/master/flight_blender/"
    click apiLayer "https://github.com/openutm/flight-blender/tree/master/api/"
    click authHelper "https://github.com/openutm/flight-blender/tree/master/auth_helper/"
    click conformance "https://github.com/openutm/flight-blender/tree/master/conformance_monitoring_operations/"
    click flightDec "https://github.com/openutm/flight-blender/tree/master/flight_declaration_operations/"
    click flightFeed "https://github.com/openutm/flight-blender/tree/master/flight_feed_operations/"
    click geoFence "https://github.com/openutm/flight-blender/tree/master/geo_fence_operations/"
    click notification "https://github.com/openutm/flight-blender/tree/master/notification_operations/"
    click ridOps "https://github.com/openutm/flight-blender/tree/master/rid_operations/"
    click scdOps "https://github.com/openutm/flight-blender/tree/master/scd_operations/"
    click ussOps "https://github.com/openutm/flight-blender/tree/master/uss_operations/"
    click utmAdapter "https://github.com/openutm/flight-blender/tree/master/utm_adapter/"
    click weatherMon "https://github.com/openutm/flight-blender/tree/master/weather_monitoring_operations/"
    click taskWorker "https://github.com/openutm/flight-blender/blob/master/flight_blender/celery.py"
    click cacheStore "https://github.com/openutm/flight-blender/blob/master/config/redis.conf"
    click deployDockerfile "https://github.com/openutm/flight-blender/tree/master/Dockerfile"
    click deployCompose "https://github.com/openutm/flight-blender/blob/master/docker-compose.yml"
    click deployEntrypoints "https://github.com/openutm/flight-blender/tree/master/entrypoints/"

    %% Styles
    classDef external fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef api fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef backend fill:#ffeeba,stroke:#856404,stroke-width:2px;
    classDef module fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef async fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef cache fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef deploy fill:#fefefe,stroke:#6f42c1,stroke-width:2px;
```
