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
|
end
|
||||||
|
|
||||||
defp count_unprocessed_raw do
|
defp count_unprocessed_raw do
|
||||||
# Previously issued 7 separate `SELECT COUNT(*) FROM contacts WHERE
|
# One scan over the contacts table returns every per-type pending
|
||||||
# <field> IN (...)` queries. Postgres ran 7 index scans over the
|
# count via FILTER clauses. Cheaper than N separate COUNT queries
|
||||||
# same 58k+ row table on every 2s status refresh; collapse into a
|
# and cheaper than N index scans. Keep the FILTER list in lockstep
|
||||||
# single scan that returns every needed count via FILTER clauses.
|
# with the progress-bar list in the template — missing a field
|
||||||
%{rows: [[total, terrain, hrrr, weather, iemre, radar, all_done]]} =
|
# here means the progress bar will deny-count its own column.
|
||||||
|
%{rows: [[total, terrain, hrrr, weather, iemre, radar, mechanism, all_done]]} =
|
||||||
Repo.query!("""
|
Repo.query!("""
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*) FILTER (WHERE pos1 IS NOT NULL),
|
COUNT(*) FILTER (WHERE pos1 IS NOT NULL),
|
||||||
|
|
@ -103,6 +104,8 @@ defmodule MicrowavepropWeb.StatusLive do
|
||||||
AND iemre_status::text IN ('pending','queued','processing','failed')),
|
AND iemre_status::text IN ('pending','queued','processing','failed')),
|
||||||
COUNT(*) FILTER (WHERE pos1 IS NOT NULL
|
COUNT(*) FILTER (WHERE pos1 IS NOT NULL
|
||||||
AND radar_status::text IN ('pending','queued','processing','failed')),
|
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
|
COUNT(*) FILTER (WHERE pos1 IS NOT NULL
|
||||||
AND hrrr_status::text IN ('complete','unavailable')
|
AND hrrr_status::text IN ('complete','unavailable')
|
||||||
AND weather_status::text IN ('complete','unavailable')
|
AND weather_status::text IN ('complete','unavailable')
|
||||||
|
|
@ -120,6 +123,7 @@ defmodule MicrowavepropWeb.StatusLive do
|
||||||
weather: weather,
|
weather: weather,
|
||||||
iemre: iemre,
|
iemre: iemre,
|
||||||
radar: radar,
|
radar: radar,
|
||||||
|
mechanism: mechanism,
|
||||||
narr_candidates: narr_candidates,
|
narr_candidates: narr_candidates,
|
||||||
narr_done: narr_done,
|
narr_done: narr_done,
|
||||||
remaining: max(terrain, max(hrrr, max(weather, iemre))),
|
remaining: max(terrain, max(hrrr, max(weather, iemre))),
|
||||||
|
|
@ -461,6 +465,7 @@ defmodule MicrowavepropWeb.StatusLive do
|
||||||
{"terrain", "Terrain", @unprocessed.total - @unprocessed.terrain, @unprocessed.total},
|
{"terrain", "Terrain", @unprocessed.total - @unprocessed.terrain, @unprocessed.total},
|
||||||
{"iemre", "IEMRE", @unprocessed.total - @unprocessed.iemre, @unprocessed.total},
|
{"iemre", "IEMRE", @unprocessed.total - @unprocessed.iemre, @unprocessed.total},
|
||||||
{"radar", "Radar", @unprocessed.total - @unprocessed.radar, @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}
|
{"narr", "NARR", @unprocessed.narr_done, @unprocessed.narr_candidates}
|
||||||
] do %>
|
] do %>
|
||||||
<% pct = if denom > 0, do: round(complete * 100 / denom), else: 0 %>
|
<% pct = if denom > 0, do: round(complete * 100 / denom), else: 0 %>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue