Organize the project by domain and name analyses by their rule
Energy code moves to src/energy/ and its docs to docs/energy/; shared code (CSV loading, venv switch, browser, zoom script) goes to src/common/, and the AIMsight originals to docs/aimsight/. Analyses are no longer numbered: two Energy scripts remain, daily.py (delivered state and trend) and all_analyses.py (comparison of the four). Calculations and pages unchanged (D-026). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
77c8f24d2f
commit
8a32f4d418
44 files changed
+1757
-771
No files matched your search
@@ -1,7 +1,7 @@
|
||||
"""Maquette côté client « Energy » : page System Summary du site de monitoring, avec une section Diagnostic (D-020 à D-023).
|
||||
|
||||
Données réelles VERMONT. Bloc Energy : couleur du dernier jour de la fenêtre, échelle de batterie et tendance face à la veille
|
||||
(src/day_color.py), puis historique complet (energy_plot.daily_figure, D-021) et guide (partie 1 du manuel), repliés.
|
||||
(src/energy/day_color.py), puis historique complet (energy.daily.daily_figure, D-021) et guide (partie 1 du manuel), repliés.
|
||||
Écrit out/maquette_user_energy.html et l'ouvre dans le navigateur.
|
||||
Usage : python3 maquettes/user/energy.py [AAAA-MM-JJ début] [AAAA-MM-JJ fin] (défaut : 2026-09-18 à 2026-09-28)
|
||||
"""
|
||||
@@ -14,17 +14,15 @@ from pathlib import Path
|
||||
HERE = Path(__file__).resolve().parent
|
||||
ROOT = HERE.parent.parent
|
||||
sys.path.insert(0, str(ROOT / "src"))
|
||||
from analyse_01 import open_html # noqa: E402 (bascule seule sur .venv si plotly manque)
|
||||
import battery_state as bs # noqa: E402
|
||||
import battery_trend as bt # noqa: E402
|
||||
import day_color as dc # noqa: E402
|
||||
import energy_check as ec # noqa: E402
|
||||
import energy_plot as ep # noqa: E402
|
||||
from common.page import AUTOSCALE_Y_JS, open_html # noqa: E402 (bascule seule sur .venv si plotly manque)
|
||||
from common.stations import load_stations # noqa: E402
|
||||
from energy import battery_state as bs, battery_trend as bt, day_color as dc # noqa: E402
|
||||
from energy.daily import daily_figure # noqa: E402
|
||||
|
||||
START = date.fromisoformat(sys.argv[1]) if len(sys.argv) > 1 else date(2026, 9, 18)
|
||||
END = date.fromisoformat(sys.argv[2]) if len(sys.argv) > 2 else date(2026, 9, 28)
|
||||
|
||||
series = ec.load_stations([str(ROOT / "data")])["VERMONT"]
|
||||
series = load_stations([str(ROOT / "data")])["VERMONT"]
|
||||
v = series["BusVoltage"]
|
||||
in_window = lambda t: START <= t.date() <= END # noqa: E731
|
||||
|
||||
@@ -44,7 +42,7 @@ for metric in sorted(series):
|
||||
|
||||
facts = {p["t"].date(): p["facts"] for p in dc.run(series)["points"]}
|
||||
# Guide : partie 1 du manuel (lecture rapide, pour le client), relue à chaque génération ; titres décalés de deux niveaux.
|
||||
manual = (ROOT / "docs" / "guide" / "diagnostic-energetique.md").read_text()
|
||||
manual = (ROOT / "docs" / "energy" / "guide" / "diagnostic-energetique.md").read_text()
|
||||
part1 = manual[manual.index("# Partie 1"):manual.index("# Partie 2")].split("\n", 1)[1] # sans son titre
|
||||
guide = re.sub(r"^#", "###", part1.rstrip().removesuffix("---"), flags=re.M)
|
||||
data = {"hours": hours, "daily": list(daily.values()), "table": table, "guide": guide,
|
||||
@@ -54,8 +52,8 @@ data = {"hours": hours, "daily": list(daily.values()), "table": table, "guide":
|
||||
"deadband_v": bt.NIGHT_END_DEADBAND_V}}
|
||||
html = (HERE / "energy_template.html").read_text()
|
||||
for key, value in (("/*DATA*/null", json.dumps(data)),
|
||||
("/*DAILY*/null", ep.daily_figure("VERMONT", series).to_json()),
|
||||
("/*AUTOSCALE*/", ep.AUTOSCALE_Y_JS.replace("{plot_id}", "daily"))):
|
||||
("/*DAILY*/null", daily_figure("VERMONT", series).to_json()),
|
||||
("/*AUTOSCALE*/", AUTOSCALE_Y_JS.replace("{plot_id}", "daily"))):
|
||||
html = html.replace(key, value)
|
||||
out = ROOT / "out" / "maquette_user_energy.html"
|
||||
out.parent.mkdir(exist_ok=True)
|
||||
|
||||
Reference in new issue
Block a user