Commit graph

35 commits

Author SHA1 Message Date
dd12a57c2d
Fix SNMP polling: remove invalid timeout option and normalize OID format
System.cmd :timeout option doesn't exist in Elixir 1.19, causing every
poll to crash silently. Also translate SNMPv2-SMI::enterprises prefix
to numeric OID so the lookup maps match correctly.
2026-03-30 13:44:49 -05:00
d3f9f0443e
Fix SNMP version to v1 to match radio firmware 2026-03-30 13:32:11 -05:00
2006e9e052
Chunk Oban.insert_all to avoid PG parameter limit
Weather job fan-out can exceed PostgreSQL's 65535 parameter limit
when many QSOs produce thousands of jobs in a single batch. Chunk
insert_all into batches of 1000 jobs.
2026-03-30 13:31:48 -05:00
3228835636
Add IEM precipitation data to QSO weather pipeline
- Add precip_1h_in and wx_codes fields to ASOS surface observations
- Add IEMRE reanalysis schema for radar-derived hourly precipitation
- Add IemreFetchWorker with exponential backoff and idempotency
- Integrate IEMRE enqueue into cron weather backfill pipeline
- All existing QSOs marked iemre_queued=false for automatic backfill
2026-03-30 13:18:11 -05:00
10e8feb486
Add commercial link monitoring via SNMP polling
Poll UBNT AirFiber radios (AF11X + AF60-LR) every 5 minutes via
net-snmp CLI, storing signal metrics in commercial_samples. Fetches
ASOS weather alongside each cycle for propagation correlation.

Includes 7 seeded link definitions, Oban cron worker, and net-snmp
in the Docker image.
2026-03-30 13:02:59 -05:00
ce4253f412
Loop enqueue workers until all unprocessed QSOs are covered
Previously each run only enqueued 500 QSOs (the query limit).
Now weather, HRRR, and terrain enqueue functions recurse until
no unprocessed QSOs remain.
2026-03-30 10:11:34 -05:00
fdc2a31c77
Fix complex packing bit-padding bug corrupting decoded values
extract_n_values_array used Enum.take(count) on a reversed list
before reversing it, which included padding values from byte
alignment and dropped actual values. When group count * bits
wasn't a multiple of 8, the extra padding bits produced a
phantom value that shifted the entire array by one position.

This caused cascading errors in spatial differencing — values
started correct but diverged exponentially (DPT decoded as
38 billion K instead of 275 K).

Fix: reverse the list first, then take count, so padding values
at the end are discarded instead of actual values at the start.
2026-03-30 09:54:10 -05:00
4ef755f0cf
Download HRRR GRIB ranges individually instead of multi-range
AWS S3 doesn't support multi-range HTTP requests. When given
Range: bytes=0-999, 2000-2999 it ignores the header and returns
the full file (200 instead of 206). Download each range separately.
2026-03-30 09:39:24 -05:00
bb590a3b64
Invert HRRR failure logic: only retry transient network/server errors
Instead of listing every permanent failure string, only retry on known
transient errors (5xx, 429, network exceptions). Everything else —
GRIB decode errors, 404s, range request failures, index out of range —
is cancelled immediately.
2026-03-30 09:28:20 -05:00
8e1fd702f9
Reject HRRR downloads when server ignores Range header
S3 returns 200 with the full ~116MB file instead of 206 for some older
HRRR data. Treat this as a permanent failure instead of trying to parse
the entire file.
2026-03-30 09:26:58 -05:00
5c5d398966
Make GRIB2 section parser resilient to trailing padding and truncation
Instead of returning "malformed section" on trailing bytes or truncated
sections, attempt to return parsed results. This handles older HRRR
files (2019) that have padding bytes after the last section.
2026-03-30 09:21:27 -05:00
38bfd7caed
Add logging to HRRR fetch and parse pipeline 2026-03-30 09:17:37 -05:00
ead34990b0
Fix HRRR pipeline: single concurrency, cancel bad GRIB, rescue stuck jobs
- Reduce HRRR queue to 1 worker to avoid overwhelming upstream
- Add Oban Lifeline plugin to rescue orphaned executing jobs after 30m
- Treat GRIB2 decode errors (malformed section, missing sections, etc.)
  as permanent failures instead of retrying indefinitely
2026-03-30 09:16:07 -05:00
fe9c1a3c5b
Add logging to SRTM elevation fallback chain 2026-03-30 09:02:08 -05:00
2ae60d036b
Add SRTM auto-download on tile miss from AWS Terrain Tiles
When a local .hgt tile is missing, download it from the public AWS S3
skadi bucket, decompress with zlib, and write to the tiles directory
before retrying the lookup. Falls back to Open-Meteo/OpenTopo APIs if
the download fails.
2026-03-30 08:36:21 -05:00
e2f5376355
Cancel HRRR jobs on permanent failures (404, outside_grid)
HTTP 404 means the HRRR data doesn't exist on NOAA S3 (pre-2014
dates, etc.) and will never succeed. Return {:cancel, reason}
instead of {:error, reason} so Oban stops retrying immediately.
2026-03-30 07:53:49 -05:00
3749360a28
Fix complex packing decode crash on trailing padding bits
consume_bits would crash with a MatchError when the remaining
bitstring had fewer bits than the group width. Added a guard
clause to stop consuming when insufficient bits remain, matching
how wgrib2 handles trailing padding in packed data sections.
2026-03-30 07:52:06 -05:00
5a9359191f
Replace wgrib2 with pure Elixir GRIB2 decoder for HRRR pipeline
Eliminates the external wgrib2 C tool dependency that blocked HRRR
processing. Implements Lambert Conformal projection, simple packing
(Template 5.0), complex packing with spatial differencing (Template 5.3),
and GRIB2 section parsing — enough to extract point values from HRRR
grid data using only Elixir.
2026-03-29 18:43:43 -05:00
9334539442
Retry on 429/5xx responses across all HTTP clients
Previously retry: :transient only retried connection errors, not HTTP
429 rate limits. All clients now use a custom retry function that
handles 429, 500, 502, 503, 504 with 5 retries and jittered backoff.
2026-03-29 17:47:08 -05:00
3534b282af
Fix wgrib2 error message — no homebrew formula exists 2026-03-29 17:44:58 -05:00
47456630ff
Add Committed column to QSOs table showing inserted_at 2026-03-29 17:38:35 -05:00
fe3c8812a0
Harden /submit route for production
- Defensive grid-to-coordinate resolution in create_qso (case instead of crash on match failure)
- Log warning when Oban weather enqueue fails instead of silently dropping
- Add 30s per-session submission cooldown to prevent rapid-fire submissions
2026-03-29 17:24:12 -05:00
4468fb3b61
Increase Oban retry attempts and backoff for external API workers
20 attempts with exponential backoff capped at 6 hours ensures
data is eventually fetched even during extended rate limiting or
API outages (~3 days of retrying before giving up).
2026-03-29 17:03:56 -05:00
7d0978f7d5
Add /submit route for user QSO submission
Maidenhead grid module converts grid squares to lat/lon coordinates.
Submission form validates grids, bands, modes, and email, computes
positions and distance, then triggers the weather/HRRR/terrain
processing pipeline via Oban.
2026-03-29 16:46:35 -05:00
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
8bd0989fbe
Add HRRR model profile fetching for QSOs
HRRR provides hourly 3km-resolution atmospheric profiles, filling the
temporal gaps (12-hourly soundings) and spatial gaps (only 9 sounding
stations) in our current weather data.

- Add hrrr_profiles table and hrrr_queued flag on QSOs
- HrrrClient fetches GRIB2 data via HTTP Range requests + wgrib2
- HrrrFetchWorker derives refractivity/ducting params via SoundingParams
- QsoWeatherEnqueueWorker now also enqueues HRRR jobs
- QSO show page displays HRRR section with collapsible profile
- Dockerfile builds wgrib2 from source for production
2026-03-29 15:54:22 -05:00
586d94fceb
Add grid squares to QSO index table 2026-03-29 14:38:47 -05:00
480480bde3
Fix QSO show page weather lookup and add expandable sounding profiles
Fix pos1 longitude key mismatch (lng vs lon) that caused empty weather
results for all QSOs. Bump search radius to 300km for sounding coverage.
Soundings now show as expandable cards with full elevation profile data.
2026-03-29 14:33:14 -05:00
d50c78102d
Backfill missing QSO distances during weather enqueue scan
Adds haversine_km/4 to Radio context and backfill_distances/1 which
calculates distance_km from pos1/pos2 for QSOs missing it. Called
by QsoWeatherEnqueueWorker before enqueueing weather fetches.
2026-03-29 14:16:38 -05:00
c38596cc36
Add QsoWeatherEnqueueWorker cron job to auto-fetch weather for new QSOs
Oban cron worker runs every 4 hours, finds QSOs without weather data,
discovers nearby ASOS/sounding stations, and enqueues WeatherFetchWorker
jobs. Migrations run automatically on app start in production.
2026-03-29 14:11:03 -05:00
5124cc09c1
Add IEM rate limiting, Req retry, and Oban retry for failed weather fetches
IEM was returning 503s under 10 concurrent workers. Three fixes:
- Req transient retry with exponential backoff on IEM requests
- WeatherFetchWorker Oban job retries failed ASOS/RAOB fetches 2-3h later
  with random jitter to avoid thundering herd
- Import script concurrency reduced 10→5, weather queue capped at 3
2026-03-29 13:24:52 -05:00
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
6489f08138
Add weather data schema, context, sounding params, and IEM ingestion
Store surface observations (ASOS) and upper-air soundings (RAOB) alongside
QSOs for atmospheric propagation correlation. Three new tables: weather_stations,
surface_observations, and soundings with JSONB profiles and pre-computed derived
parameters (refractivity, gradients, duct detection, stability indices).

Includes IEM API client for historical data import and import script seeded
with 95 ASOS + 9 sounding stations from PropCast coverage area.
2026-03-28 15:57:19 -05:00
e0ab6560d0
docker 2026-03-28 11:41:31 -05:00
bc674f0d54
initial 2026-03-28 11:28:47 -05:00