Document current conditions consensus selection
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful

This commit is contained in:
2026-06-29 12:03:57 +00:00
parent 86fd848a6f
commit 8578db99b3
3 changed files with 17 additions and 10 deletions

View File

@@ -162,8 +162,10 @@ GET /observations?units=us&precision=1
GET /conditions/current GET /conditions/current
``` ```
Returns current conditions aggregated from recent `observations` rows. The Returns current conditions from recent `observations` rows. Numeric fields are
implemented observation window is 30 minutes. aggregated over the implemented 30-minute observation window. `conditionCode`
is selected from the latest observation per source in that window by
source-balanced WMO family consensus.
Query parameters: `format`, `units`, `precision`. Query parameters: `format`, `units`, `precision`.
@@ -171,6 +173,7 @@ Common `data` fields:
| Field | Type | Notes | | Field | Type | Notes |
| --- | --- | --- | | --- | --- | --- |
| `conditionCode` | integer | WMO weather code selected by source-balanced family consensus |
| `conditionText` | string | optional text derived from WMO code and day/night flag | | `conditionText` | string | optional text derived from WMO code and day/night flag |
| `isDay` | boolean | optional | | `isDay` | boolean | optional |
| `relativeHumidityPercent` | number | optional | | `relativeHumidityPercent` | number | optional |

View File

@@ -57,8 +57,10 @@ Latest parent resources use these ordering rules:
story_order ASC, story_index ASC`. story_order ASC, story_index ASC`.
- convective outlook runs: `as_of DESC, event_emitted_at DESC`. - convective outlook runs: `as_of DESC, event_emitted_at DESC`.
Current conditions aggregate `observations` rows where `observed_at` is inside Current conditions aggregate numeric values from `observations` rows where
the application-provided observation window. `observed_at` is inside the application-provided observation window. They also
use the latest row per `event_source` in that window to select `condition_code`
by source-balanced WMO family consensus.
## Child Ordering ## Child Ordering
@@ -79,15 +81,16 @@ The repository reads only these columns.
### `observations` ### `observations`
`event_id`, `station_id`, `station_name`, `observed_at`, `condition_code`, `event_id`, `event_source`, `station_id`, `station_name`, `observed_at`,
`is_day`, `text_description`, `temperature_c`, `dewpoint_c`, `condition_code`, `is_day`, `text_description`, `temperature_c`, `dewpoint_c`,
`wind_direction_degrees`, `wind_speed_kmh`, `wind_gust_kmh`, `wind_direction_degrees`, `wind_speed_kmh`, `wind_gust_kmh`,
`barometric_pressure_pa`, `visibility_meters`, `relative_humidity_percent`, `barometric_pressure_pa`, `visibility_meters`, `relative_humidity_percent`,
`apparent_temperature_c`, and `event_emitted_at`. `apparent_temperature_c`, and `event_emitted_at`.
Current conditions additionally aggregate recent `observations` values for Current conditions additionally read recent `observations` values for
temperature, apparent temperature, dewpoint, humidity, wind speed, wind temperature, apparent temperature, dewpoint, humidity, wind speed, wind
direction, condition code, and latest `is_day`. direction, latest `is_day`, and latest condition-code candidates per
`event_source`.
### `observation_present_weather` ### `observation_present_weather`

View File

@@ -76,8 +76,9 @@ successful responses with `data: null`.
- `LatestObservation`: latest row from `observations`, then present-weather - `LatestObservation`: latest row from `observations`, then present-weather
rows from `observation_present_weather`. rows from `observation_present_weather`.
- `CurrentConditions`: aggregates recent rows from `observations` using the - `CurrentConditions`: reads an aggregate row from recent `observations` using
application-provided observation window. the application-provided observation window, then reads the latest
condition-code candidate per `event_source` in the same window.
- `LatestAlertRun`: latest row from `alert_runs`, then child `alerts` and - `LatestAlertRun`: latest row from `alert_runs`, then child `alerts` and
`alert_references`. This is the latest stored alert snapshot. The repository `alert_references`. This is the latest stored alert snapshot. The repository
maps both `ends` and `expires`; active-time filtering is performed by the maps both `ends` and `expires`; active-time filtering is performed by the