# emper0r/ivao-status architecture

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

- Interactive diagram: https://gitdiagram.com/emper0r/ivao-status
- Repository: https://github.com/emper0r/ivao-status

## Overview

##### Project Type & Purpose
- This is a desktop application developed in Python using PyQt4 that displays the status of pilots on the International Virtual Aviation Organisation (IVAO) network.
- Its aim is to allow Linux users to check the status of players online, integrating a graphical user interface (GUI) and mapping via OpenLayers (JavaScript-based) for geographic information display.
- The project includes a SQLite database (built via ivao_status.sql and rebuilt by BuildDB.py) storing aviation-related data (aircraft, airlines, airports, etc.).

##### Main Components
a. User Interface (UI):
- QtUI directory: Contains Qt Designer .ui files (e.g., MainWindow_UI.ui, SettingWindow_UI.ui) which define the layout for various windows.
- GUI related modules in the modules folder (e.g., MainWindow_UI.py, FOLME_UI.py, ControllerInfo_UI.py, PilotInfo_UI.py, etc.) that bind these UI definitions with application logic.
b. Business Logic & Modules:
- Python modules under the modules directory implement core application logic including database building (BuildDB.py), mapping (MapView.py), scheduling (Schedule.py), and flight status (StatusFlight.py).
- Additional helper modules (e.g., distance.py, format.py, util.py) for computations and formatting.
- The presence of subdirectories like “windows”, “x64”, and “x86” can be seen as support code variations, likely for different operational modes or architectures.
c. Data Storage:
- The database directory contains various .dat files and ivao.db (an SQLite database) which holds detailed aviation data such as aircraft, airlines, airports, fir (flight information regions), etc.
- The ivao_status.sql script is used to rebuild the database if necessary.
d. Mapping Component:
- The OpenLayers directory holds JavaScript and CSS assets needed to render maps (using the OpenLayers library), which is integrated with the application to display geographic layers.
- This part demonstrates an integration of Python business logic with web-based mapping technology.
e. Static Resources & Assets:
- Config.cfg and Settings.py provide configuration settings controlling aspects of the application.

##### Relationships & Interactions
- The UI components (from QtUI) interact with backend modules (inside modules) to fetch and present data.
- Database operations are abstracted in modules like BuildDB.py and SQL_queries.py which interact with the SQLite database stored in the database directory.
- The mapping functionality (through OpenLayers) is invoked by modules such as MapView.py to render flight locations and other spatial data.
- Helper modules manage computations used across different parts of the system (e.g., converting units or calculating distances).

##### Architectural Patterns & Technologies
- Separation of concerns: The project clearly separates user interface components (QtUI and their corresponding modules) from business logic and data handling (modules and database directory).
- MVC-like structure: Although not a strict MVC, there’s a division between UI (View), application logic (Controller in modules), and data (the SQLite database).
- Technologies used: Python as the programming language, PyQt4 for the GUI, OpenLayers for geographic mapping (web technology), and SQLite for local database management.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% GUI Layer
    subgraph "GUI Layer"
        UI["GUI (QtUI Components)"]:::guiStyle
    end

    %% Business Logic & Modules
    subgraph "Business Logic & Modules"
        UB["UI Bindings (MainWindow_UI, ControllerInfo_UI, etc.)"]:::bizStyle
        BL["Core Modules (BuildDB, MapView, Schedule, StatusFlight)"]:::bizStyle
        subgraph "Helper Modules"
            DIST["distance.py"]:::bizStyle
            FRMT["format.py"]:::bizStyle
            UTIL["util.py"]:::bizStyle
        end
        WS["Subdirectory: windows"]:::bizStyle
        X64["Subdirectory: x64"]:::bizStyle
        X86["Subdirectory: x86"]:::bizStyle
    end

    %% Data Storage Layer
    subgraph "Data Storage"
        DB["SQLite Database (ivao.db)"]:::dataStyle
        DS["Data Files (.dat files)"]:::dataStyle
        SQL["SQL Script (ivao_status.sql)"]:::dataStyle
    end

    %% Mapping Component
    subgraph "Mapping Component"
        MAP["Mapping Engine (OpenLayers)"]:::mapStyle
    end

    %% Configuration & Assets
    subgraph "Configuration & Assets"
        CFG["Config.cfg"]:::confStyle
        SET["Settings.py"]:::confStyle
        IMG["Images"]:::confStyle
        FLG["Flags"]:::confStyle
        SCR["Screenshots"]:::confStyle
    end

    %% Relationships & Data Flow
    UI -->|"user_commands"| UB
    UB -->|"invokes"| BL
    UB -->|"utilizes"| DIST
    UB -->|"utilizes"| FRMT
    UB -->|"utilizes"| UTIL
    BL -->|"queries"| DB
    BL -->|"accesses"| DS
    BL -->|"calls_mapping"| MAP
    BL --> WS
    BL --> X64
    BL --> X86
    CFG -->|"config"| BL
    SET -->|"config"| BL
    IMG -->|"visuals"| UI
    FLG -->|"flags"| UI
    SCR -->|"screenshots"| UI

    %% Click Events
    click UI "https://github.com/emper0r/ivao-status/tree/master/QtUI"
    click UB "https://github.com/emper0r/ivao-status/tree/master/modules"
    click BL "https://github.com/emper0r/ivao-status/tree/master/modules"
    click DIST "https://github.com/emper0r/ivao-status/blob/master/modules/distance.py"
    click FRMT "https://github.com/emper0r/ivao-status/blob/master/modules/format.py"
    click UTIL "https://github.com/emper0r/ivao-status/blob/master/modules/util.py"
    click WS "https://github.com/emper0r/ivao-status/tree/master/modules/windows"
    click X64 "https://github.com/emper0r/ivao-status/tree/master/modules/x64"
    click X86 "https://github.com/emper0r/ivao-status/tree/master/modules/x86"
    click DB "https://github.com/emper0r/ivao-status/blob/master/database/ivao.db"
    click DS "https://github.com/emper0r/ivao-status/tree/master/database"
    click SQL "https://github.com/emper0r/ivao-status/blob/master/ivao_status.sql"
    click MAP "https://github.com/emper0r/ivao-status/tree/master/OpenLayers"
    click CFG "https://github.com/emper0r/ivao-status/blob/master/Config.cfg"
    click SET "https://github.com/emper0r/ivao-status/blob/master/Settings.py"
    click IMG "https://github.com/emper0r/ivao-status/tree/master/images"
    click FLG "https://github.com/emper0r/ivao-status/tree/master/flags"
    click SCR "https://github.com/emper0r/ivao-status/tree/master/screenshots"

    %% Styles
    classDef guiStyle fill:#ADD8E6,stroke:#000,stroke-width:2px,color:#000;
    classDef bizStyle fill:#90EE90,stroke:#000,stroke-width:2px,color:#000;
    classDef dataStyle fill:#FFFACD,stroke:#000,stroke-width:2px,color:#000;
    classDef mapStyle fill:#FFB6C1,stroke:#000,stroke-width:2px,color:#000;
    classDef confStyle fill:#E6E6FA,stroke:#000,stroke-width:2px,color:#000;
```
