pipeline-eds 0.2.26__tar.gz → 0.2.27__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/PKG-INFO +1 -1
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/pyproject.toml +6 -3
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/cli.py +59 -6
- pipeline_eds-0.2.27/src/pipeline/create_sensors_db.py +113 -0
- pipeline_eds-0.2.27/src/pipeline/data/sensors.db +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/LICENSE +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/README.md +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/__init__.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/__main__.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/api/__init__.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/api/eds.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/api/rjn.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/api/status_api.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/calls.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/configrationmanager.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/decorators.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/env.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/environment.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/gui_fastapi_plotly_live.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/gui_mpl_live.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/gui_plotly_static.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/helpers.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/install_appdata.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/logging_setup.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/pastehelpers.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/philosophy.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/pipeline-winreg-filler-based-on-filetype.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/plotbuffer.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/points_loader.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/queriesmanager.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/time_manager.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/workspace_manager.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/default-workspace.toml +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/__init__.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/code/__init__.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/code/aggregator.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/code/collector.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/code/sanitizer.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/code/storage.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/configurations/config_time.toml +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/configurations/configuration.toml +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/README.md +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/aggregate/README.md +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/aggregate/live_data - Copy.csv +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/aggregate/live_data_EFF.csv +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/aggregate/live_data_INF.csv +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/export_eds_points_neo.txt +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/manual_data_load_to_postman_wetwell.csv +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/manual_data_load_to_postman_wetwell.xlsx +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/manual_effluent.csv +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/manual_influent.csv +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/manual_wetwell.csv +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/history/time_sample.txt +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/imports/zdMaxson_idcsD321E_sid11003.toml +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/imports/zdMaxson_idcsFI8001_sid8528.toml +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/imports/zdMaxson_idcsM100FI_sid2308.toml +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/imports/zdMaxson_idcsM310LI_sid2382.toml +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/queries/default-queries.toml +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/queries/points-maxson.csv +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/queries/points-stiles.csv +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/queries/timestamps_success.json +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/scripts/__init__.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/scripts/daemon_runner.py +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/secrets/README.md +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/secrets/secrets-example.yaml +0 -0
- {pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_termux/..txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "pipeline-eds"
|
3
|
-
version = "0.2.
|
3
|
+
version = "0.2.27"
|
4
4
|
description = "The official API pipeline library for mulch-based projects. Key target: Emerson Ovation EDS REST API."
|
5
5
|
authors = ["George Clayton Bennett <george.bennett@memphistn.gov>"]
|
6
6
|
license = "BSD-3"
|
@@ -11,8 +11,11 @@ packages = [
|
|
11
11
|
] # This makes `pipeline` available as an importable top-level module
|
12
12
|
homepage = "https://github.com/city-of-memphis-wastewater/pipeline"
|
13
13
|
repository = "https://github.com/city-of-memphis-wastewater/pipeline"
|
14
|
-
|
15
|
-
|
14
|
+
include = [
|
15
|
+
"src/pipeline/data/*"
|
16
|
+
]
|
17
|
+
|
18
|
+
[tool.poetry.scripts]
|
16
19
|
#time-manager = "pipeline.time_manager:main"
|
17
20
|
#workspace-manager = "pipeline.workspace_manager:main" # included in init
|
18
21
|
#collector = "pipeline.collector:main"
|
@@ -10,6 +10,10 @@ def list_workspaces(workspaces_dir: Path = Path("workspaces")):
|
|
10
10
|
typer.echo(f"🪴 {path.name}")
|
11
11
|
|
12
12
|
'''
|
13
|
+
|
14
|
+
import sqlite3
|
15
|
+
from rich.table import Table
|
16
|
+
from rich.console import Console
|
13
17
|
import typer
|
14
18
|
import importlib
|
15
19
|
from pathlib import Path
|
@@ -17,6 +21,7 @@ from importlib.metadata import version, PackageNotFoundError
|
|
17
21
|
|
18
22
|
from pipeline.env import SecretConfig
|
19
23
|
from pipeline.time_manager import TimeManager
|
24
|
+
from pipeline.create_sensors_db import get_user_db_path, ensure_user_db, get_db_connection
|
20
25
|
#from pipeline.helpers import setup_logging
|
21
26
|
#from pipeline.workspace_manager import WorkspaceManager
|
22
27
|
|
@@ -49,7 +54,7 @@ except PackageNotFoundError:
|
|
49
54
|
### Pipeline CLI
|
50
55
|
|
51
56
|
app = typer.Typer(help="CLI for running pipeline workspaces.")
|
52
|
-
|
57
|
+
console = Console()
|
53
58
|
|
54
59
|
@app.callback(invoke_without_command=True)
|
55
60
|
def main(
|
@@ -92,12 +97,60 @@ def run(
|
|
92
97
|
typer.echo(f"💥 Error while running {workspace}: {e}")
|
93
98
|
raise typer.Exit(1)
|
94
99
|
|
100
|
+
# -----------------------------
|
101
|
+
# CLI commands
|
102
|
+
# -----------------------------
|
95
103
|
@app.command()
|
96
|
-
def
|
97
|
-
"""
|
98
|
-
|
99
|
-
|
100
|
-
|
104
|
+
def list_sensors():
|
105
|
+
"""Print all sensors from the database."""
|
106
|
+
conn = get_db_connection()
|
107
|
+
cur = conn.cursor()
|
108
|
+
cur.execute("SELECT idcs, iess, zd FROM sensors")
|
109
|
+
rows = cur.fetchall()
|
110
|
+
conn.close()
|
111
|
+
|
112
|
+
table = Table(title="Sensor Correlations")
|
113
|
+
table.add_column("IDCS", style="cyan")
|
114
|
+
table.add_column("IESS", style="magenta")
|
115
|
+
table.add_column("ZD", style="green")
|
116
|
+
|
117
|
+
for idcs, iess, zd in rows:
|
118
|
+
table.add_row(idcs, iess, zd)
|
119
|
+
|
120
|
+
console.print(table)
|
121
|
+
|
122
|
+
@app.command()
|
123
|
+
def reset_db():
|
124
|
+
"""Reset the user DB from the packaged default."""
|
125
|
+
user_db = get_user_db_path()
|
126
|
+
if user_db.exists():
|
127
|
+
user_db.unlink()
|
128
|
+
ensure_user_db()
|
129
|
+
typer.echo(f"✅ User DB reset to default at {user_db}")
|
130
|
+
|
131
|
+
|
132
|
+
@app.command()
|
133
|
+
def sensors(db_path: str = None):
|
134
|
+
# db_path: str = "sensors.db"
|
135
|
+
if db_path is not None:
|
136
|
+
conn = sqlite3.connect(db_path)
|
137
|
+
else:
|
138
|
+
conn = get_db_connection()
|
139
|
+
cur = conn.cursor()
|
140
|
+
cur.execute("SELECT idcs, iess, zd FROM sensors")
|
141
|
+
rows = cur.fetchall()
|
142
|
+
conn.close()
|
143
|
+
|
144
|
+
table = Table(title="Sensor Correlations")
|
145
|
+
table.add_column("IDCS", style="cyan")
|
146
|
+
table.add_column("IESS", style="magenta")
|
147
|
+
table.add_column("ZD", style="green")
|
148
|
+
|
149
|
+
for idcs, iess, zd in rows:
|
150
|
+
table.add_row(idcs, iess, zd)
|
151
|
+
|
152
|
+
console.print(table)
|
153
|
+
|
101
154
|
|
102
155
|
@app.command()
|
103
156
|
def trend(
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# create_sensors_db.py
|
2
|
+
import sqlite3
|
3
|
+
from pathlib import Path
|
4
|
+
import os
|
5
|
+
import sys
|
6
|
+
import shutil
|
7
|
+
import sqlite3
|
8
|
+
from pathlib import Path
|
9
|
+
from importlib import resources
|
10
|
+
|
11
|
+
# Your sensor data here:
|
12
|
+
sensors_data = [
|
13
|
+
# (idcs, iess, zd)
|
14
|
+
("M310LI", "M310L0I.UNIT0@NET0", "Maxson"),
|
15
|
+
("M100FI", "M100FI.UNIT0@NET0", "Maxson"),
|
16
|
+
("FI8001", "FI8001.UNIT0@NET0", "Maxson"),
|
17
|
+
("I-0201A", "I-0201A.UNIT1@NET1", "WWTF"),
|
18
|
+
# add as many as you like...
|
19
|
+
]
|
20
|
+
|
21
|
+
|
22
|
+
# -----------------------------
|
23
|
+
# Rollout packaged DB
|
24
|
+
# -----------------------------
|
25
|
+
|
26
|
+
def ensure_user_db() -> Path:
|
27
|
+
"""Copy packaged DB to user folder if it doesn't exist."""
|
28
|
+
user_db = get_user_db_path()
|
29
|
+
if not user_db.exists():
|
30
|
+
with resources.as_file(resources.files("pipeline.data") / "sensors.db") as packaged_db:
|
31
|
+
shutil.copy(packaged_db, user_db)
|
32
|
+
return user_db
|
33
|
+
|
34
|
+
# -----------------------------
|
35
|
+
# DB connection
|
36
|
+
# -----------------------------
|
37
|
+
def get_db_connection():
|
38
|
+
db_path = ensure_user_db()
|
39
|
+
conn = sqlite3.connect(db_path)
|
40
|
+
return conn
|
41
|
+
|
42
|
+
# -----------------------------
|
43
|
+
# Packaged DB location
|
44
|
+
# -----------------------------
|
45
|
+
def get_packaged_db_path() -> Path:
|
46
|
+
db_path = Path(__file__).parent / "data" / "sensors.db"
|
47
|
+
db_path.parent.mkdir(parents=True, exist_ok=True)
|
48
|
+
return db_path
|
49
|
+
|
50
|
+
# -----------------------------
|
51
|
+
# User DB location
|
52
|
+
# -----------------------------
|
53
|
+
|
54
|
+
def get_user_db_path() -> Path:
|
55
|
+
if sys.platform == "win32":
|
56
|
+
base = Path(os.getenv("APPDATA", Path.home() / "AppData" / "Roaming"))
|
57
|
+
elif sys.platform == "darwin":
|
58
|
+
base = Path.home() / "Library" / "Application Support"
|
59
|
+
else:
|
60
|
+
base = Path.home() / ".local" / "share"
|
61
|
+
|
62
|
+
user_dir = base / "pipeline"
|
63
|
+
user_dir.mkdir(parents=True, exist_ok=True)
|
64
|
+
return user_dir / "sensors.db"
|
65
|
+
|
66
|
+
# -----------------------------
|
67
|
+
# Create packaged DB
|
68
|
+
# -----------------------------
|
69
|
+
def create_packaged_db():
|
70
|
+
db_path = get_packaged_db_path()
|
71
|
+
if db_path.exists():
|
72
|
+
print(f"⚠️ {db_path} already exists. Overwriting...")
|
73
|
+
db_path.unlink()
|
74
|
+
|
75
|
+
conn = sqlite3.connect(db_path)
|
76
|
+
cur = conn.cursor()
|
77
|
+
|
78
|
+
cur.execute("""
|
79
|
+
CREATE TABLE sensors (
|
80
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
81
|
+
idcs TEXT NOT NULL,
|
82
|
+
iess TEXT NOT NULL,
|
83
|
+
zd TEXT NOT NULL
|
84
|
+
)
|
85
|
+
""")
|
86
|
+
|
87
|
+
cur.executemany(
|
88
|
+
"INSERT INTO sensors (idcs, iess, zd) VALUES (?, ?, ?)",
|
89
|
+
sensors_data
|
90
|
+
)
|
91
|
+
|
92
|
+
conn.commit()
|
93
|
+
conn.close()
|
94
|
+
print(f"✅ Packaged DB created at {db_path}")
|
95
|
+
return db_path
|
96
|
+
|
97
|
+
# -----------------------------
|
98
|
+
# Reset user DB
|
99
|
+
# -----------------------------
|
100
|
+
def reset_user_db(packaged_db_path: Path):
|
101
|
+
user_db = get_user_db_path()
|
102
|
+
if user_db.exists():
|
103
|
+
user_db.unlink()
|
104
|
+
print(f"🗑 Old user DB removed: {user_db}")
|
105
|
+
shutil.copy(packaged_db_path, user_db)
|
106
|
+
print(f"✅ User DB reset from packaged DB: {user_db}")
|
107
|
+
|
108
|
+
# -----------------------------
|
109
|
+
# Main
|
110
|
+
# -----------------------------
|
111
|
+
if __name__ == "__main__":
|
112
|
+
packaged_db = create_packaged_db()
|
113
|
+
reset_user_db(packaged_db)
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/src/pipeline/pipeline-winreg-filler-based-on-filetype.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/configurations/config_time.toml
RENAMED
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/configurations/configuration.toml
RENAMED
File without changes
|
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/aggregate/README.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/export_eds_points_neo.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/manual_effluent.csv
RENAMED
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/manual_influent.csv
RENAMED
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/exports/manual_wetwell.csv
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/queries/default-queries.toml
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/queries/timestamps_success.json
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pipeline_eds-0.2.26 → pipeline_eds-0.2.27}/workspaces/eds_to_rjn/secrets/secrets-example.yaml
RENAMED
File without changes
|
File without changes
|