# blazekwastaken/mpk-lodz-parser-net architecture

> Architecture diagram of the GitHub repository blazekwastaken/mpk-lodz-parser-net, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/blazekwastaken/mpk-lodz-parser-net
- Repository: https://github.com/blazekwastaken/mpk-lodz-parser-net

## Overview

##### Project type and purpose
- This is a .NET class‐library/console‐tool (“mpk-lodz-parser-net”) whose job is to fetch, parse, model and persist public-transport timetable and vehicle data for the city of Łódź (MPK).
- There are no UI layers. It is essentially an open-source parser/tool that exposes managers to consume timetable data and persists it via an Entity Framework Core context.

##### File structure
- Top level:
- mpk-lodz-parser-net.infrastructure
- mpk-lodz-parser-net (core)
- infrastructure:
- Interfaces (IStopRepository, IVehicleRepository)
- Model (EF entities: Stop, Vehicle)
- Repositories (StopRepository, VehicleRepository)
- MpkContext.cs (DbContext)
- core project:
- Helpers/RequestHelper.cs (HTTP client wrapper)
- Managers (DepartureManager, StopManager, TimetableManager, VehicleManager)
- Model (Departure, Schedule)
- No frontend or microservices; it’s a single solution with two projects (layers).

##### README for additional insights
- The README is minimal; no architectural hints beyond the name. We infer from code that it talks to an external MPK API, parses JSON/XML, exposes typed models and persists them.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External
    API["External MPK API"]:::external

    %% Core Layer
    subgraph "Core Layer"
        RH["RequestHelper"]:::helper
        subgraph "Managers"
            SM["StopManager"]:::manager
            VM["VehicleManager"]:::manager
            TM["TimetableManager"]:::manager
            DM["DepartureManager"]:::manager
        end
        subgraph "Domain Models"
            Dep["Departure"]:::model
            Sch["Schedule"]:::model
        end
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        subgraph "Repository Interfaces"
            IStop["IStopRepository"]:::interface
            IVeh["IVehicleRepository"]:::interface
        end
        subgraph "Repository Implementations"
            SRep["StopRepository"]:::repository
            VRep["VehicleRepository"]:::repository
        end
        subgraph "EF Entities"
            StopEnt["Stop (EF Entity)"]:::entity
            VehEnt["Vehicle (EF Entity)"]:::entity
        end
        MC["MpkContext (DbContext)"]:::dbcontext
    end

    %% Database
    DB["Relational Database"]:::database

    %% Connections
    API -->|"Fetch data"| RH
    RH -->|"Return data"| SM
    RH -->|"Return data"| VM
    RH -->|"Return data"| TM
    RH -->|"Return data"| DM

    SM -->|"Use Domain Models"| Dep
    VM -->|"Use Domain Models"| Dep
    VM -->|"Use Domain Models"| Sch
    TM -->|"Use Domain Models"| Sch
    DM -->|"Use Domain Models"| Dep

    SM -->|"Call IStopRepository"| IStop
    VM -->|"Call IVehicleRepository"| IVeh
    TM -->|"Call IStopRepository"| IStop
    TM -->|"Call IVehicleRepository"| IVeh
    DM -->|"Call IStopRepository"| IStop

    IStop -->|"Implemented by"| SRep
    IVeh -->|"Implemented by"| VRep

    SRep -->|"CRUD via DbContext"| MC
    VRep -->|"CRUD via DbContext"| MC

    MC -->|"Maps Entities"| StopEnt
    MC -->|"Maps Entities"| VehEnt
    MC -->|"Executes SQL"| DB

    %% Click Events
    click RH "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net/Helpers/RequestHelper.cs"
    click SM "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net/Managers/StopManager.cs"
    click VM "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net/Managers/VehicleManager.cs"
    click TM "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net/Managers/TimetableManager.cs"
    click DM "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net/Managers/DepartureManager.cs"
    click Dep "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net/Model/Departure.cs"
    click Sch "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net/Model/Schedule.cs"
    click IStop "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net.infrastructure/Interfaces/IStopRepository.cs"
    click IVeh "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net.infrastructure/Interfaces/IVehicleRepository.cs"
    click SRep "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net.infrastructure/Repositories/StopRepository.cs"
    click VRep "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net.infrastructure/Repositories/VehicleRepository.cs"
    click MC "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net.infrastructure/MpkContext.cs"
    click StopEnt "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net.infrastructure/Model/Stop.cs"
    click VehEnt "https://github.com/blazekwastaken/mpk-lodz-parser-net/blob/main/mpk-lodz-parser-net.infrastructure/Model/Vehicle.cs"

    %% Styles
    classDef external fill:#cce5ff,stroke:#004085,color:#004085
    classDef helper fill:#e2e3e5,stroke:#383d41,color:#383d41
    classDef manager fill:#d4edda,stroke:#155724,color:#155724
    classDef model fill:#d1ecf1,stroke:#0c5460,color:#0c5460
    classDef interface fill:#fff3cd,stroke:#856404,color:#856404
    classDef repository fill:#fff3cd,stroke:#856404,color:#856404
    classDef entity fill:#f8d7da,stroke:#721c24,color:#721c24
    classDef dbcontext fill:#f8d7da,stroke:#721c24,color:#721c24
    classDef database fill:#f5c6cb,stroke:#721c24,color:#721c24
```
