fct_weather_hourly
I keep temperature, humidity, precipitation and wind by city and time. Weather-model observations retain their valid time.

I wanted weather, air quality and bike availability in one place. The awkward part was keeping the meaning of each source intact as it moved through the application.
Open-Meteo weather, CAMS air data and Vélib' GBFS snapshots. Each has its own schema, timestamps, geography and idea of what's current.
The original payload, its source time and the result of processing it. I wanted to be able to follow a reading back when it needed an explanation.
I split the path into four stages, from fetching a provider response to showing it in the app. The live deployment uses a direct collector; Kafka and dbt belong to the optional platform. Each stage below shows where that distinction matters.
I fetch the sources through server-side adapters. Open-Meteo supplies weather, CAMS supplies modeled air and Vélib' supplies Paris bike snapshots. Casablanca has weather and air, but no verified GBFS feed. OpenAQ is an optional air provider that needs an API key.
I normalize the feeds into separate observations before combining them at the city hour. That gives the API a shared time boundary without treating a station snapshot like a weather reading. These are the analytical models in the dbt path.
I keep temperature, humidity, precipitation and wind by city and time. Weather-model observations retain their valid time.
I keep the location, pollutant, source unit and valid time, including whether the value is modeled or measured. Different units stay distinct.
I retain station capacity, available bikes and docks with the collection time. A change in inventory is not enough to call it a trip count.
I join the hourly city signals at matching UTC boundaries. The API reads this mart only when DBT_ENABLED is enabled; otherwise it uses normalized data.
Vélib's status document uses lastUpdatedOther where the adapter also needs to handle GBFS's last_updated field. Accepting both was a small fix, but it points to a larger distinction: when I fetch a response isn't necessarily when the source observed it.
I retain the original JSON before parsing it. If a response is malformed, the payload is still available to inspect alongside the failed run. I don't replace a failed live provider with a fixture.
In the Kafka path, I expect repeated delivery. Content IDs and unique observation keys prevent duplicate rows, and the consumer advances its offset after the database commit.
I leave missing readings as null and keep freshness thresholds specific to each source. The interface distinguishes unavailable, stale and current signals, even when that leaves an empty metric.
I store observations in UTC and use city-local time for display. Replay applies an at-or-before cutoff to each signal separately, using the observations actually retained in storage.
The repository has more moving parts than the live site needs. I kept a smaller production setup and made the extra platform services optional. There are costs on either side of that choice.
For this version, one production database and a direct collector are enough to support the city view. The optional platform keeps the other processing path available without making it a requirement for serving the app.
A longer replay window would mean revisiting retention and storage. Another city would start with verifying its providers. Casablanca's missing mobility feed is still a source problem, however much I change the interface around it.
Built with