prop/lib/mix/tasks/reset_enrichment.ex
Graham McIntire ded9c054ac
Multi-point path enrichment for HRRR, IEMRE, and weather data
Enqueue worker now gathers atmospheric data at pos1, midpoint, and pos2
along each QSO path instead of only pos1. Existing has_* guards prevent
duplicate fetches at each grid point.

- Add Radio.qso_path_points/1 for path point extraction
- Update hrrr_job_for_qso, iemre_job_for_qso, jobs_for_qso to iterate path points
- Refactor Weather into find_nearest_hrrr/3 and find_nearest_iemre/3
- Add hrrr_profiles_for_path/1 and iemre_for_path/1 query functions
- Add mix reset_enrichment task to trigger re-processing
2026-03-30 16:09:01 -05:00

33 lines
909 B
Elixir

defmodule Mix.Tasks.ResetEnrichment do
@shortdoc "Reset weather/HRRR/IEMRE enrichment flags for re-processing"
@moduledoc """
Resets weather, HRRR, and IEMRE enrichment flags on all QSOs so the
next enqueue worker run re-processes them with multi-point path data.
Does NOT reset terrain_queued since terrain profiles are path-based (pos1→pos2)
and don't change with multi-point enrichment.
mix reset_enrichment
"""
use Mix.Task
import Ecto.Query
alias Microwaveprop.Radio.Qso
alias Microwaveprop.Repo
@impl Mix.Task
def run(_args) do
Mix.Task.run("app.start")
{count, _} =
Qso
|> where([q], q.weather_queued == true or q.hrrr_queued == true or q.iemre_queued == true)
|> Repo.update_all(set: [weather_queued: false, hrrr_queued: false, iemre_queued: false])
Mix.shell().info("Reset enrichment flags on #{count} QSOs")
:ok
end
end