DEV Community

Cover image for Build a weather observation table that can admit it is stale
Tim Zinin
Tim Zinin

Posted on

Build a weather observation table that can admit it is stale

A station dashboard can display a plausible temperature long after its source stopped updating. That is a data freshness problem before it is a visualization problem. A useful ingestion table needs both the source observation time and the time your pipeline checked the source. Replacing an old value with the same old value does not make the observation new.

The NOAA METAR extractor is useful for a bounded observation import. It retrieves reports for known ICAO station identifiers and preserves the raw report alongside decoded measurements. The upstream Aviation Weather Center API documents the observation source. This workflow is for inspecting data freshness, not for making flight decisions or producing forecasts.

Start with a small station set

The example below uses the installed input contract. With hours set to zero, the request asks for the latest report for each station. maxAgeMinutes expresses the maximum acceptable observation age. A result that does not satisfy freshness must not silently replace the last known useful observation as though a fresh reading arrived.

{
  "stationIds": [
    "KJFK",
    "EGLL"
  ],
  "hours": 0,
  "maxObservations": 20,
  "maxAgeMinutes": 180
}
Enter fullscreen mode Exit fullscreen mode

Use stationId together with observedAt as an observation key. Store checkedAt separately as ingestion evidence. If a later check returns the same observation, an upsert on that composite key avoids manufacturing an additional measurement. Preserve the full raw report so an analyst can compare the decoded projection with its source.

Keep the units in the model

The projection uses Celsius for temperature and dewpoint, knots for wind speed, statute miles for visibility and hectopascals for the altimeter setting. Label those units in your column definitions. A numeric column called wind is insufficient when another feed uses a different unit.

Visibility can contain a qualifier such as 10+. Keep that qualifier as a source value. Turning it into exactly ten creates precision the observation did not supply. A chart can offer a separate normalized display value, but it should retain the original field and document that transformation.

Route absence and staleness explicitly

Create separate routes for fresh observations, stale observations and source failures. An error during today's check should not erase yesterday's stored observation. It should change the current ingestion status and make the age of the displayed evidence visible.

The accepted input supports one to twenty stations, a history window from zero through twenty-four hours, and a bounded observation count of at most four hundred. Those are request bounds, not a promise that every station has a report in that window. Source availability and the observation publication schedule still determine what can be returned.

Test the consumer before scheduling it

Give the consumer three saved cases: a fresh report, an explicitly stale report and a source error. Check that only the fresh case enters the current-observations view. Check that all three cases remain inspectable in the ingestion log. This can be a local fixture exercise; it does not require repeatedly running the Actor merely to populate a dashboard.

For a historical README example, preserve its historical date. A September observation does not establish October weather or current station availability. The smallest useful acceptance test is that your application shows the source timestamp, preserves qualifiers and refuses to present stale evidence as a new measurement.

Cost and verification scope

The current FREE-tier result price is $0.0005 for the documented unit: One complete METAR observation for one station and observation time. The listing also has a $0.003 start event, charged per GB of Actor memory with a minimum of one event. A free diagnostic row does not refund that start event. Discounted platform tiers have their own rates; inspect your applicable tier before estimating a batch. These are listing prices read on 21 October 2026, not a receipt or a claim about customer spending.

The contract for this draft was checked against installed build 0.1.3 (gNszycUKocca6593j). The input above is an illustrative schema example, not a newly executed run. Current source responses and useful output still need inspection when you choose to run it. No new cloud build or run was made to prepare this article.

Open the Actor and inspect its input and pricing.

AI-assisted draft; publication requires independent technical review.

Top comments (0)