refactor(backend)!: separate algorithm and data layers

Reorganize algorithm packages by business responsibility, move orchestration into services, and keep database access behind pooled repositories.

Harden analysis API validation, remove unsafe legacy simulation endpoints, and add regression and architecture boundary coverage.

BREAKING CHANGE: legacy algorithm module paths and obsolete simulation endpoints are removed.
This commit is contained in:
2026-09-04 17:30:55 +08:00
parent 9b095c7439
commit 5966d039de
91 changed files with 1418 additions and 4020 deletions
+20
View File
@@ -0,0 +1,20 @@
import pytest
from app.algorithms.dma_leakage_estimation.genetic_optimizer import DmaLeakageOptimizer
@pytest.mark.parametrize(
("unit", "expected"),
[
("m3/s", 1.0),
("m³/s", 1.0),
("m3/h", 3600.0),
("m³/h", 3600.0),
],
)
def test_dma_leakage_optimizer_accepts_display_flow_units(unit, expected):
assert DmaLeakageOptimizer._flow_from_m3s(1.0, unit) == expected
def test_dma_leakage_optimizer_accepts_display_flow_units_for_input():
assert DmaLeakageOptimizer._flow_to_m3s(3600.0, "m³/h") == 1.0