# iccmu/leximus architecture

> Architecture diagram of the GitHub repository iccmu/leximus, 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/iccmu/leximus
- Repository: https://github.com/iccmu/leximus

## Overview

##### Main Components
- Frontend Interface: Indicated by the “templates” and “static” folders within versions (e.g., V5 and v6). This includes:
– The visual panels: visualization panel (the hierarchical/pyramidal view), node information panel, panel for properties, a metadata editor, and a YAML/JSON viewer.
– The drag & drop functionality for reordering nodes.
- Backend Logic: Found in files such as V5/main.py and v6/main.py. This handles:
– Conversion between YAML and JSON representations.
– Management of the taxonomic data structure (nodes, metadata, and properties).
– Invoking export functionality to convert the ontology into OWL.
- Data Storage: The data files (such as the DATA folder with JSON and CSV files) and additional configuration in various version folders hold the data models:
– The node structure and dictionary of metadata.
– Registries for the properties assigned to each node.
- API Integration for OWL Export: Mentioned in the README with a service available at http://localhost:8000 that converts the taxonomy data to OWL.

##### Out Relationships and Interactions
- The End-User interacts with the frontend UI through a modern browser (supporting JavaScript ES6+), initiating actions (drag & drop, selecting nodes, editing metadata).
- The frontend communicates with the Python backend (via main.py) where business logic processes the changes, updates data structures, and converts data between YAML/JSON formats.
- When the user triggers an export, the backend calls the external API (OWL export) to transform the data into OWL standard.
- The data persistence layer (reading/writing to JSON, CSV, YAML files, etc.) underpins both the backend processing and the visual feedback provided to the user.

##### Important Architectural Patterns
- Separation of Concerns: Clear distinction between presentation (HTML/CSS/JS in static and templates folders), application logic (Python scripts in V5 and v6), and data management (files in DATA, v6/data, etc.).
- Modular Design: Different folders (v1, v2, v3, v4, v6) indicate iterative versions that likely incorporate improvements or features incrementally.
- MVC-Like Approach (or close approximation): The “view” is rendered by the frontend templates, the “controller” lies in the main.py scripts, and the “model” is represented by the JSON, YAML, and CSV representations of the taxonomy.

##### Relevant Technologies
- Web technologies: HTML, CSS, JavaScript (for the drag & drop and visual editing components).
- Python: Backend scripts that process data and interface with the API.
- Formats and Standards: YAML, JSON, OWL, and possibly RDF for semantic integration.
- External API for conversion: The system calls an export endpoint (likely HTTP-based) to generate OWL output.

- Important frameworks or libraries you identify (e.g., JavaScript libraries for drag & drop if mentioned in the templates, and Python’s framework for serving the web pages).

##### Essential Elements
– Frontend presentation logic.
– User action handling and data validation.
– Backend processing and conversion services.
– Data storage and persistence.
– Integration with external services (OWL export API).
- This approach will help in clarifying the responsibilities of each module and the flow of control and data through the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U("User Browser (End-User)"):::user

    subgraph "Taxonomy Editor UI (Frontend)"
        FE1("Visualization Panel"):::frontend
        FE2("Node Info Panel"):::frontend
        FE3("Metadata Editor"):::frontend
        FE4("Properties Manager"):::frontend
        FE5("YAML/JSON Viewer"):::frontend
        FE6("Drag & Drop Handler"):::frontend
    end

    subgraph "Python Application Logic (Backend)"
        B("Process Logic"):::backend
        BE1("V5/main.py"):::backendFile
        BE2("v6/main.py"):::backendFile
        BE3("v4/main.py"):::backendFile
        B --- BE1
        B --- BE2
        B --- BE3
    end

    subgraph "Data Storage (Persistence Layer)"
        DS1("DATA"):::data
        DS2("v6/data"):::data
    end

    D("OWL Export API"):::external

    U -->|"interacts"| FE1
    FE1 -->|"sends_updates"| B
    B -->|"read/write_data"| DS1
    B -->|"calls_export"| D

    %% Click Events for Frontend
    click FE1 "https://github.com/iccmu/leximus/tree/main/V5/templates"
    click FE2 "https://github.com/iccmu/leximus/tree/main/V5/static"
    click FE3 "https://github.com/iccmu/leximus/tree/main/v6/templates"

    %% Click Events for Backend
    click BE1 "https://github.com/iccmu/leximus/blob/main/V5/main.py"
    click BE2 "https://github.com/iccmu/leximus/blob/main/v6/main.py"
    click BE3 "https://github.com/iccmu/leximus/blob/main/v4/main.py"

    %% Click Events for Data Storage
    click DS1 "https://github.com/iccmu/leximus/tree/main/DATA"
    click DS2 "https://github.com/iccmu/leximus/tree/main/v6/data"

    %% Click Event for External API Integration
    click D "https://github.com/iccmu/leximus/tree/main/V5/user_folders/UCM"

    %% Styles
    classDef user fill:#ffdecc,stroke:#b36100,stroke-width:2px;
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef backendFile fill:#bbf0c0,stroke:#0b6623,stroke-width:2px;
    classDef data fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
