From 20ab08e20659c3ed27635ae6b459e52526fcbc95 Mon Sep 17 00:00:00 2001 From: Jiang Date: Mon, 9 Mar 2026 12:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=20native/api/=20=E6=94=B9=E5=90=8D?= =?UTF-8?q?=E4=B8=BA=20native/wndb/=EF=BC=8C=E9=81=BF=E5=85=8D=E4=B8=8E=20?= =?UTF-8?q?Web=20API=20=E5=B1=82=E5=91=BD=E5=90=8D=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DOCUMENTATION_INDEX.md | 4 ++-- QUICK_START_GUIDE.md | 8 ++++---- SECONDARY_DEVELOPMENT_GUIDE.md | 14 +++++++------- app/algorithms/api_ex/run_simulation.py | 2 +- app/algorithms/sensors.py | 2 +- app/algorithms/simulations.py | 2 +- app/api/v1/endpoints/extension.py | 2 +- app/api/v1/endpoints/project.py | 2 +- app/api/v1/endpoints/scada.py | 2 +- app/api/v1/endpoints/snapshots.py | 2 +- app/infra/db/influxdb/api.py | 2 +- app/infra/db/postgresql/database.py | 2 +- app/infra/db/postgresql/internal_queries.py | 2 +- app/native/{api => wndb}/__init__.py | 0 app/native/{api => wndb}/batch_api.py | 0 app/native/{api => wndb}/batch_api_cs.py | 0 app/native/{api => wndb}/batch_exe.py | 0 app/native/{api => wndb}/clean_api.py | 0 app/native/{api => wndb}/connection.py | 0 app/native/{api => wndb}/database.py | 0 app/native/{api => wndb}/extension_data.py | 0 app/native/{api => wndb}/inp_in.py | 0 app/native/{api => wndb}/inp_out.py | 0 app/native/{api => wndb}/postgresql_info.py | 0 app/native/{api => wndb}/project.py | 0 app/native/{api => wndb}/project_backup.py | 0 app/native/{api => wndb}/s0_base.py | 0 app/native/{api => wndb}/s10_status.py | 0 app/native/{api => wndb}/s11_patterns.py | 0 app/native/{api => wndb}/s12_curves.py | 0 app/native/{api => wndb}/s13_controls.py | 0 app/native/{api => wndb}/s14_rules.py | 0 app/native/{api => wndb}/s15_energy.py | 0 app/native/{api => wndb}/s16_emitters.py | 0 app/native/{api => wndb}/s17_quality.py | 0 app/native/{api => wndb}/s18_sources.py | 0 app/native/{api => wndb}/s19_reactions.py | 0 app/native/{api => wndb}/s1_title.py | 0 app/native/{api => wndb}/s20_mixing.py | 0 app/native/{api => wndb}/s21_times.py | 0 app/native/{api => wndb}/s22_report.py | 0 app/native/{api => wndb}/s23_options.py | 0 app/native/{api => wndb}/s23_options_util.py | 0 app/native/{api => wndb}/s23_options_v3.py | 0 app/native/{api => wndb}/s24_coordinates.py | 0 app/native/{api => wndb}/s25_vertices.py | 0 app/native/{api => wndb}/s26_labels.py | 0 app/native/{api => wndb}/s27_backdrop.py | 0 app/native/{api => wndb}/s28_end.py | 0 app/native/{api => wndb}/s29_scada_device.py | 0 app/native/{api => wndb}/s2_junctions.py | 0 app/native/{api => wndb}/s30_scada_device_data.py | 0 app/native/{api => wndb}/s31_scada_element.py | 0 app/native/{api => wndb}/s32_region.py | 0 app/native/{api => wndb}/s32_region_util.py | 0 app/native/{api => wndb}/s33_dma.py | 0 app/native/{api => wndb}/s33_dma_cal.py | 0 app/native/{api => wndb}/s33_dma_gen.py | 0 app/native/{api => wndb}/s34_sa.py | 0 app/native/{api => wndb}/s34_sa_cal.py | 0 app/native/{api => wndb}/s34_sa_gen.py | 0 app/native/{api => wndb}/s35_vd.py | 0 app/native/{api => wndb}/s35_vd_cal.py | 0 app/native/{api => wndb}/s35_vd_gen.py | 0 app/native/{api => wndb}/s36_wda.py | 0 app/native/{api => wndb}/s36_wda_cal.py | 0 app/native/{api => wndb}/s38_scada_info.py | 0 app/native/{api => wndb}/s39_user.py | 0 app/native/{api => wndb}/s3_reservoirs.py | 0 app/native/{api => wndb}/s40_schema.py | 0 .../{api => wndb}/s41_pipe_risk_probability.py | 0 app/native/{api => wndb}/s42_sensor_placement.py | 0 .../{api => wndb}/s43_burst_locate_result.py | 0 app/native/{api => wndb}/s4_tanks.py | 0 app/native/{api => wndb}/s5_pipes.py | 0 app/native/{api => wndb}/s6_pumps.py | 0 app/native/{api => wndb}/s7_valves.py | 0 app/native/{api => wndb}/s8_tags.py | 0 app/native/{api => wndb}/s9_demands.py | 0 app/native/{api => wndb}/sections.py | 0 app/services/epanet/epanet.py | 4 ++-- app/services/network_import.py | 2 +- app/services/scheme_management.py | 2 +- app/services/simulation.py | 4 ++-- app/services/simulation_ops.py | 2 +- app/services/tjnetwork.py | 2 +- scripts/online_Analysis.py | 4 ++-- 87 files changed, 33 insertions(+), 33 deletions(-) rename app/native/{api => wndb}/__init__.py (100%) rename app/native/{api => wndb}/batch_api.py (100%) rename app/native/{api => wndb}/batch_api_cs.py (100%) rename app/native/{api => wndb}/batch_exe.py (100%) rename app/native/{api => wndb}/clean_api.py (100%) rename app/native/{api => wndb}/connection.py (100%) rename app/native/{api => wndb}/database.py (100%) rename app/native/{api => wndb}/extension_data.py (100%) rename app/native/{api => wndb}/inp_in.py (100%) rename app/native/{api => wndb}/inp_out.py (100%) rename app/native/{api => wndb}/postgresql_info.py (100%) rename app/native/{api => wndb}/project.py (100%) rename app/native/{api => wndb}/project_backup.py (100%) rename app/native/{api => wndb}/s0_base.py (100%) rename app/native/{api => wndb}/s10_status.py (100%) rename app/native/{api => wndb}/s11_patterns.py (100%) rename app/native/{api => wndb}/s12_curves.py (100%) rename app/native/{api => wndb}/s13_controls.py (100%) rename app/native/{api => wndb}/s14_rules.py (100%) rename app/native/{api => wndb}/s15_energy.py (100%) rename app/native/{api => wndb}/s16_emitters.py (100%) rename app/native/{api => wndb}/s17_quality.py (100%) rename app/native/{api => wndb}/s18_sources.py (100%) rename app/native/{api => wndb}/s19_reactions.py (100%) rename app/native/{api => wndb}/s1_title.py (100%) rename app/native/{api => wndb}/s20_mixing.py (100%) rename app/native/{api => wndb}/s21_times.py (100%) rename app/native/{api => wndb}/s22_report.py (100%) rename app/native/{api => wndb}/s23_options.py (100%) rename app/native/{api => wndb}/s23_options_util.py (100%) rename app/native/{api => wndb}/s23_options_v3.py (100%) rename app/native/{api => wndb}/s24_coordinates.py (100%) rename app/native/{api => wndb}/s25_vertices.py (100%) rename app/native/{api => wndb}/s26_labels.py (100%) rename app/native/{api => wndb}/s27_backdrop.py (100%) rename app/native/{api => wndb}/s28_end.py (100%) rename app/native/{api => wndb}/s29_scada_device.py (100%) rename app/native/{api => wndb}/s2_junctions.py (100%) rename app/native/{api => wndb}/s30_scada_device_data.py (100%) rename app/native/{api => wndb}/s31_scada_element.py (100%) rename app/native/{api => wndb}/s32_region.py (100%) rename app/native/{api => wndb}/s32_region_util.py (100%) rename app/native/{api => wndb}/s33_dma.py (100%) rename app/native/{api => wndb}/s33_dma_cal.py (100%) rename app/native/{api => wndb}/s33_dma_gen.py (100%) rename app/native/{api => wndb}/s34_sa.py (100%) rename app/native/{api => wndb}/s34_sa_cal.py (100%) rename app/native/{api => wndb}/s34_sa_gen.py (100%) rename app/native/{api => wndb}/s35_vd.py (100%) rename app/native/{api => wndb}/s35_vd_cal.py (100%) rename app/native/{api => wndb}/s35_vd_gen.py (100%) rename app/native/{api => wndb}/s36_wda.py (100%) rename app/native/{api => wndb}/s36_wda_cal.py (100%) rename app/native/{api => wndb}/s38_scada_info.py (100%) rename app/native/{api => wndb}/s39_user.py (100%) rename app/native/{api => wndb}/s3_reservoirs.py (100%) rename app/native/{api => wndb}/s40_schema.py (100%) rename app/native/{api => wndb}/s41_pipe_risk_probability.py (100%) rename app/native/{api => wndb}/s42_sensor_placement.py (100%) rename app/native/{api => wndb}/s43_burst_locate_result.py (100%) rename app/native/{api => wndb}/s4_tanks.py (100%) rename app/native/{api => wndb}/s5_pipes.py (100%) rename app/native/{api => wndb}/s6_pumps.py (100%) rename app/native/{api => wndb}/s7_valves.py (100%) rename app/native/{api => wndb}/s8_tags.py (100%) rename app/native/{api => wndb}/s9_demands.py (100%) rename app/native/{api => wndb}/sections.py (100%) diff --git a/DOCUMENTATION_INDEX.md b/DOCUMENTATION_INDEX.md index 4e618f0..fdcde5e 100644 --- a/DOCUMENTATION_INDEX.md +++ b/DOCUMENTATION_INDEX.md @@ -149,7 +149,7 @@ |-------|------------|---------------|-----------------| | **APIs** | § 1 QSG | § 2 SDG | `app/api/v1/` | | **Database** | § 2 QSG | § 3 SDG | `app/infra/db/` | -| **Native Code** | § 4 QSG | § 4 SDG | `app/native/api/` | +| **Native Code** | § 4 QSG | § 4 SDG | `app/native/wndb/` | | **Auth** | § 3 QSG | § 5 SDG | `app/auth/` | | **Config** | § 6 QSG | § 6 SDG | `app/core/config.py` | | **Testing** | § 7 QSG | § 7 SDG | `tests/` | @@ -202,7 +202,7 @@ TJWaterServerBinary/ 5. **Permission Decorators**: See `app/auth/permissions.py` - RBAC 6. **Config Management**: See `app/core/config.py` (82 lines) - Pydantic Settings 7. **Database Pooling**: See `app/infra/db/postgresql/database.py` - async pools -8. **Native Integration**: See `app/native/api/__init__.py` - 100+ wrapped functions +8. **Native Integration**: See `app/native/wndb/__init__.py` - 100+ wrapped functions --- diff --git a/QUICK_START_GUIDE.md b/QUICK_START_GUIDE.md index 2cd3592..e5956ea 100644 --- a/QUICK_START_GUIDE.md +++ b/QUICK_START_GUIDE.md @@ -84,7 +84,7 @@ async def get_reports(user: UserInDB = Depends(require_viewer)): ## 4️⃣ Call Native (Binary) Code ```python -from app.native.api import get_all_junctions, add_junction, set_junction +from app.native.wndb import get_all_junctions, add_junction, set_junction # Read network elements junctions = get_all_junctions() @@ -96,7 +96,7 @@ add_junction({"id": "J1", "x": 0.0, "y": 0.0, "demand": 100.0}) set_junction("J1", {"demand": 150.0}) # Get constants -from app.native.api import PIPE_STATUS_OPEN, OPTION_UNITS_LPS +from app.native.wndb import PIPE_STATUS_OPEN, OPTION_UNITS_LPS ``` --- @@ -174,7 +174,7 @@ pytest tests/unit/test_my_feature.py::test_my_function -v | `app/domain/` | Models/Schemas | Data structures | | `app/infra/db/` | DB access | Queries, repositories | | `app/services/` | Business logic | Complex operations | -| `app/native/api/` | Binary functions | Network simulation | +| `app/native/wndb/` | Binary functions | Network simulation | | `app/core/` | Core utilities | Config, security, encryption | | `tests/` | Tests | Unit & integration tests | @@ -203,7 +203,7 @@ from app.core.encryption import get_encryptor from app.core.config import settings # Native API -from app.native.api import get_all_junctions, add_junction, open_project +from app.native.wndb import get_all_junctions, add_junction, open_project ``` --- diff --git a/SECONDARY_DEVELOPMENT_GUIDE.md b/SECONDARY_DEVELOPMENT_GUIDE.md index 98a2f9d..641f07f 100644 --- a/SECONDARY_DEVELOPMENT_GUIDE.md +++ b/SECONDARY_DEVELOPMENT_GUIDE.md @@ -276,7 +276,7 @@ TJWater integrates compiled C/Go binaries for water network simulation: ``` Python (FastAPI) ↓ -app/native/api/ +app/native/wndb/ ├── project.py (list, create, delete, open projects) ├── s2_junctions.py (CRUD for junctions) ├── s5_pipes.py (CRUD for pipes) @@ -290,7 +290,7 @@ app/native/api_encap/ (Low-level binary wrappers) #### 1. Native API Initialization ```python -# app/native/api/__init__.py +# app/native/wndb/__init__.py from app.native.api_encap.api import ( ChangeSet, # Change tracking API_ADD, API_UPDATE, API_DELETE, # Operations @@ -302,7 +302,7 @@ from app.native.api_encap.api import ( #### 2. Example: Project Management ```python # app/services/tjnetwork.py -from app.native.api import list_project, open_project, close_project +from app.native.wndb import list_project, open_project, close_project def list_project() -> list[str]: """List all project databases""" @@ -334,7 +334,7 @@ def update_junction(name: str, demand: float): #### 4. Network CRUD Operations ```python # All operations follow this pattern: -from app.native.api import get_all_junctions, add_junction, set_junction +from app.native.wndb import get_all_junctions, add_junction, set_junction # Read junctions = get_all_junctions() # Returns list of dicts @@ -357,7 +357,7 @@ app/api/v1/endpoints/simulation.py ↓ app/services/simulation.py (business logic) ↓ -app/native/api/ (calls binary functions) +app/native/wndb/ (calls binary functions) ├── open_project("szh") ├── set_option("QUALITY", "CHEMICAL") ├── run_simulation() @@ -372,7 +372,7 @@ Response to client Native module exports constants for enumerations: ```python -from app.native.api import ( +from app.native.wndb import ( OPTION_UNITS_LPS, # Flow units OPTION_PRESSURE_KPA, # Pressure units OPTION_QUALITY_CHEMICAL, # Quality type @@ -1004,7 +1004,7 @@ services: | **Repository** | `app/infra/repositories/` | Data access layer | psycopg cursor | | **Domain** | `app/domain/` | Models & schemas | Pydantic, Enum | | **Services** | `app/services/` | Business logic | Python, native APIs | -| **Native API** | `app/native/api/` | Binary integration | ctypes/cffi, .so/.dll | +| **Native API** | `app/native/wndb/` | Binary integration | ctypes/cffi, .so/.dll | | **Config** | `app/core/config.py` | Settings management | Pydantic Settings | | **Security** | `app/core/security.py` | Encryption, hashing | cryptography, passlib | | **Audit** | `app/infra/audit/` | Operation logging | Middleware, Repository | diff --git a/app/algorithms/api_ex/run_simulation.py b/app/algorithms/api_ex/run_simulation.py index e80a9ff..57cbd5e 100644 --- a/app/algorithms/api_ex/run_simulation.py +++ b/app/algorithms/api_ex/run_simulation.py @@ -1,6 +1,6 @@ import numpy as np from app.services.tjnetwork import * -from app.native.api.s36_wda_cal import * +from app.native.wndb.s36_wda_cal import * # from get_real_status import * from datetime import datetime,timedelta from math import modf diff --git a/app/algorithms/sensors.py b/app/algorithms/sensors.py index 4f0387c..f43ab3b 100644 --- a/app/algorithms/sensors.py +++ b/app/algorithms/sensors.py @@ -2,7 +2,7 @@ import psycopg import app.algorithms.api_ex.kmeans_sensor as kmeans_sensor import app.algorithms.api_ex.sensitivity as sensitivity -from app.native.api.postgresql_info import get_pgconn_string +from app.native.wndb.postgresql_info import get_pgconn_string from app.services.tjnetwork import dump_inp diff --git a/app/algorithms/simulations.py b/app/algorithms/simulations.py index f7d86d9..4f8a6ab 100644 --- a/app/algorithms/simulations.py +++ b/app/algorithms/simulations.py @@ -9,7 +9,7 @@ from app.algorithms.api_ex.run_simulation import ( run_simulation_ex, from_clock_to_seconds_2, ) -from app.native.api.project import copy_project +from app.native.wndb.project import copy_project from app.services.epanet.epanet import Output from app.services.scheme_management import store_scheme_info from app.services.tjnetwork import * diff --git a/app/api/v1/endpoints/extension.py b/app/api/v1/endpoints/extension.py index c56ade6..5b12e5e 100644 --- a/app/api/v1/endpoints/extension.py +++ b/app/api/v1/endpoints/extension.py @@ -1,6 +1,6 @@ from typing import List, Any from fastapi import APIRouter, Request, HTTPException -from app.native.api import ChangeSet +from app.native.wndb import ChangeSet from app.services.tjnetwork import ( get_all_extension_data_keys, get_all_extension_data, diff --git a/app/api/v1/endpoints/project.py b/app/api/v1/endpoints/project.py index 84d2c87..9195276 100644 --- a/app/api/v1/endpoints/project.py +++ b/app/api/v1/endpoints/project.py @@ -3,7 +3,7 @@ from fastapi import APIRouter, Request, HTTPException from fastapi.responses import PlainTextResponse from typing import Any, Dict import app.services.project_info as project_info -from app.native.api import ChangeSet +from app.native.wndb import ChangeSet from app.infra.db.postgresql.database import get_database_instance as get_pg_db from app.infra.db.timescaledb.database import get_database_instance as get_ts_db from app.services.tjnetwork import ( diff --git a/app/api/v1/endpoints/scada.py b/app/api/v1/endpoints/scada.py index a50764a..3b09488 100644 --- a/app/api/v1/endpoints/scada.py +++ b/app/api/v1/endpoints/scada.py @@ -1,6 +1,6 @@ from typing import Any from fastapi import APIRouter, Request -from app.native.api import ChangeSet +from app.native.wndb import ChangeSet from app.services.tjnetwork import ( get_scada_info, get_all_scada_info, diff --git a/app/api/v1/endpoints/snapshots.py b/app/api/v1/endpoints/snapshots.py index fd8794f..8c28337 100644 --- a/app/api/v1/endpoints/snapshots.py +++ b/app/api/v1/endpoints/snapshots.py @@ -1,5 +1,5 @@ from fastapi import APIRouter, Request -from app.native.api import ChangeSet +from app.native.wndb import ChangeSet from app.services.tjnetwork import ( get_current_operation, execute_undo, diff --git a/app/infra/db/influxdb/api.py b/app/infra/db/influxdb/api.py index 84c036f..543ff90 100644 --- a/app/infra/db/influxdb/api.py +++ b/app/infra/db/influxdb/api.py @@ -29,7 +29,7 @@ import pytz import app.infra.db.influxdb.info as influxdb_info import app.services.project_info as project_info import app.services.time_api as time_api -from app.native.api.postgresql_info import get_pgconn_string +from app.native.wndb.postgresql_info import get_pgconn_string # influxdb数据库连接信息 url = influxdb_info.url diff --git a/app/infra/db/postgresql/database.py b/app/infra/db/postgresql/database.py index 012ec28..db5c970 100644 --- a/app/infra/db/postgresql/database.py +++ b/app/infra/db/postgresql/database.py @@ -3,7 +3,7 @@ from contextlib import asynccontextmanager from typing import AsyncGenerator, Dict, Optional import psycopg_pool from psycopg.rows import dict_row -import app.native.api.postgresql_info as postgresql_info +import app.native.wndb.postgresql_info as postgresql_info # Configure logging logger = logging.getLogger(__name__) diff --git a/app/infra/db/postgresql/internal_queries.py b/app/infra/db/postgresql/internal_queries.py index 7ae618e..0aa86ea 100644 --- a/app/infra/db/postgresql/internal_queries.py +++ b/app/infra/db/postgresql/internal_queries.py @@ -2,7 +2,7 @@ import time from typing import List, Optional from fastapi.logger import logger -import app.native.api.postgresql_info as postgresql_info +import app.native.wndb.postgresql_info as postgresql_info import psycopg diff --git a/app/native/api/__init__.py b/app/native/wndb/__init__.py similarity index 100% rename from app/native/api/__init__.py rename to app/native/wndb/__init__.py diff --git a/app/native/api/batch_api.py b/app/native/wndb/batch_api.py similarity index 100% rename from app/native/api/batch_api.py rename to app/native/wndb/batch_api.py diff --git a/app/native/api/batch_api_cs.py b/app/native/wndb/batch_api_cs.py similarity index 100% rename from app/native/api/batch_api_cs.py rename to app/native/wndb/batch_api_cs.py diff --git a/app/native/api/batch_exe.py b/app/native/wndb/batch_exe.py similarity index 100% rename from app/native/api/batch_exe.py rename to app/native/wndb/batch_exe.py diff --git a/app/native/api/clean_api.py b/app/native/wndb/clean_api.py similarity index 100% rename from app/native/api/clean_api.py rename to app/native/wndb/clean_api.py diff --git a/app/native/api/connection.py b/app/native/wndb/connection.py similarity index 100% rename from app/native/api/connection.py rename to app/native/wndb/connection.py diff --git a/app/native/api/database.py b/app/native/wndb/database.py similarity index 100% rename from app/native/api/database.py rename to app/native/wndb/database.py diff --git a/app/native/api/extension_data.py b/app/native/wndb/extension_data.py similarity index 100% rename from app/native/api/extension_data.py rename to app/native/wndb/extension_data.py diff --git a/app/native/api/inp_in.py b/app/native/wndb/inp_in.py similarity index 100% rename from app/native/api/inp_in.py rename to app/native/wndb/inp_in.py diff --git a/app/native/api/inp_out.py b/app/native/wndb/inp_out.py similarity index 100% rename from app/native/api/inp_out.py rename to app/native/wndb/inp_out.py diff --git a/app/native/api/postgresql_info.py b/app/native/wndb/postgresql_info.py similarity index 100% rename from app/native/api/postgresql_info.py rename to app/native/wndb/postgresql_info.py diff --git a/app/native/api/project.py b/app/native/wndb/project.py similarity index 100% rename from app/native/api/project.py rename to app/native/wndb/project.py diff --git a/app/native/api/project_backup.py b/app/native/wndb/project_backup.py similarity index 100% rename from app/native/api/project_backup.py rename to app/native/wndb/project_backup.py diff --git a/app/native/api/s0_base.py b/app/native/wndb/s0_base.py similarity index 100% rename from app/native/api/s0_base.py rename to app/native/wndb/s0_base.py diff --git a/app/native/api/s10_status.py b/app/native/wndb/s10_status.py similarity index 100% rename from app/native/api/s10_status.py rename to app/native/wndb/s10_status.py diff --git a/app/native/api/s11_patterns.py b/app/native/wndb/s11_patterns.py similarity index 100% rename from app/native/api/s11_patterns.py rename to app/native/wndb/s11_patterns.py diff --git a/app/native/api/s12_curves.py b/app/native/wndb/s12_curves.py similarity index 100% rename from app/native/api/s12_curves.py rename to app/native/wndb/s12_curves.py diff --git a/app/native/api/s13_controls.py b/app/native/wndb/s13_controls.py similarity index 100% rename from app/native/api/s13_controls.py rename to app/native/wndb/s13_controls.py diff --git a/app/native/api/s14_rules.py b/app/native/wndb/s14_rules.py similarity index 100% rename from app/native/api/s14_rules.py rename to app/native/wndb/s14_rules.py diff --git a/app/native/api/s15_energy.py b/app/native/wndb/s15_energy.py similarity index 100% rename from app/native/api/s15_energy.py rename to app/native/wndb/s15_energy.py diff --git a/app/native/api/s16_emitters.py b/app/native/wndb/s16_emitters.py similarity index 100% rename from app/native/api/s16_emitters.py rename to app/native/wndb/s16_emitters.py diff --git a/app/native/api/s17_quality.py b/app/native/wndb/s17_quality.py similarity index 100% rename from app/native/api/s17_quality.py rename to app/native/wndb/s17_quality.py diff --git a/app/native/api/s18_sources.py b/app/native/wndb/s18_sources.py similarity index 100% rename from app/native/api/s18_sources.py rename to app/native/wndb/s18_sources.py diff --git a/app/native/api/s19_reactions.py b/app/native/wndb/s19_reactions.py similarity index 100% rename from app/native/api/s19_reactions.py rename to app/native/wndb/s19_reactions.py diff --git a/app/native/api/s1_title.py b/app/native/wndb/s1_title.py similarity index 100% rename from app/native/api/s1_title.py rename to app/native/wndb/s1_title.py diff --git a/app/native/api/s20_mixing.py b/app/native/wndb/s20_mixing.py similarity index 100% rename from app/native/api/s20_mixing.py rename to app/native/wndb/s20_mixing.py diff --git a/app/native/api/s21_times.py b/app/native/wndb/s21_times.py similarity index 100% rename from app/native/api/s21_times.py rename to app/native/wndb/s21_times.py diff --git a/app/native/api/s22_report.py b/app/native/wndb/s22_report.py similarity index 100% rename from app/native/api/s22_report.py rename to app/native/wndb/s22_report.py diff --git a/app/native/api/s23_options.py b/app/native/wndb/s23_options.py similarity index 100% rename from app/native/api/s23_options.py rename to app/native/wndb/s23_options.py diff --git a/app/native/api/s23_options_util.py b/app/native/wndb/s23_options_util.py similarity index 100% rename from app/native/api/s23_options_util.py rename to app/native/wndb/s23_options_util.py diff --git a/app/native/api/s23_options_v3.py b/app/native/wndb/s23_options_v3.py similarity index 100% rename from app/native/api/s23_options_v3.py rename to app/native/wndb/s23_options_v3.py diff --git a/app/native/api/s24_coordinates.py b/app/native/wndb/s24_coordinates.py similarity index 100% rename from app/native/api/s24_coordinates.py rename to app/native/wndb/s24_coordinates.py diff --git a/app/native/api/s25_vertices.py b/app/native/wndb/s25_vertices.py similarity index 100% rename from app/native/api/s25_vertices.py rename to app/native/wndb/s25_vertices.py diff --git a/app/native/api/s26_labels.py b/app/native/wndb/s26_labels.py similarity index 100% rename from app/native/api/s26_labels.py rename to app/native/wndb/s26_labels.py diff --git a/app/native/api/s27_backdrop.py b/app/native/wndb/s27_backdrop.py similarity index 100% rename from app/native/api/s27_backdrop.py rename to app/native/wndb/s27_backdrop.py diff --git a/app/native/api/s28_end.py b/app/native/wndb/s28_end.py similarity index 100% rename from app/native/api/s28_end.py rename to app/native/wndb/s28_end.py diff --git a/app/native/api/s29_scada_device.py b/app/native/wndb/s29_scada_device.py similarity index 100% rename from app/native/api/s29_scada_device.py rename to app/native/wndb/s29_scada_device.py diff --git a/app/native/api/s2_junctions.py b/app/native/wndb/s2_junctions.py similarity index 100% rename from app/native/api/s2_junctions.py rename to app/native/wndb/s2_junctions.py diff --git a/app/native/api/s30_scada_device_data.py b/app/native/wndb/s30_scada_device_data.py similarity index 100% rename from app/native/api/s30_scada_device_data.py rename to app/native/wndb/s30_scada_device_data.py diff --git a/app/native/api/s31_scada_element.py b/app/native/wndb/s31_scada_element.py similarity index 100% rename from app/native/api/s31_scada_element.py rename to app/native/wndb/s31_scada_element.py diff --git a/app/native/api/s32_region.py b/app/native/wndb/s32_region.py similarity index 100% rename from app/native/api/s32_region.py rename to app/native/wndb/s32_region.py diff --git a/app/native/api/s32_region_util.py b/app/native/wndb/s32_region_util.py similarity index 100% rename from app/native/api/s32_region_util.py rename to app/native/wndb/s32_region_util.py diff --git a/app/native/api/s33_dma.py b/app/native/wndb/s33_dma.py similarity index 100% rename from app/native/api/s33_dma.py rename to app/native/wndb/s33_dma.py diff --git a/app/native/api/s33_dma_cal.py b/app/native/wndb/s33_dma_cal.py similarity index 100% rename from app/native/api/s33_dma_cal.py rename to app/native/wndb/s33_dma_cal.py diff --git a/app/native/api/s33_dma_gen.py b/app/native/wndb/s33_dma_gen.py similarity index 100% rename from app/native/api/s33_dma_gen.py rename to app/native/wndb/s33_dma_gen.py diff --git a/app/native/api/s34_sa.py b/app/native/wndb/s34_sa.py similarity index 100% rename from app/native/api/s34_sa.py rename to app/native/wndb/s34_sa.py diff --git a/app/native/api/s34_sa_cal.py b/app/native/wndb/s34_sa_cal.py similarity index 100% rename from app/native/api/s34_sa_cal.py rename to app/native/wndb/s34_sa_cal.py diff --git a/app/native/api/s34_sa_gen.py b/app/native/wndb/s34_sa_gen.py similarity index 100% rename from app/native/api/s34_sa_gen.py rename to app/native/wndb/s34_sa_gen.py diff --git a/app/native/api/s35_vd.py b/app/native/wndb/s35_vd.py similarity index 100% rename from app/native/api/s35_vd.py rename to app/native/wndb/s35_vd.py diff --git a/app/native/api/s35_vd_cal.py b/app/native/wndb/s35_vd_cal.py similarity index 100% rename from app/native/api/s35_vd_cal.py rename to app/native/wndb/s35_vd_cal.py diff --git a/app/native/api/s35_vd_gen.py b/app/native/wndb/s35_vd_gen.py similarity index 100% rename from app/native/api/s35_vd_gen.py rename to app/native/wndb/s35_vd_gen.py diff --git a/app/native/api/s36_wda.py b/app/native/wndb/s36_wda.py similarity index 100% rename from app/native/api/s36_wda.py rename to app/native/wndb/s36_wda.py diff --git a/app/native/api/s36_wda_cal.py b/app/native/wndb/s36_wda_cal.py similarity index 100% rename from app/native/api/s36_wda_cal.py rename to app/native/wndb/s36_wda_cal.py diff --git a/app/native/api/s38_scada_info.py b/app/native/wndb/s38_scada_info.py similarity index 100% rename from app/native/api/s38_scada_info.py rename to app/native/wndb/s38_scada_info.py diff --git a/app/native/api/s39_user.py b/app/native/wndb/s39_user.py similarity index 100% rename from app/native/api/s39_user.py rename to app/native/wndb/s39_user.py diff --git a/app/native/api/s3_reservoirs.py b/app/native/wndb/s3_reservoirs.py similarity index 100% rename from app/native/api/s3_reservoirs.py rename to app/native/wndb/s3_reservoirs.py diff --git a/app/native/api/s40_schema.py b/app/native/wndb/s40_schema.py similarity index 100% rename from app/native/api/s40_schema.py rename to app/native/wndb/s40_schema.py diff --git a/app/native/api/s41_pipe_risk_probability.py b/app/native/wndb/s41_pipe_risk_probability.py similarity index 100% rename from app/native/api/s41_pipe_risk_probability.py rename to app/native/wndb/s41_pipe_risk_probability.py diff --git a/app/native/api/s42_sensor_placement.py b/app/native/wndb/s42_sensor_placement.py similarity index 100% rename from app/native/api/s42_sensor_placement.py rename to app/native/wndb/s42_sensor_placement.py diff --git a/app/native/api/s43_burst_locate_result.py b/app/native/wndb/s43_burst_locate_result.py similarity index 100% rename from app/native/api/s43_burst_locate_result.py rename to app/native/wndb/s43_burst_locate_result.py diff --git a/app/native/api/s4_tanks.py b/app/native/wndb/s4_tanks.py similarity index 100% rename from app/native/api/s4_tanks.py rename to app/native/wndb/s4_tanks.py diff --git a/app/native/api/s5_pipes.py b/app/native/wndb/s5_pipes.py similarity index 100% rename from app/native/api/s5_pipes.py rename to app/native/wndb/s5_pipes.py diff --git a/app/native/api/s6_pumps.py b/app/native/wndb/s6_pumps.py similarity index 100% rename from app/native/api/s6_pumps.py rename to app/native/wndb/s6_pumps.py diff --git a/app/native/api/s7_valves.py b/app/native/wndb/s7_valves.py similarity index 100% rename from app/native/api/s7_valves.py rename to app/native/wndb/s7_valves.py diff --git a/app/native/api/s8_tags.py b/app/native/wndb/s8_tags.py similarity index 100% rename from app/native/api/s8_tags.py rename to app/native/wndb/s8_tags.py diff --git a/app/native/api/s9_demands.py b/app/native/wndb/s9_demands.py similarity index 100% rename from app/native/api/s9_demands.py rename to app/native/wndb/s9_demands.py diff --git a/app/native/api/sections.py b/app/native/wndb/sections.py similarity index 100% rename from app/native/api/sections.py rename to app/native/wndb/sections.py diff --git a/app/services/epanet/epanet.py b/app/services/epanet/epanet.py index 633d54a..8283190 100644 --- a/app/services/epanet/epanet.py +++ b/app/services/epanet/epanet.py @@ -10,8 +10,8 @@ import logging from typing import Any sys.path.append("..") -from app.native.api import project -from app.native.api import inp_out +from app.native.wndb import project +from app.native.wndb import inp_out def _verify_platform(): diff --git a/app/services/network_import.py b/app/services/network_import.py index 3ac24d7..7bf4e67 100644 --- a/app/services/network_import.py +++ b/app/services/network_import.py @@ -6,7 +6,7 @@ import psycopg from psycopg import sql import app.services.project_info as project_info -from app.native.api.postgresql_info import get_pgconn_string +from app.native.wndb.postgresql_info import get_pgconn_string from app.services.tjnetwork import read_inp diff --git a/app/services/scheme_management.py b/app/services/scheme_management.py index c816eb6..c4697de 100644 --- a/app/services/scheme_management.py +++ b/app/services/scheme_management.py @@ -7,7 +7,7 @@ import pandas as pd import psycopg from sqlalchemy import create_engine -from app.native.api.postgresql_info import get_pgconn_string +from app.native.wndb.postgresql_info import get_pgconn_string # 2025/03/23 diff --git a/app/services/simulation.py b/app/services/simulation.py index b922e8f..990e35f 100644 --- a/app/services/simulation.py +++ b/app/services/simulation.py @@ -1,6 +1,6 @@ import numpy as np from app.services.tjnetwork import * -from app.native.api.s36_wda_cal import * +from app.native.wndb.s36_wda_cal import * # from get_real_status import * from datetime import datetime, timedelta @@ -20,7 +20,7 @@ import logging import app.services.globals as globals import uuid import app.services.project_info as project_info -from app.native.api.postgresql_info import get_pgconn_string +from app.native.wndb.postgresql_info import get_pgconn_string from app.infra.db.timescaledb.internal_queries import ( InternalQueries as TimescaleInternalQueries, ) diff --git a/app/services/simulation_ops.py b/app/services/simulation_ops.py index d4723a6..76c0a0d 100644 --- a/app/services/simulation_ops.py +++ b/app/services/simulation_ops.py @@ -5,7 +5,7 @@ from math import pi import pytz from app.algorithms.api_ex.run_simulation import run_simulation_ex -from app.native.api.project import copy_project +from app.native.wndb.project import copy_project from app.services.epanet.epanet import Output from app.services.tjnetwork import * diff --git a/app/services/tjnetwork.py b/app/services/tjnetwork.py index 358e90d..ecb0c70 100644 --- a/app/services/tjnetwork.py +++ b/app/services/tjnetwork.py @@ -1,5 +1,5 @@ from typing import Any -import app.native.api as api +import app.native.wndb as api import app.services.epanet as epanet diff --git a/scripts/online_Analysis.py b/scripts/online_Analysis.py index a1aed4f..9fb5865 100644 --- a/scripts/online_Analysis.py +++ b/scripts/online_Analysis.py @@ -1,6 +1,6 @@ import os from app.services.tjnetwork import * -from app.native.api.project import copy_project +from app.native.wndb.project import copy_project from app.algorithms.api_ex.run_simulation import run_simulation_ex, from_clock_to_seconds_2 from math import sqrt, pi from app.services.epanet.epanet import Output @@ -22,7 +22,7 @@ import app.algorithms.api_ex.kmeans_sensor as kmeans_sensor import app.algorithms.api_ex.flow_data_clean as flow_data_clean import app.algorithms.api_ex.pressure_data_clean as pressure_data_clean import app.algorithms.api_ex.sensitivity as sensitivity -from app.native.api.postgresql_info import get_pgconn_string +from app.native.wndb.postgresql_info import get_pgconn_string ############################################################