prop/lib/microwaveprop/radio/qso.ex
Graham McIntire 45e2e69361
Add SRTM terrain path profiles for QSOs
Fetch elevation data along the path between two stations via the
Open-Meteo Elevation API (with Open-Topo-Data fallback), compute
Fresnel zone clearance, earth bulge, and knife-edge diffraction loss,
and store the results per QSO.

- terrain_profiles table with migration and TerrainProfile schema
- ElevationClient with batched API calls and fallback
- TerrainAnalysis with Fresnel/diffraction physics (ITU-R P.526-15)
- TerrainProfileWorker on Oban :terrain queue
- QsoWeatherEnqueueWorker enqueues terrain jobs automatically
- QSO show page displays verdict badge and collapsible elevation table
- Reorder show page: terrain, soundings, solar, HRRR, surface obs
- Fix Dockerfile wgrib2 build (add cmake dependency)
2026-03-29 16:22:29 -05:00

36 lines
953 B
Elixir

defmodule Microwaveprop.Radio.Qso do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
schema "qsos" do
field :station1, :string
field :station2, :string
field :qso_timestamp, :utc_datetime
field :grid1, :string
field :grid2, :string
field :pos1, :map
field :pos2, :map
field :mode, :string
field :band, :decimal
field :distance_km, :decimal
field :weather_queued, :boolean, default: false
field :hrrr_queued, :boolean, default: false
field :terrain_queued, :boolean, default: false
timestamps(type: :utc_datetime)
end
@required_fields ~w(station1 station2 qso_timestamp mode band)a
@optional_fields ~w(grid1 grid2 pos1 pos2 distance_km)a
def changeset(qso, attrs) do
qso
|> cast(attrs, @required_fields ++ @optional_fields)
|> validate_required(@required_fields)
end
end