# slagrave/spaceapps2022 architecture

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

- Interactive diagram: https://gitdiagram.com/slagrave/spaceapps2022
- Repository: https://github.com/slagrave/spaceapps2022

## Overview

##### Main Components
- Main Application Entry Point: The file dijon.py acts as the coordinator that initializes the application.
- GUI Module: Located in the src/gui directory, this component houses various frames and windows (e.g., main_window, filter_adder_frame, filter_frame, share_url_window, script_editor_frame, run) which manage user interaction. It also includes a built-in Python interpreter for custom code execution.
- Image Processing Module: Found in src/img_proc, it includes modules such as combine.py, custom_parser.py, and filters.py that perform the core image processing tasks like merging channels and applying filters (Gaussian Blur, Mean, Mode, etc.).
- Web Interface Component: Present under src/web_interface, this module could be used for remote interactions or web-based image data delivery.
- Configuration Management: The config.json file (and related parsing in src/config_parse.py) holds settings—for example, the local destination for saving images.
- External Dependencies: These include NASA JunoCam image data (retrieved likely via user-provided “Share Links”), as well as the Python libraries listed in requirements.txt.

##### Establish Relationships & Data Flow
- The user interacts with the GUI which provides the entry point (dijon.py) to select datasets, edit filters, and even run custom Python code.
- Once a user enters a “Share Link” from the NASA website, the GUI passes this data to the application, triggering the image processing pipeline.
- The image processing module then takes over to perform various operations (image merging, applying filters, etc.) and returns the processed image to the GUI.
- The processed result can then be saved locally (using settings from config.json) or possibly served through the web interface.
- The web interface (if used) acts as an alternate output or control channel.

##### Architectural Patterns & Design Principles
- Separation of Concerns: The design clearly splits responsibilities between the user interface (GUI), the image processing logic, and web interfacing. This modular separation facilitates maintainability and scalability.
- Extensibility: With components like the built-in Python interpreter and custom parser, Dijon allows advanced users to extend or modify its behavior.
- Layered Approach: There is a core layer handling logic (image processing), an interface layer (GUI/web), and a configuration layer.

##### Relevant Technologies
- Python: The entire project is written in Python, which implies that the modules interact via Python package imports.
- GUI Framework: While the exact framework isn’t specified in filenames, the structure under src/gui suggests a custom or common Python GUI toolkit (possibly Tkinter, PyQt, or similar).
- Image Processing Libraries: The processing functions might use libraries mentioned in requirements.txt (e.g., PIL/Pillow, NumPy, etc.), even though they are not directly visible from the file names.
- Web Interface Tools: Might employ a lightweight web framework (or custom built HTTP handling) as seen in src/web_interface/web_interface.py.

##### Detail and Component Separation
- Avoid oversimplification. While the overall system is not extremely large, ensure each sub-component (GUI frames, image processing functions, etc.) is captured.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User("User"):::external
    ExtData("NASA JunoCam (External)"):::external

    subgraph "Core Application"
        MainApp("Main Application (dijon.py)"):::main
    end

    subgraph "GUI Module"
        GUI1("Main Window (main_window.py)"):::gui
        GUI2("Filter Adder (filter_adder_frame.py)"):::gui
        GUI3("Filter Frame (filter_frame.py)"):::gui
        GUI4("Filter List (filter_list.py)"):::gui
        GUI5("Run (run.py)"):::gui
        GUI6("Script Editor (script_editor_frame.py)"):::gui
        GUI7("Share URL Window (share_url_window.py)"):::gui
    end

    subgraph "Image Processing Module"
        Proc1("Combine (combine.py)"):::process
        Proc2("Custom Parser (custom_parser.py)"):::process
        Proc3("Filters (filters.py)"):::process
    end

    subgraph "Configuration Management"
        Conf1("Config File (config.json)"):::config
        Conf2("Config Parser (config_parse.py)"):::config
    end

    subgraph "Web Interface"
        Web("Web Interface (web_interface.py)"):::web
    end

    %% Data Flow Connections
    User -->|"interacts"| GUI1
    ExtData -->|"provides_share_link"| GUI7
    GUI7 -->|"submit_link"| MainApp
    MainApp -->|"invoke_merge"| Proc1
    MainApp -->|"invoke_custom"| Proc2
    MainApp -->|"invoke_filter"| Proc3
    Proc1 -->|"result_to_GUI"| GUI1
    Proc2 -->|"result_to_GUI"| GUI1
    Proc3 -->|"result_to_GUI"| GUI1
    GUI1 -->|"load_settings"| Conf1
    Conf1 -->|"send_settings"| GUI1
    MainApp -->|"sync_data"| Web
    Web -->|"remote_control"| MainApp

    %% Click Events
    click MainApp "https://github.com/slagrave/spaceapps2022/blob/main/dijon.py"
    click GUI1 "https://github.com/slagrave/spaceapps2022/blob/main/src/gui/main_window.py"
    click GUI2 "https://github.com/slagrave/spaceapps2022/blob/main/src/gui/filter_adder_frame.py"
    click GUI3 "https://github.com/slagrave/spaceapps2022/blob/main/src/gui/filter_frame.py"
    click GUI4 "https://github.com/slagrave/spaceapps2022/blob/main/src/gui/filter_list.py"
    click GUI5 "https://github.com/slagrave/spaceapps2022/blob/main/src/gui/run.py"
    click GUI6 "https://github.com/slagrave/spaceapps2022/blob/main/src/gui/script_editor_frame.py"
    click GUI7 "https://github.com/slagrave/spaceapps2022/blob/main/src/gui/share_url_window.py"
    click Proc1 "https://github.com/slagrave/spaceapps2022/blob/main/src/img_proc/combine.py"
    click Proc2 "https://github.com/slagrave/spaceapps2022/blob/main/src/img_proc/custom_parser.py"
    click Proc3 "https://github.com/slagrave/spaceapps2022/blob/main/src/img_proc/filters.py"
    click Web "https://github.com/slagrave/spaceapps2022/blob/main/src/web_interface/web_interface.py"
    click Conf1 "https://github.com/slagrave/spaceapps2022/blob/main/config.json"
    click Conf2 "https://github.com/slagrave/spaceapps2022/blob/main/src/config_parse.py"

    %% Styles
    classDef main fill:#FFCCCC,stroke:#333,stroke-width:2px;
    classDef gui fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef process fill:#CCCCFF,stroke:#333,stroke-width:2px;
    classDef config fill:#FFFFCC,stroke:#333,stroke-width:2px;
    classDef web fill:#E6CCFF,stroke:#333,stroke-width:2px;
    classDef external fill:#FFE6CC,stroke:#333,stroke-width:2px;
```
