Skip to content

evanhutnik/wipercheck-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


WiperCheck
WiperCheck

An API that analyzes your road trip and returns weather conditions along your journey.


This repo is for the loader component of WiperCheck. For the WiperCheck service see here.

Loader

The loader is an optional component for caching forecasted weather data to improve performance. It scans over a configured coordinate grid, retrieving and caching hourly weather data for the following 48 hours.

Logo

Built With

  • Go
  • Redis
  • AWS

How It Works

The loader runs as a continuous job, populating over the specified area in a loop. Once retrieved from OpenWeather, the forecasted weather data is cached using redis' geospacial functionality. This feature allows a user to pass in a coordinate, to which redis will return the coordinates in the database closest to it. By setting the key value of the weather data saved in redis to the unix time of the weather information and the name to the weather data, the service can find the closest cached weather data to a given coordinate at a given time in a simple query.

Logo

Getting Started

For deploying to AWS, see wipercheck-infra. The below steps are for local development.

Prerequisites

  • Go 1.17 or later
  • A redis cluster for caching the forecasted weather data

Installation

  1. Clone the repo

    git clone https://github.com/evanhutnik/wipercheck-loader.git
  2. Get an API key for OpenWeather

  3. Add file named .env to root of project with the following fields:

    loader_start_lat=47.875
    loader_start_lon=83.923
    loader_stepdistance=10
    loader_duration=60
    openweather_apikey={api key}
    openweather_baseurl=https://api.openweathermap.org/data/2.5/onecall
    redis_address={redis url}

    loader_start_lat: The latitude of the cache start point.

    loader_start_lon: The longitude of the cache start point.

    loader_stepdistance: The distance, in kilometres, between each cached location. The points are cached in a grid shape, so a value of 10 would result in locations being cached every 10km east-west as well as north-south.

    loader_duration: The amount of time, in seconds, it will take to complete an entire cache cycle. Ex. a value of 3600 seconds would result in a 60x60 grid east/south of the starting point.

  4. Build the loader

    go build -o ./bin/wipercheck-loader ./cmd/loader/main.go
  5. Run the executable

    ./bin/wipercheck-loader

Acknowledgments

  • DALL-E for generating the WiperCheck logo
  • Will for helping with the CDK code

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors