Deliver Storage and Cellular in the mockups, with site figures and guides
The mockups now walk a list of domains (D-039): the support Home loads every station in data/ and notifies each station x domain that is Orange or Red; the client view becomes maquettes/user/summary.py, one System Summary page per station with one block per measured domain. Storage shows a free-space scale and the estimated full date; Cellular shows the day's sends in words and a four-class signal scale. HEADLINE moves into each day_color.py, with a Green sentence for the client view. src/storage/final.py and src/cellular/final.py write the site figures in English; the comparison pages reuse their panels. Each domain gets a short two-layer guide in docs/<domaine>/guide/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
28d441889f
commit
f0990c16e6
22 files changed
+682
-246
No files matched your search
+30
-18
@@ -1,9 +1,10 @@
|
||||
"""Maquette côté support « Home » : page d'accueil du site de monitoring (toutes les stations), avec en haut une section
|
||||
Status. Elle porte une notification par station dont le dernier jour de la fenêtre est Orange ou Red (src/energy/day_color.py, D-020).
|
||||
Status. Elle porte une notification par station et par domaine dont le dernier jour de la fenêtre est Orange ou Red
|
||||
(src/<domaine>/day_color.py : Energy, Storage, Cellular ; D-025, D-030).
|
||||
|
||||
La notification, comme la vignette de la station, mène à la vue client de la station (son menu principal) :
|
||||
out/maquette_user_energy.html, écrite par maquettes/user/energy.py (à lancer avec les mêmes dates).
|
||||
Données réelles : VERMONT seule (data/VERMONT/). Les autres stations, noms repris du site, n'ont pas de données dans la maquette.
|
||||
out/maquette_user_<STATION>.html, écrite par maquettes/user/summary.py (à lancer avec les mêmes dates).
|
||||
Données réelles : les stations de data/ (VERMONT, WEISSHORN, NORDEND). Les autres, noms repris du site, n'ont pas de données.
|
||||
Écrit out/maquette_support_home.html et l'ouvre dans le navigateur.
|
||||
Usage : python3 maquettes/support/home.py [AAAA-MM-JJ début] [AAAA-MM-JJ fin] (défaut : 2026-09-18 à 2026-09-28)
|
||||
"""
|
||||
@@ -16,7 +17,9 @@ ROOT = HERE.parent.parent
|
||||
sys.path.insert(0, str(ROOT / "src"))
|
||||
from common.page import open_html # noqa: E402
|
||||
from common.stations import load_stations # noqa: E402
|
||||
from energy import day_color as dc # noqa: E402
|
||||
from cellular import day_color as cellular # noqa: E402
|
||||
from energy import day_color as energy # noqa: E402
|
||||
from storage import day_color as storage # 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)
|
||||
@@ -27,12 +30,11 @@ STATIONS = ["ALLALINHORN", "BREITHORN", "CASTOR", "CLARIDEN", "DOM", "FINSTERAAR
|
||||
"PIZBERNINA", "PIZBUIN", "POLLUX", "RINGELSPITZ", "VERMONT", "WEISSHORN", "ADULA", "ALASKA", "DAMMASTOCK",
|
||||
"FAULHORN", "GRANDCOMBIN", "MARYLAND", "MONTANA", "NADELHORN", "PONT_TREMBLEX-01", "SNCF01", "WILDSTRUBEL",
|
||||
"WYOMING"]
|
||||
USER_VIEW = {"VERMONT": "maquette_user_energy.html"} # vue client de la station (maquettes/user/)
|
||||
DOMAINS = {"Energy": energy, "Storage": storage, "Cellular": cellular} # contrat de notification (D-030)
|
||||
NAME = {"RED": "Red", "ORANGE": "Orange"} # couleurs notifiées, la plus grave d'abord ; Green ne notifie rien
|
||||
HEADLINE = {"RED": "The station is not receiving enough energy.", # mêmes phrases que la vue client
|
||||
"ORANGE": "The station's energy supply is uncertain."}
|
||||
|
||||
series = load_stations([str(ROOT / "data" / "VERMONT")])
|
||||
series = load_stations([str(d) for d in sorted((ROOT / "data").iterdir()) if d.is_dir()])
|
||||
user_view = lambda name: f"maquette_user_{name}.html" if name in series else "#" # noqa: E731 (maquettes/user/)
|
||||
|
||||
|
||||
def spark(v):
|
||||
@@ -55,18 +57,28 @@ for name in STATIONS:
|
||||
f'</div><svg></svg></div>')
|
||||
continue
|
||||
svg, last = spark(series[name]["BusVoltage"])
|
||||
tiles.append(f'<a class="tile" href="{USER_VIEW.get(name, "#")}"><div class="tile-head">{name}<span>{last:.2f}[V]</span>'
|
||||
tiles.append(f'<a class="tile" href="{user_view(name)}"><div class="tile-head">{name}<span>{last:.2f}[V]</span>'
|
||||
f'</div>{svg}</a>')
|
||||
|
||||
def color_of(dc, station):
|
||||
"""Couleur du dernier jour de la fenêtre pour un domaine ; None si la station n'a pas ses mesures."""
|
||||
try:
|
||||
points = dc.run(series[station])["points"]
|
||||
except KeyError: # série du domaine absente (VERMONT n'a ni disque ni modem)
|
||||
return None
|
||||
return {p["t"].date(): p["facts"]["color"] for p in points}.get(END)
|
||||
|
||||
|
||||
notes = []
|
||||
for name in series:
|
||||
color = {p["t"].date(): p["facts"]["color"] for p in dc.run(series[name])["points"]}.get(END)
|
||||
if color in NAME:
|
||||
notes.append((list(NAME).index(color), name,
|
||||
f'<li><span class="status {color}">{NAME[color]}</span><b>{name}</b><span>Energy</span>'
|
||||
f'<span class="meta">{END.strftime("%a %d %b %Y")}</span><span>{HEADLINE[color]}</span>'
|
||||
f'<a href="{USER_VIEW.get(name, "#")}">Open {name} →</a></li>'))
|
||||
status = "".join(n[2] for n in sorted(notes)) or '<li class="empty">No problem or point of attention.</li>'
|
||||
for domain, dc in DOMAINS.items():
|
||||
color = color_of(dc, name)
|
||||
if color in NAME:
|
||||
notes.append((list(NAME).index(color), name, domain,
|
||||
f'<li><span class="status {color}">{NAME[color]}</span><b>{name}</b><span>{domain}</span>'
|
||||
f'<span class="meta">{END.strftime("%a %d %b %Y")}</span><span>{dc.HEADLINE[color]}</span>'
|
||||
f'<a href="{user_view(name)}">Open {name} →</a></li>'))
|
||||
status = "".join(n[-1] for n in sorted(notes)) or '<li class="empty">No problem or point of attention.</li>'
|
||||
|
||||
html = (HERE / "home_template.html").read_text()
|
||||
for key, value in (("<!--COUNT-->", f"{len(notes)} notification{'s' * (len(notes) != 1)}"),
|
||||
@@ -76,6 +88,6 @@ out = ROOT / "out" / "maquette_support_home.html"
|
||||
out.parent.mkdir(exist_ok=True)
|
||||
out.write_text(html)
|
||||
print(out)
|
||||
if not (out.parent / USER_VIEW["VERMONT"]).exists():
|
||||
print("Vue client absente : lancer python3 maquettes/user/energy.py avec les mêmes dates.")
|
||||
if not all((out.parent / user_view(name)).exists() for name in series):
|
||||
print("Vue client absente : lancer python3 maquettes/user/summary.py avec les mêmes dates.")
|
||||
open_html(out)
|
||||
Reference in new issue
Block a user