# App-Kommunikation Dieses Diagramm zeigt die Kommunikation zwischen Browser, FastAPI-Backend, Job-Ablage und der Python-Optimierungspipeline. ```mermaid flowchart LR user[Benutzer im Browser] frontend[React Frontend
Vite Build / App.jsx] backend[FastAPI Backend
webapp/backend/main.py] jobs[(var/jobs
Job-Status, Uploads, Logs, Outputs)] preprocess[Preprocessing
src/preprocessing/exploration_preprocess.py] optimization[Optimierung
src/optimization/run_optimization.py] model[Pyomo Modell
src/optimization/model_builder.py] solver[Solver
HiGHS / Gurobi / SCIP] processed[(processed Parquet
Job-Verzeichnis)] output[(output.xlsx
warmstart.json)] user --> frontend frontend -->|POST /api/run
Excel + Parameter + optional Warmstart| backend backend -->|Job-Verzeichnis anlegen| jobs backend -->|Subprozess starten| preprocess preprocess -->|liest Excel
schreibt vorbereitete Tabellen| processed backend -->|Subprozess starten| optimization optimization -->|lädt Tabellen| processed optimization --> model model --> solver solver -->|Lösung| model optimization -->|Excel + Warmstart exportieren| output backend -->|Status completed / failed / cancelled| jobs frontend -->|GET /api/jobs/{job_id}| backend frontend -->|GET /api/jobs/{job_id}/logs/{name}| backend frontend -->|GET /api/jobs/{job_id}/monthly-flows| backend frontend -->|GET /api/jobs/{job_id}/capacity-timeseries| backend frontend -->|GET /api/jobs/{job_id}/output| backend frontend -->|GET /api/jobs/{job_id}/warmstart| backend frontend -->|POST /api/jobs/{job_id}/cancel| backend backend -->|liest job.json / Logs| jobs backend -->|liest output.xlsx| output backend -->|liest processed Parquet| processed ``` ## Ablauf eines Optimierungslaufs ```mermaid sequenceDiagram participant U as Benutzer participant F as React Frontend participant B as FastAPI Backend participant P as Preprocessing participant O as Optimierung participant S as Solver participant V as var/jobs U->>F: Excel-Datei und Solver-Parameter auswaehlen F->>B: POST /api/run B->>V: Job-Verzeichnis, input.xlsx, job.json anlegen B-->>F: job_id zurueckgeben B->>P: exploration_preprocess.py als Subprozess P->>V: processed/*.parquet und preprocess.log schreiben B->>O: run_optimization.py als Subprozess O->>S: Pyomo-Modell loesen S-->>O: Loesung / Status O->>V: output.xlsx, warmstart.json, optimization.log schreiben B->>V: job.json auf completed/failed/cancelled setzen loop Polling waehrend der Laufzeit F->>B: GET /api/jobs/{job_id} B-->>F: Status F->>B: GET /api/jobs/{job_id}/logs/optimization B-->>F: Logtext end F->>B: GET /api/jobs/{job_id}/monthly-flows B-->>F: Monatsfluesse fuer Plotly F->>B: GET /api/jobs/{job_id}/capacity-timeseries B-->>F: Kapazitaets-Zeitreihen fuer Plotly F->>B: GET /api/jobs/{job_id}/output B-->>F: output.xlsx Download ``` ## Deployment-Sicht ```mermaid flowchart TB subgraph docker[Docker Container leag-coallog] nginxless[FastAPI / Uvicorn
Port 8080] static[React Static Build
webapp/frontend/dist] python[Python Runtime
Preprocessing + Optimierung] gurobi[Gurobi / HiGHS / SCIP] end browser[Browser] -->|HTTP :8080| nginxless nginxless -->|liefert statische Dateien| static nginxless -->|API-Aufrufe /api/*| python python --> gurobi python --> volume[(Host Volume ./var:/app/var)] license[(Host ./licenses:/app/licenses:ro
oder GRB_WLS*)] --> gurobi ```