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
+4 -8
View File
@@ -1,14 +1,14 @@
"""Application-facing water-network service boundary.
The native WNDB package is organized by responsibility. This module only
combines operations that need more than one native module and re-exports the
small set of operations used by HTTP and algorithm services.
The native WNDB package is organized by responsibility. This transitional
facade re-exports the operations still consumed by HTTP endpoints. Application
services and algorithms depend on their explicit native/repository modules.
"""
from typing import Any
import app.infra.epanet as epanet
from app.algorithms.water_demand import (
from app.services.demand_allocation import (
calculate_demand_to_network,
calculate_demand_to_nodes,
calculate_demand_to_region,
@@ -234,10 +234,6 @@ def run_inp(name: str) -> str:
return epanet.run_inp(name)
def dump_output(path: str) -> str:
return epanet.dump_output(path)
def get_node_properties(name: str, node_id: str) -> dict[str, Any]:
if is_junction(name, node_id):
return get_junction(name, node_id)