# totalopenstation/totalopenstation architecture

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

- Interactive diagram: https://gitdiagram.com/totalopenstation/totalopenstation
- Repository: https://github.com/totalopenstation/totalopenstation

## Overview

##### Project’s Main Components
- Core Modules: The application’s core logic is encapsulated in the main package “totalopenstation” with submodules.
– Formats: Contains a variety of modules (such as carlson_rw5.py, landxml.py, leica_gsi.py, etc.) to handle different survey data input formats.
– Models: Defines how survey data is processed and represented internally (with implementations for various device models, e.g., leica_tcr_1205.py, nikon_npl_350.py, etc.).
– Output: Manages exporting processed data into multiple formats (including CSV, DXF, GeoJSON, and more).
– Utils: Provides supporting functionalities (for example, scanwin32.py and upref.py).
- Tests and Documentation: The tests (in totalopenstation/tests) and docs directories support the development and deployment lifecycle, signifying the project's adherence to good software practice.
- External Services: While not overly complex, note the integration with GitHub workflows for testing and packaging (pyinstaller, pytest).

##### Relationships and Interactions
- Within the core engine, show that input data is first handled by the Formats modules – these parse raw survey files.
- Flow from the Models module to the Output module where processed results are exported in multiple formats.

##### Architectural Patterns and Design Principles
- Modularity: the separation of concerns (each submodule deals with a specific aspect like input, processing, or output) is the backbone of the architecture.
- Dual-interface principle: independent command line and graphical interfaces both tap into the same underlying processing modules.
- The design also suggests a plug-in–like extensibility in “formats” (and similarly in “output”) whereby different file formats can be added or modified without affecting other parts of the system.

##### Relevant Technologies and Frameworks
- Python as the primary language.
- Tkinter (or python3-tk / python3-tkinter) for the GUI.
- Testing frameworks (pytest from the GitHub workflows).
- Packaging and distribution tools (PyInstaller as seen in the GitHub workflow and setup.py for installation).
- Documentation is generated with Sphinx (readthedocs is used).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        CLI["Command Line Interface (CLI)"]:::ui
        GUI["Graphical User Interface (GUI)"]:::ui
    end

    %% Core Processing Layer
    subgraph "Core Processing"
        Formats["Formats Module"]:::core
        Models["Models Module"]:::core
        Output["Output Module"]:::core
        Utils["Utils Module"]:::core
    end

    %% Data Management Layer
    subgraph "Data Management Layer"
        Sample["Sample Data"]:::data
        Resources["Resources/Data"]:::data
    end

    %% Development & Supporting Tools
    subgraph "Development & Supporting Tools"
        Tests["Tests"]:::support
        Docs["Documentation"]:::support
        CI["CI/CD"]:::external
    end

    %% Connections from User Interface to Core Processing
    CLI -->|"triggers"| Formats
    GUI -->|"initiates"| Formats

    %% Core Processing data flow
    Formats -->|"DataParsing"| Models
    Models -->|"ModelTransformation"| Output
    Output -->|"DataExport"| Resources
    Output -->|"Archive"| Sample
    Formats -->|"uses"| Utils
    Models -->|"uses"| Utils

    %% Connections to Supporting Tools
    Models ---|"ValidatedBy"| Tests
    Docs ---|"Documents"| Formats
    Docs ---|"Documents"| Models
    Docs ---|"Documents"| Output
    CI ---|"Automates"| Tests

    %% Styles
    classDef ui fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef core fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef data fill:#D5F5E3,stroke:#1E8449,stroke-width:2px;
    classDef support fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
    classDef external fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;

    %% Click Events
    click CLI "https://github.com/totalopenstation/totalopenstation/blob/main/scripts/totalopenstation-cli-parser.py"
    click CLI "https://github.com/totalopenstation/totalopenstation/blob/main/scripts/totalopenstation-cli-connector.py"
    click GUI "https://github.com/totalopenstation/totalopenstation/blob/main/scripts/totalopenstation-gui.py"
    click Formats "https://github.com/totalopenstation/totalopenstation/tree/main/totalopenstation/formats/"
    click Models "https://github.com/totalopenstation/totalopenstation/tree/main/totalopenstation/models/"
    click Output "https://github.com/totalopenstation/totalopenstation/tree/main/totalopenstation/output/"
    click Utils "https://github.com/totalopenstation/totalopenstation/tree/main/totalopenstation/utils/"
    click Sample "https://github.com/totalopenstation/totalopenstation/tree/main/sample_data/"
    click Resources "https://github.com/totalopenstation/totalopenstation/tree/main/data/"
    click Tests "https://github.com/totalopenstation/totalopenstation/tree/main/totalopenstation/tests/"
    click Docs "https://github.com/totalopenstation/totalopenstation/tree/main/docs/"
    click CI "https://github.com/totalopenstation/totalopenstation/tree/main/.github/"
```
