# salah1892/smartplanif.blazoralns architecture

> Architecture diagram of the GitHub repository salah1892/smartplanif.blazoralns, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/salah1892/smartplanif.blazoralns
- Repository: https://github.com/salah1892/smartplanif.blazoralns

## Overview

SmartPlanif is a Blazor application for allocating buses, drivers, and receivers to daily trips under configurable hard and soft constraints. Users configure policy or preview feasibility, then request an allocation: the application orchestrates data loading, phased construction, ALNS improvement, completion, and independent validation before presenting the plan and diagnostics. Infrastructure supports demo and MySQL data plus JSON settings. The README documents the main capabilities and layer direction; several UI and persistence connections are therefore documented or left unverified because their implementation was not excerpted.

Main entry points: [`src/SmartPlanif.Application/UseCases/AllocateDay.cs`](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Application/UseCases/AllocateDay.cs) (Allocate day), [`src/SmartPlanif.Infrastructure/DependencyInjection.cs`](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/DependencyInjection.cs) (Infrastructure wiring), [`src/SmartPlanif.Web`](https://github.com/salah1892/smartplanif.blazoralns/tree/main/src/SmartPlanif.Web) (Blazor UI), [`src/SmartPlanif.Domain/Allocation/TripAllocator.cs`](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/TripAllocator.cs) (Trip allocator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_blazor["Blazor UI<br/>[SmartPlanif.Web]"]
  node_ui_support["UI support<br/>[UiSupport.cs]"]
end

subgraph group_application["Application use cases"]
  node_allocate_day["Allocate day<br/>[AllocateDay.cs]"]
  node_preview_day["Preview feasibility<br/>[PreviewDay.cs]"]
  node_settings_service["Settings service"]
  node_ports["Repository ports<br/>[Ports.cs]"]
end

subgraph group_domain["Allocation domain"]
  node_policy["Allocation policy"]
  node_constraint_catalog["Constraint catalog"]
  node_trip_allocator["Trip allocator<br/>[TripAllocator.cs]"]
  node_feasibility["Feasibility analysis"]
  node_rules["Hard and soft rules<br/>[Rules]"]
  node_plan_state["Plan state<br/>[AllocationState.cs]"]
  node_schedules["Resource schedules<br/>[ScheduleBook.cs]"]
  node_alns["ALNS improver<br/>[AlnsImprover.cs]"]
  node_objective["Plan objective"]
  node_completion["Plan completion<br/>[PlanCompleter.cs]"]
  node_validation["Plan validation<br/>[PlanValidator.cs]"]
end

subgraph group_infrastructure["Data infrastructure"]
  node_demo_store[("Demo data<br/>[DemoDataStore.cs]")]
  node_mysql_trips[("MySQL trip data")]
  node_mysql_resources[("MySQL resources")]
  node_mysql_assignments[("MySQL assignments")]
  node_mysql_reference[("MySQL reference data")]
  node_settings_store["JSON settings store"]
  node_di["Infrastructure wiring"]
end

node_planner(("Planner user"))

node_planner -->|"configures and requests"| node_blazor
node_blazor -.->|"requests allocation"| node_allocate_day
node_blazor -.->|"requests preview"| node_preview_day
node_blazor -.->|"edits settings"| node_settings_service
node_allocate_day -->|"loads and saves data"| node_ports
node_preview_day -.->|"loads preview data"| node_ports
node_settings_service -->|"uses settings port"| node_ports
node_settings_service -->|"validates policy"| node_policy
node_allocate_day -->|"diagnoses feasibility"| node_feasibility
node_preview_day -->|"analyzes feasibility"| node_feasibility
node_allocate_day -->|"constructs allocation"| node_trip_allocator
node_allocate_day -->|"builds plan state"| node_plan_state
node_allocate_day -->|"improves plan"| node_alns
node_allocate_day -->|"completes plan"| node_completion
node_allocate_day -->|"validates result"| node_validation
node_trip_allocator -->|"builds rule sets"| node_constraint_catalog
node_constraint_catalog -->|"creates configured rules"| node_rules
node_trip_allocator -->|"checks and commits"| node_schedules
node_alns -->|"repairs candidates"| node_trip_allocator
node_alns -->|"scores candidates"| node_objective
node_alns -->|"copies and improves"| node_plan_state
node_completion -->|"assigns remaining trips"| node_trip_allocator
node_allocate_day -.->|"loads demo data"| node_demo_store
node_allocate_day -.->|"loads trip data"| node_mysql_trips
node_allocate_day -.->|"loads resources"| node_mysql_resources
node_allocate_day -.->|"loads assignments"| node_mysql_assignments
node_allocate_day -.->|"loads reference data"| node_mysql_reference
node_settings_service -.->|"persists policy"| node_settings_store
node_di -->|"registers demo store"| node_demo_store
node_di -->|"registers repository"| node_mysql_trips
node_di -->|"registers repository"| node_mysql_resources
node_di -->|"registers repository"| node_mysql_assignments
node_di -->|"registers repository"| node_mysql_reference
node_di -->|"registers store"| node_settings_store
node_di -->|"implements ports"| node_ports
node_blazor -.->|"uses UI helpers"| node_ui_support

click node_blazor "https://github.com/salah1892/smartplanif.blazoralns/tree/main/src/SmartPlanif.Web"
click node_ui_support "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Web/Services/UiSupport.cs"
click node_allocate_day "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Application/UseCases/AllocateDay.cs"
click node_preview_day "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Application/UseCases/PreviewDay.cs"
click node_settings_service "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Application/UseCases/AllocationSettingsService.cs"
click node_ports "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Application/Abstractions/Ports.cs"
click node_policy "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/AllocationPolicy.cs"
click node_constraint_catalog "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Constraints/ConstraintCatalog.cs"
click node_trip_allocator "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/TripAllocator.cs"
click node_feasibility "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/FeasibilityAnalyzer.cs"
click node_rules "https://github.com/salah1892/smartplanif.blazoralns/tree/main/src/SmartPlanif.Domain/Rules"
click node_plan_state "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/AllocationState.cs"
click node_schedules "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Scheduling/ScheduleBook.cs"
click node_alns "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Alns/AlnsImprover.cs"
click node_objective "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/ObjectiveFunction.cs"
click node_completion "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/PlanCompleter.cs"
click node_validation "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/PlanValidator.cs"
click node_demo_store "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/InMemory/DemoDataStore.cs"
click node_mysql_trips "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/MySql/MySqlTripRepository.cs"
click node_mysql_resources "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/MySql/MySqlResourceRepository.cs"
click node_mysql_assignments "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/MySql/MySqlAssignmentRepository.cs"
click node_mysql_reference "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/MySql/MySqlReferenceDataRepository.cs"
click node_settings_store "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/Settings/JsonAllocationSettingsStore.cs"
click node_di "https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/DependencyInjection.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_blazor,node_ui_support,node_planner toneBlue
class node_allocate_day,node_preview_day,node_settings_service,node_ports toneAmber
class node_policy,node_constraint_catalog,node_trip_allocator,node_feasibility,node_rules,node_plan_state,node_schedules,node_alns,node_objective,node_completion,node_validation toneMint
class node_demo_store,node_mysql_trips,node_mysql_resources,node_mysql_assignments,node_mysql_reference,node_settings_store,node_di toneRose
```

## Components

### Web interface

- [Blazor UI](https://github.com/salah1892/smartplanif.blazoralns/tree/main/src/SmartPlanif.Web): `src/SmartPlanif.Web`
- [UI support](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Web/Services/UiSupport.cs): `src/SmartPlanif.Web/Services/UiSupport.cs`

### Application use cases

- [Allocate day](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Application/UseCases/AllocateDay.cs): `src/SmartPlanif.Application/UseCases/AllocateDay.cs`
- [Preview feasibility](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Application/UseCases/PreviewDay.cs): `src/SmartPlanif.Application/UseCases/PreviewDay.cs`
- [Settings service](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Application/UseCases/AllocationSettingsService.cs): `src/SmartPlanif.Application/UseCases/AllocationSettingsService.cs`
- [Repository ports](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Application/Abstractions/Ports.cs): `src/SmartPlanif.Application/Abstractions/Ports.cs`

### Allocation domain

- [Allocation policy](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/AllocationPolicy.cs): `src/SmartPlanif.Domain/Allocation/AllocationPolicy.cs`
- [Constraint catalog](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Constraints/ConstraintCatalog.cs): `src/SmartPlanif.Domain/Constraints/ConstraintCatalog.cs`
- [Trip allocator](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/TripAllocator.cs): `src/SmartPlanif.Domain/Allocation/TripAllocator.cs`
- [Feasibility analysis](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/FeasibilityAnalyzer.cs): `src/SmartPlanif.Domain/Allocation/FeasibilityAnalyzer.cs`
- [Hard and soft rules](https://github.com/salah1892/smartplanif.blazoralns/tree/main/src/SmartPlanif.Domain/Rules): `src/SmartPlanif.Domain/Rules`
- [Plan state](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/AllocationState.cs): `src/SmartPlanif.Domain/Allocation/AllocationState.cs`
- [Resource schedules](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Scheduling/ScheduleBook.cs): `src/SmartPlanif.Domain/Scheduling/ScheduleBook.cs`
- [ALNS improver](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Alns/AlnsImprover.cs): `src/SmartPlanif.Domain/Alns/AlnsImprover.cs`
- [Plan objective](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/ObjectiveFunction.cs): `src/SmartPlanif.Domain/Allocation/ObjectiveFunction.cs`
- [Plan completion](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/PlanCompleter.cs): `src/SmartPlanif.Domain/Allocation/PlanCompleter.cs`
- [Plan validation](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Domain/Allocation/PlanValidator.cs): `src/SmartPlanif.Domain/Allocation/PlanValidator.cs`

### Data infrastructure

- [Demo data](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/InMemory/DemoDataStore.cs): `src/SmartPlanif.Infrastructure/InMemory/DemoDataStore.cs`
- [MySQL trip data](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/MySql/MySqlTripRepository.cs): `src/SmartPlanif.Infrastructure/MySql/MySqlTripRepository.cs`
- [MySQL resources](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/MySql/MySqlResourceRepository.cs): `src/SmartPlanif.Infrastructure/MySql/MySqlResourceRepository.cs`
- [MySQL assignments](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/MySql/MySqlAssignmentRepository.cs): `src/SmartPlanif.Infrastructure/MySql/MySqlAssignmentRepository.cs`
- [MySQL reference data](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/MySql/MySqlReferenceDataRepository.cs): `src/SmartPlanif.Infrastructure/MySql/MySqlReferenceDataRepository.cs`
- [JSON settings store](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/Settings/JsonAllocationSettingsStore.cs): `src/SmartPlanif.Infrastructure/Settings/JsonAllocationSettingsStore.cs`
- [Infrastructure wiring](https://github.com/salah1892/smartplanif.blazoralns/blob/main/src/SmartPlanif.Infrastructure/DependencyInjection.cs): `src/SmartPlanif.Infrastructure/DependencyInjection.cs`

### Other components

- **Planner user**

## Connections

- Planner user → Blazor UI: configures and requests (evidence: `README.md`)
- Blazor UI → Allocate day: requests allocation
- Blazor UI → Preview feasibility: requests preview
- Blazor UI → Settings service: edits settings
- Allocate day → Repository ports: loads and saves data (evidence: `src/SmartPlanif.Application/UseCases/AllocateDay.cs`)
- Preview feasibility → Repository ports: loads preview data
- Settings service → Repository ports: uses settings port (evidence: `src/SmartPlanif.Application/UseCases/AllocationSettingsService.cs`)
- Settings service → Allocation policy: validates policy (evidence: `src/SmartPlanif.Application/UseCases/AllocationSettingsService.cs`)
- Allocate day → Feasibility analysis: diagnoses feasibility (evidence: `src/SmartPlanif.Application/UseCases/AllocateDay.cs`)
- Preview feasibility → Feasibility analysis: analyzes feasibility (evidence: `src/SmartPlanif.Application/UseCases/PreviewDay.cs`)
- Allocate day → Trip allocator: constructs allocation (evidence: `src/SmartPlanif.Application/UseCases/AllocateDay.cs`)
- Allocate day → Plan state: builds plan state (evidence: `src/SmartPlanif.Application/UseCases/AllocateDay.cs`)
- Allocate day → ALNS improver: improves plan (evidence: `src/SmartPlanif.Application/UseCases/AllocateDay.cs`)
- Allocate day → Plan completion: completes plan (evidence: `src/SmartPlanif.Application/UseCases/AllocateDay.cs`)
- Allocate day → Plan validation: validates result (evidence: `src/SmartPlanif.Application/UseCases/AllocateDay.cs`)
- Trip allocator → Constraint catalog: builds rule sets (evidence: `src/SmartPlanif.Domain/Allocation/TripAllocator.cs`)
- Constraint catalog → Hard and soft rules: creates configured rules (evidence: `src/SmartPlanif.Domain/Constraints/ConstraintCatalog.cs`)
- Trip allocator → Resource schedules: checks and commits (evidence: `src/SmartPlanif.Domain/Allocation/TripAllocator.cs`)
- ALNS improver → Trip allocator: repairs candidates (evidence: `src/SmartPlanif.Domain/Alns/AlnsImprover.cs`)
- ALNS improver → Plan objective: scores candidates (evidence: `src/SmartPlanif.Domain/Alns/AlnsImprover.cs`)
- ALNS improver → Plan state: copies and improves (evidence: `src/SmartPlanif.Domain/Alns/AlnsImprover.cs`)
- Plan completion → Trip allocator: assigns remaining trips (evidence: `src/SmartPlanif.Domain/Allocation/PlanCompleter.cs`)
- Allocate day → Demo data: loads demo data
- Allocate day → MySQL trip data: loads trip data
- Allocate day → MySQL resources: loads resources
- Allocate day → MySQL assignments: loads assignments
- Allocate day → MySQL reference data: loads reference data
- Settings service → JSON settings store: persists policy
- Infrastructure wiring → Demo data: registers demo store (evidence: `src/SmartPlanif.Infrastructure/DependencyInjection.cs`)
- Infrastructure wiring → MySQL trip data: registers repository (evidence: `src/SmartPlanif.Infrastructure/DependencyInjection.cs`)
- Infrastructure wiring → MySQL resources: registers repository (evidence: `src/SmartPlanif.Infrastructure/DependencyInjection.cs`)
- Infrastructure wiring → MySQL assignments: registers repository (evidence: `src/SmartPlanif.Infrastructure/DependencyInjection.cs`)
- Infrastructure wiring → MySQL reference data: registers repository (evidence: `src/SmartPlanif.Infrastructure/DependencyInjection.cs`)
- Infrastructure wiring → JSON settings store: registers store (evidence: `src/SmartPlanif.Infrastructure/DependencyInjection.cs`)
- Infrastructure wiring → Repository ports: implements ports (evidence: `src/SmartPlanif.Infrastructure/DependencyInjection.cs`)
- Blazor UI → UI support: uses UI helpers
