Bringing It All Together: Orchestrating Data Pipelines with Airflow, Weather.gov, and FastAPI 🌦️🚀

So, you’ve got weather data from the Weather.gov API. You’ve built a FastAPI app that transforms and stores data using a Type 2 Slowly Changing Dimension (SCD) model. And now you’re wondering: “How do I tie this all together in a way that looks effortless but secretly makes me feel like a data wizard?” Enter Airflow, the glue that orchestrates your data pipeline. Today, we’re bringing together orchestration, transformation, and storage into a single, elegant workflow that will: ...

December 2, 2024 · 4 min · 781 words · Wes

Building a Weather Forecast API with FastAPI and PostgreSQL - Part 4 🐳

In the last article we talked about making our pydantic documentation as robust as possible. In this part, we’ll focus on containerizing the Weather Forecast API using Docker. By the end of this tutorial, your API will be running inside a Docker container, alongside a PostgreSQL database, all orchestrated using Docker Compose. Why Dockerize? 🛠️ Docker simplifies application deployment by packaging your application and its dependencies into a portable container. With Docker: ...

November 29, 2024 · 4 min · 654 words · Wes

Building a Weather Forecast API with FastAPI and PostgreSQL - Part 3 🤖

In the first two parts of this series (previous article), we laid the foundation for our weather forecast API and explored how to handle forecasts and historical revisions efficiently. In this part, we’ll focus on optimizing our Pydantic models to make the API documentation more accessible to AI tools, such as those that scrape OpenAPI specs for training or dynamic usage. The Problem 🧠 While your API might work perfectly for humans, AI tools often need more context and structure to understand it effectively. For example: ...

November 28, 2024 · 5 min · 867 words · Wes

Building a Weather Forecast API with FastAPI and PostgreSQL - Part 2 🌪️

In the first part of this series, we set up a FastAPI application with a PostgreSQL database to store weather forecasts. We also designed a robust schema that tracks changes over time using a composite primary key. If you missed it, check out Part 1. In this post, we’ll: Create query endpoints to fetch forecasts. Implement a type-2 SCD approach for tracking forecast revisions. Discuss strategies for filtering and pagination. The Challenge 🧠 Weather forecasts often change over time as meteorological data improves. To support historical analysis and ensure data consistency, we need to: ...

November 27, 2024 · 4 min · 710 words · Wes

Building a Weather Forecast API with FastAPI and PostgreSQL - Part 1 🌦️

When I set out to create a weather forecast API, I wanted something scalable, efficient, and built on modern technology. What started as a simple project to integrate weather data from the weather.gov API quickly grew into a complex, yet rewarding system. To keep things manageable, I decided to break this journey into multiple parts. In this post, I’ll cover the foundational steps to get started: setting up FastAPI, creating the database, and handling weather data with a robust schema. ...

November 26, 2024 · 4 min · 811 words · Wes

🌦️ Exploring Weather Service Api

Building a personal data project starts with gathering data. What better way to start than by exploring a free and well-documented API? In this article, we’ll dive into the National Weather Service API (api.weather.gov) to understand how it works, and we’ll write Python code to retrieve and explore weather data. So… what are you going to be doing? Let’s read through the docs and try to understand how to navigate the API.📜 I’m gonna write some Python code to fetch weather data. I’m gonna analyze the data structure of the forecastHourly endpoint. 📍 Understanding the API The National Weather Service API organizes data using a grid-point system. Each grid point covers an area of 2.5 km x 2.5 km. The /points endpoint is where you get information about retrieving data for a specific location. ...

November 25, 2024 · 4 min · 792 words · Wes