# TJWater Server (FastAPI) 基于 FastAPI 的水务业务服务端,提供模拟计算、SCADA 数据、网络元素、项目管理等接口。 ## 目录结构 ``` app/ main.py # FastAPI 入口(lifespan、CORS、路由挂载) api/ v1/ router.py # API 路由汇总(/api/v1 前缀) endpoints/ # 业务接口实现(auth、simulation、scada 等) endpoints/network/ # 管网要素与特性接口 endpoints/components/ # 组件/控制相关接口 services/ # 业务服务层(simulation、tjnetwork 等) infra/ db/ # 数据库访问层(timescaledb / postgresql / influxdb) cache/ # 缓存与 Redis 客户端 algorithms/ # 算法与分析模块 core/ # 配置与安全相关 configs/ project_info.yml # 默认工程配置(启动时自动打开) scripts/ run_server.py # Uvicorn 启动脚本 tests/ # 测试 ``` ## 启动方式 1. 安装依赖(示例): ```bash pip install -r requirements.txt ``` 2. 启动服务: ```bash python scripts/run_server.py ``` 默认监听:`http://0.0.0.0:8000` API 前缀:`/api/v1`(见 `app/main.py` 与 `app/api/v1/router.py`)