apostolosT / Weather-Tracker-System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weather Tracking System

Implemented:

  • Weather Agent API:

    • Weather Agent CRUD endpoints with access to mongoDB
    • Weather Agent get city last weather data endpoint
    • Schedule daily background tasks for daily data collection at specific time of day
    • CRUD endpoints unit tests
  • Weather Service API:

    • Current Weather Data Collection from OpenWeatherMap
    • OpenAPI (Swagger) specification support
    • Caching OpenWeatherMap API responses with Redis backend. Redis key is the city name and the values are the external api's response. Keys expire after we specify elapsed time after storing it in cache.
    • Docker Image
    • Tests
  • Docker Compose YAML for running the system

ToDOs

  • Unit test GetCurrentWeatherData response before storing into database
  • API internalization

Run System

Using Docker

Download repo and from weather tracker directory run:

$ docker-compose build
$ docker-compose up -d

Weather Agent API

To access the Weather Service API endpoints, execute the following commands:

To add a city to city watch list:

curl -XPOST -H 'Content-Type: application/json' http://localhost:5000/WeatherAgent/insert_city -d '{"city": "Volos"}'

To remove a city from watch list:

curl -XDELETE -H 'Content-Type: application/json' http://localhost:5000/WeatherAgent/delete_city/Volos

To get a list of tracked cities:

curl -i "http://localhost:5000/WeatherAgent/ListCities"

To get city's last weather data:

curl -i "localhost:5000/WeatherAgent/get_city_weather_data" -d "city"="Volos"

cities_collection

Weather Service API

To access the Weather Wervice API head to <docker-hosted-service-url/weather_service> and inspect the API documentation via swagger ui.

cities_collection

Weather Agent API

MongoDB collections instances

cities_collection

About


Languages

Language:HTML 45.7%Language:JavaScript 23.3%Language:Python 19.3%Language:CSS 11.3%Language:Dockerfile 0.4%