# davidfokkema/tailor architecture

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

- Interactive diagram: https://gitdiagram.com/davidfokkema/tailor
- Repository: https://github.com/davidfokkema/tailor

## Overview

##### Main Components Identification
The system should be represented with these primary components:

a. User Interface Layer
- Data Sheet Module (spreadsheet interface)
- Plot Interface Module
- Dialog System
- Multi-plot System

b. Data Management Layer
- Data Model
- Project File Handler
- CSV Import/Export Handler

c. Analysis Engine
- Curve Fitting Engine
- Mathematical Expression Parser
- Parameter Management System

d. Resource Management
- UI Resources (*.ui files)
- Configuration Management

##### Detailed Component Breakdown

User Interface Layer:
**┌─ UI Layer ─────────────────┐**
- ┌─ Data Sheet ─┐ ┌─ Plot ─┐│
- Spreadsheet  │ │Viewer │││
- Editor       │ │Fitter │││
- ┘ └───────┘││
- ┌─ Dialogs ────┐          │
- CSV Format   │          │
- Data Source  │          │
- ┘          │
- ┘

Data Management Layer:
**┌─ Data Management ──────────┐**
- ┌─ Models ────┐ ┌─ I/O ──┐│
- Data Model  │ │Project ││
- Plot Model  │ │CSV    │││
- Multiplot   │ │Export │││
- ┘ └───────┘││
- ┘

##### Technology Stack Representation

- Python (core language)
- Qt/PyQt (UI framework)
- NumPy/SciPy (for calculations)
- Briefcase (deployment)

**┌─ Presentation Layer ─┐**
- (UI Components)  │
- ┐ │
- Business Logic    │ │
- (Data Processing) │ │
- ┤ │
- Data Management   │ │
- (Models & Storage)│ │
- ┘ │

##### Additional Notes

- Version information
- External dependencies
- File format support (.tlr, .csv, .png, .pdf)

Remember to include the build and deployment pipeline (represented by the .github/workflows directory) as a separate section, showing how the application is packaged for different platforms.

This structure reflects Tailor's nature as a desktop scientific application with a focus on data analysis and visualization, while maintaining clear separation of concerns between UI, data management, and analysis components.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI_Layer
        DataSheet["Data Sheet Module"]:::ui
        PlotInterface["Plot Interface Module"]:::ui
        MultiPlot["Multi-plot System"]:::ui
        DialogSystem["Dialog System"]:::ui
    end

    subgraph Data_Management
        DataModel["Data Model"]:::data
        ProjectHandler["Project File Handler"]:::data
        CSVHandler["CSV Import/Export"]:::data
        PlotModel["Plot Model"]:::data
        MultiplotModel["Multiplot Model"]:::data
        ProjectModels["Project Models"]:::data
    end

    subgraph Analysis_Engine
        CurveFitting["Curve Fitting Engine"]:::analysis
        MathParser["Math Expression Parser"]:::analysis
        ParamManager["Parameter Management"]:::analysis
    end

    subgraph Resource_Management
        UIResources["UI Resources"]:::resource
        IconsAssets["Icons and Assets"]:::resource
        Config["Configuration Management"]:::resource
    end

    subgraph External_Dependencies
        Python["Python Core"]:::external
        Qt["Qt/PyQt"]:::external
        NumPy["NumPy/SciPy"]:::external
        Briefcase["Briefcase"]:::external
    end

    %% Relationships
    DataSheet --> DataModel
    PlotInterface --> PlotModel
    MultiPlot --> MultiplotModel
    DialogSystem --> CSVHandler
    
    DataModel --> ProjectHandler
    PlotModel --> ProjectHandler
    MultiplotModel --> ProjectHandler
    
    PlotInterface --> CurveFitting
    CurveFitting --> MathParser
    CurveFitting --> ParamManager
    
    DataSheet -.-> UIResources
    PlotInterface -.-> UIResources
    MultiPlot -.-> UIResources
    DialogSystem -.-> UIResources
    
    %% External Dependencies
    Python --> DataModel
    Qt --> UI_Layer
    NumPy --> Analysis_Engine
    Briefcase --> Resource_Management

    %% Click Events
    click DataSheet "https://github.com/davidfokkema/tailor/blob/main/src/tailor/data_sheet.py"
    click PlotInterface "https://github.com/davidfokkema/tailor/blob/main/src/tailor/plot_tab.py"
    click MultiPlot "https://github.com/davidfokkema/tailor/blob/main/src/tailor/multiplot_tab.py"
    click DialogSystem "https://github.com/davidfokkema/tailor/blob/main/src/tailor/dialogs.py"
    click DataModel "https://github.com/davidfokkema/tailor/blob/main/src/tailor/data_model.py"
    click ProjectHandler "https://github.com/davidfokkema/tailor/blob/main/src/tailor/project_files.py"
    click CSVHandler "https://github.com/davidfokkema/tailor/blob/main/src/tailor/csv_format_dialog.py"
    click UIResources "https://github.com/davidfokkema/tailor/tree/main/src/tailor/resources/"
    click Config "https://github.com/davidfokkema/tailor/blob/main/src/tailor/config.py"
    click ProjectModels "https://github.com/davidfokkema/tailor/blob/main/src/tailor/project_models.py"
    click PlotModel "https://github.com/davidfokkema/tailor/blob/main/src/tailor/plot_model.py"
    click MultiplotModel "https://github.com/davidfokkema/tailor/blob/main/src/tailor/multiplot_model.py"
    click IconsAssets "https://github.com/davidfokkema/tailor/blob/main/src/tailor/resources/tailor.icns"

    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef data fill:#2ecc71,stroke:#27ae60,color:white
    classDef analysis fill:#f1c40f,stroke:#f39c12,color:black
    classDef resource fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef external fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        UI[UI Components]:::ui
        Data[Data Components]:::data
        Analysis[Analysis Components]:::analysis
        Resource[Resource Components]:::resource
        External[External Dependencies]:::external
    end
```
