97 lines
3.1 KiB
Markdown
97 lines
3.1 KiB
Markdown
# Package `standards`
|
|
|
|
## Import Path
|
|
|
|
```go
|
|
import "gitea.maximumdirect.net/ejr/weatherfeeder/standards"
|
|
```
|
|
|
|
## Purpose
|
|
|
|
Package `standards` defines stable identifiers and shared weather constants used
|
|
by `weatherfeeder` producers and Go consumers.
|
|
|
|
Use this package when switching on event schemas, comparing event kinds, or
|
|
working with canonical WMO condition codes.
|
|
|
|
## Event Kind Constants
|
|
|
|
Current event kind constants are:
|
|
|
|
| Constant | Value |
|
|
|---|---|
|
|
| `KindObservation` | `observation` |
|
|
| `KindForecast` | `forecast` |
|
|
| `KindForecastDiscussion` | `forecast_discussion` |
|
|
| `KindWeatherStory` | `weather_story` |
|
|
| `KindAlert` | `alert` |
|
|
| `KindOutlook` | `outlook` |
|
|
|
|
These are plain string constants. Convert them at adapter boundaries when using
|
|
feedkit's `event.Kind` type.
|
|
|
|
## Canonical Schema Constants
|
|
|
|
Canonical schemas emitted after normalization:
|
|
|
|
| Constant | Value |
|
|
|---|---|
|
|
| `SchemaWeatherObservationV1` | `weather.observation.v1` |
|
|
| `SchemaWeatherForecastV1` | `weather.forecast.v1` |
|
|
| `SchemaWeatherForecastDiscussionV1` | `weather.forecast_discussion.v1` |
|
|
| `SchemaWeatherStoryV1` | `weather.weather_story.v1` |
|
|
| `SchemaWeatherAlertV1` | `weather.alert.v1` |
|
|
| `SchemaWeatherOutlookV2` | `weather.outlook.v2` |
|
|
|
|
Historical canonical schema constant:
|
|
|
|
| Constant | Value |
|
|
|---|---|
|
|
| `SchemaWeatherOutlookV1` | `weather.outlook.v1` |
|
|
|
|
## Raw Schema Constants
|
|
|
|
Raw source schemas emitted by current registered sources:
|
|
|
|
| Constant | Value |
|
|
|---|---|
|
|
| `SchemaRawNWSObservationV1` | `raw.nws.observation.v1` |
|
|
| `SchemaRawOpenMeteoCurrentV1` | `raw.openmeteo.current.v1` |
|
|
| `SchemaRawOpenWeatherCurrentV1` | `raw.openweather.current.v1` |
|
|
| `SchemaRawNWSHourlyForecastV1` | `raw.nws.hourly.forecast.v1` |
|
|
| `SchemaRawNWSNarrativeForecastV1` | `raw.nws.narrative.forecast.v1` |
|
|
| `SchemaRawNWSForecastDiscussionV1` | `raw.nws.forecast_discussion.v1` |
|
|
| `SchemaRawNWSWeatherStoriesV1` | `raw.nws.weatherstories.v1` |
|
|
| `SchemaRawOpenMeteoHourlyForecastV1` | `raw.openmeteo.hourly.forecast.v1` |
|
|
| `SchemaRawNWSAlertsV1` | `raw.nws.alerts.v1` |
|
|
| `SchemaRawSPCConvectiveOutlookV1` | `raw.spc.convective_outlook.v1` |
|
|
|
|
Additional raw schema constant:
|
|
|
|
| Constant | Value |
|
|
|---|---|
|
|
| `SchemaRawOpenWeatherHourlyForecastV1` | `raw.openweather.hourly.forecast.v1` |
|
|
|
|
`SchemaRawOpenWeatherHourlyForecastV1` exists in code, but no current registered
|
|
source emits it. Consumers should not expect that raw schema unless a later
|
|
registered source documents it as part of the current event contract.
|
|
|
|
## WMO Constants And Text
|
|
|
|
`standards` also defines the canonical `WMOCode` vocabulary and text helpers
|
|
used by normalized observations and forecasts.
|
|
|
|
Consumer guidance:
|
|
|
|
- Treat `WMOUnknown` as unknown condition data.
|
|
- Observation `conditionCode` is required in the current event contract.
|
|
- Forecast period `conditionCode` is optional because some forecast products do
|
|
not provide a meaningful WMO condition.
|
|
- Prefer WMO constants and helper functions from this package instead of
|
|
duplicating code tables in consumers.
|
|
|
|
## Boundaries
|
|
|
|
`standards` is provider-agnostic. Provider-specific parsing belongs in
|
|
`weatherfeeder` internals, not in this package and not in consumers.
|