https://github.com/phoffer/weather
Demo app using free APIs to get weather forecasts
https://github.com/phoffer/weather
Last synced: about 1 year ago
JSON representation
Demo app using free APIs to get weather forecasts
- Host: GitHub
- URL: https://github.com/phoffer/weather
- Owner: phoffer
- Created: 2024-08-22T15:22:37.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-19T09:38:38.000Z (over 1 year ago)
- Last Synced: 2025-05-18T03:12:10.158Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# README
This is an app to demo getting a weather forecast from an address (or otherwise geocodable string).
## Setup
The only system dependencies are Ruby, Node, and Yarn. This app does not include a data store of any kind. The setup instructions are for `asdf` users; for others, see the versions required in `.tool-versions`.
```bash
git clone git@github.com:phoffer/weather.git
cd weather
asdf install
bundle install
yarn install
```
## Running the app
After having the dependencies installed, run the app with `bin/dev`.
## Architecture
There are 3 main modules that handle the business logic.
1. Geocoder
1. Weather
1. Meteorologist
### Geocoder
Geocoder is responsible for taking an address and performing geocoding via the Nominatim service from OpenStreetMap. It will return latitude, longitude, and zip code for a given search. If there is not a result, it will raise an error.
### Weather
Weather accepts latitude and longitude, and will request a weather forecast from the Open-Meteo service. This will return the current weather conditions (temperature and precipitation), and also those conditions for the next 7 days. If there is an issue performing this request, it will raise an error.
### Meteoroligst
Meteorologist is responsible for the primary action of gathering weather conditions for a given address. It accepts an address, utilizes `Geocoder` and `Weather` to geocode and get the weather information, and it also handles the caching of weather forecasts by zip code.
## Shortcomings
### External requests
There is some incongruence between our desires for caching, and our techniques for geocoding and requesting weather. Mainly, that we want to cache weather by zip code, but we do not necessarily require zip code in the search. We accept any geocodable input. Due to this, we must perform a geocode for each request in the current design. After finding the zip code, we are then able to check cache for a weather forecast.
This means the scalability of this current design is rather low, and it would take either a UX redesign (request weather by zip code only) or backend changes (creating our own geographic dataset) to improve.