# crovitche-1623/swiss-geo-bundle architecture

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

- Interactive diagram: https://gitdiagram.com/crovitche-1623/swiss-geo-bundle
- Repository: https://github.com/crovitche-1623/swiss-geo-bundle

## Overview

- Command Layer → External Data Source
- External Data Source → Import Services
- Import Services → Database
- Database → Meilisearch

- API Controllers → Repositories
- Repositories → Database
- API Controllers → Meilisearch (for search operations)

##### Key Services (Use rounded rectangles)

a. Import Services:
- ZipArchive Services
- Cache Services
- Import Commands
- Meilisearch Document Generator

##### Specific Implementation Details

- [External Systems Layer]
- ↓
- [API Controllers Layer]
- ↓
- [Services Layer]
- ↓
- [Entity/Repository Layer]
- ↓
- [Storage Layer]

##### Important Elements

a. Configuration:
- Config/services.yaml connection
- Symfony bundle integration points

b. Data Flow Processes:
- Import process flow
- Search query flow
- Address validation flow

##### Technical Specifications to Note

- PHP 8.1+ requirement
- MySQL 8.0+ requirement
- Meilisearch v1.5 requirement
- Symfony/Doctrine dependencies

##### Integration Points

Clear connection points for:
- Host application integration
- Database connections
- Meilisearch integration
- External data source connections

Use these visual conventions:
- Double lines: Data transformation flows

Keep the following aspects in mind:

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        DB[(MySQL)]
        MS[Meilisearch Server]
        EDS[External Data Source]
        HA[Host Application]
    end

    subgraph API["API Controller Layer"]
        BAC["Building Address API"]:::controller
        LC["Locality API"]:::controller
        SC["Street API"]:::controller
        RC["Region API"]:::controller
    end

    subgraph Services["Services Layer"]
        subgraph ImportServices["Import Services"]
            ZAS["ZipArchive Service"]:::service
            CS["Cache Services"]:::service
            IC["Import Commands"]:::service
            MDG["Meilisearch Document Generator"]:::service
        end
    end

    subgraph Data["Entity & Repository Layer"]
        subgraph Entities["Entity Layer"]
            BA["BuildingAddress"]:::entity
            L["Locality"]:::entity
            S["Street"]:::entity
            SL["StreetLocality"]:::entity
            LV["LV95Coordinates"]:::entity
        end

        subgraph Repositories["Repository Layer"]
            BAR["BuildingAddress Repository"]:::repo
            LR["Locality Repository"]:::repo
            SR["Street Repository"]:::repo
            RR["Region Repository"]:::repo
        end
    end

    subgraph Forms["Form Layer"]
        BAF["BuildingAddress Form"]:::form
        RF["Region Form"]:::form
        RET["Remote Entity Type"]:::form
    end

    %% Connections
    EDS --> IC
    IC --> DB
    DB --> MS
    BAC --> BAR
    LC --> LR
    SC --> SR
    RC --> RR
    BAR --> DB
    LR --> DB
    SR --> DB
    RR --> DB
    BAC --> MS
    LC --> MS
    SC --> MS
    RC --> MS

    %% Click Events
    click BAC "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Controller/Api/BuildingAddressApiController.php"
    click LC "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Controller/Api/LocalityApiController.php"
    click SC "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Controller/Api/StreetApiController.php"
    click RC "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Controller/Api/RegionApiController.php"
    
    click ZAS "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Command/Service/ZipArchive/Extractor.php"
    click CS "https://github.com/Crovitche-1623/swiss-geo-bundle/tree/master/src/Command/Service/Cache/"
    click IC "https://github.com/Crovitche-1623/swiss-geo-bundle/tree/master/src/Command/Import/"
    click MDG "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Command/Import/Meilisearch/GenerateDocumentCommand.php"
    
    click BA "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Entity/BuildingAddress.php"
    click L "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Entity/Locality.php"
    click S "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Entity/Street.php"
    click SL "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Entity/StreetLocality.php"
    click LV "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Entity/LV95Coordinates.php"
    
    click BAR "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Repository/BuildingAddressRepository.php"
    click LR "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Repository/LocalityRepository.php"
    click SR "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Repository/StreetRepository.php"
    click RR "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Repository/RegionRepository.php"
    
    click BAF "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Form/BuildingAddressType.php"
    click RF "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Form/RegionType.php"
    click RET "https://github.com/Crovitche-1623/swiss-geo-bundle/blob/master/src/Form/Type/RemoteEntityType.php"

    %% Styling
    classDef controller fill:#f96,stroke:#333
    classDef service fill:#9cf,stroke:#333
    classDef entity fill:#fcf,stroke:#333
    classDef repo fill:#cf9,stroke:#333
    classDef form fill:#ccc,stroke:#333

    %% Legend
    subgraph Legend
        C1[API Controller]:::controller
        S1[Service]:::service
        E1[Entity]:::entity
        R1[Repository]:::repo
        F1[Form]:::form
    end
```
