prop/lib/microwaveprop/weather/solar_index.ex
Graham McIntire 6f16395f44
Add QSO import, solar indices, Oban workers, LiveView UI, and parallel weather import
- Radio context with QSO schema and CSV import script (58K contacts)
- Solar index schema, GFZ client, and daily Oban cron worker
- LiveView dashboard with QSO table and weather correlation views
- Parallelize weather import script using Task.async_stream (10 concurrent workers)
- Replace sequential rate_limit sleeps with concurrency-based backpressure
- Atomic progress counter for interleave-safe reporting
2026-03-29 13:04:55 -05:00

29 lines
722 B
Elixir

defmodule Microwaveprop.Weather.SolarIndex do
@moduledoc false
use Ecto.Schema
import Ecto.Changeset
@primary_key {:id, :binary_id, autogenerate: true}
schema "solar_indices" do
field :date, :date
field :sfi, :float
field :sfi_adjusted, :float
field :sunspot_number, :integer
field :ap_index, :integer
field :kp_values, {:array, :float}
timestamps(type: :utc_datetime)
end
@required_fields ~w(date)a
@optional_fields ~w(sfi sfi_adjusted sunspot_number ap_index kp_values)a
def changeset(solar_index, attrs) do
solar_index
|> cast(attrs, @required_fields ++ @optional_fields)
|> validate_required(@required_fields)
|> unique_constraint([:date])
end
end