feat(status): surface mechanism_status alongside the other enrichment columns
Contacts have had a `mechanism_status` enum since the rain-scatter classifier landed — it's in the schema and it's what drives the Mechanism badge on /contacts/:id — but /status's progress breakdown still only tracked hrrr/weather/terrain/iemre/radar/narr. Add Mechanism to both `count_unprocessed_raw`'s FILTER and the progress-bar list so the ops dashboard reflects the real shape of the backfill pipeline instead of silently hiding one of the seven enrichment types.
This commit is contained in:
parent
e688d8c244
commit
04aa19839a
1 changed files with 10 additions and 5 deletions
|
|
@ -85,11 +85,12 @@ defmodule MicrowavepropWeb.StatusLive do
|
|||
end
|
||||
|
||||
defp count_unprocessed_raw do
|
||||
# Previously issued 7 separate `SELECT COUNT(*) FROM contacts WHERE
|
||||
# <field> IN (...)` queries. Postgres ran 7 index scans over the
|
||||
# same 58k+ row table on every 2s status refresh; collapse into a
|
||||
# single scan that returns every needed count via FILTER clauses.
|
||||
%{rows: [[total, terrain, hrrr, weather, iemre, radar, all_done]]} =
|
||||
# One scan over the contacts table returns every per-type pending
|
||||
# count via FILTER clauses. Cheaper than N separate COUNT queries
|
||||
# and cheaper than N index scans. Keep the FILTER list in lockstep
|
||||
# with the progress-bar list in the template — missing a field
|
||||
# here means the progress bar will deny-count its own column.
|
||||
%{rows: [[total, terrain, hrrr, weather, iemre, radar, mechanism, all_done]]} =
|
||||
Repo.query!("""
|
||||
SELECT
|
||||
COUNT(*) FILTER (WHERE pos1 IS NOT NULL),
|
||||
|
|
@ -103,6 +104,8 @@ defmodule MicrowavepropWeb.StatusLive do
|
|||
AND iemre_status::text IN ('pending','queued','processing','failed')),
|
||||
COUNT(*) FILTER (WHERE pos1 IS NOT NULL
|
||||
AND radar_status::text IN ('pending','queued','processing','failed')),
|
||||
COUNT(*) FILTER (WHERE pos1 IS NOT NULL
|
||||
AND mechanism_status::text IN ('pending','queued','processing','failed')),
|
||||
COUNT(*) FILTER (WHERE pos1 IS NOT NULL
|
||||
AND hrrr_status::text IN ('complete','unavailable')
|
||||
AND weather_status::text IN ('complete','unavailable')
|
||||
|
|
@ -120,6 +123,7 @@ defmodule MicrowavepropWeb.StatusLive do
|
|||
weather: weather,
|
||||
iemre: iemre,
|
||||
radar: radar,
|
||||
mechanism: mechanism,
|
||||
narr_candidates: narr_candidates,
|
||||
narr_done: narr_done,
|
||||
remaining: max(terrain, max(hrrr, max(weather, iemre))),
|
||||
|
|
@ -461,6 +465,7 @@ defmodule MicrowavepropWeb.StatusLive do
|
|||
{"terrain", "Terrain", @unprocessed.total - @unprocessed.terrain, @unprocessed.total},
|
||||
{"iemre", "IEMRE", @unprocessed.total - @unprocessed.iemre, @unprocessed.total},
|
||||
{"radar", "Radar", @unprocessed.total - @unprocessed.radar, @unprocessed.total},
|
||||
{"mechanism", "Mechanism", @unprocessed.total - @unprocessed.mechanism, @unprocessed.total},
|
||||
{"narr", "NARR", @unprocessed.narr_done, @unprocessed.narr_candidates}
|
||||
] do %>
|
||||
<% pct = if denom > 0, do: round(complete * 100 / denom), else: 0 %>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue