Weather Alert Application

Overview

This project is a distributed application that uses the Open Weather API to provide accurate and up-to-date weather information to its users. The app will provide valuable information to users, such as forecasts for the near future, long-term weather trends, and immediate alerts in case of extreme weather conditions. To ensure data consistency and accessibility, we will deploy Docker containers to run the web application and Kafka to handle real-time data streams. Additionally, we will use a Python pipeline to process the obtained weather data and save it to a Mongodb database for future analysis.

Project Map

Using Open Weather, Python, Kafka, and MongoDB in combination, a comprehensive machine learning pipeline can be developed to gather, process, examine, visualize, and transmit data. Open Weather can be utilized to gather data, Python can be employed for analysis, and MongoDB can be utilized to store the data. Lastly, the data can be transmitted to users through Kafka, providing for their needs.

Manual Setup

You can avoid this configurational step by using the Docker installation process.

Perform the following steps:

1- Download and install Node.js. 2- Download and install Python (>= 3.9). 3- Download and install Kafka. 4- Download and install Mongodb (6.0). 5- Download and install Visual Studio Code(VS Code). 6- Install Vetur, Better Comments, Docker, Python, GitHub Theme extensions for VS Code To enjoy the code. 7- Clone this repository. 8- Connect to the MongoDB 6.0 server by running the following command:

mongosh mongodb://localhost:27017

9- Navigate to the Kafka installation directory using the “cd” command. For example, if you installed Kafka in “C:\kafka_2.13-2.8.1“, type the following command and press enter:

cd C:\kafka_2.13-2.8.1

Start the ZooKeeper server (if not already running) by entering the following command:

.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties

In a separate command prompt window, start the Kafka broker by entering the following command:

.\bin\windows\kafka-server-start.bat .\config\server.properties

10- Start The Express Server: Update the line 14

mongodb://root:example@localhost:27017/mydatabase?authSource=admin

Enter the following commands:

cd backend
npm install
node index.js

11- Start The Vue app by entering the following commands:

cd frontend
npm install
npm run serve

12- Start The Analysis server by entering the following commands:

cd analysis-servers
pip install --no-cache-dir -r requirements.txt
python daily-analytics.py

13- Start The Alert server by entering the following commands:

cd alert-server
pip install --no-cache-dir -r requirements.txt
python alert-server.py

14- Start The Collect server by entering the following commands:

cd collect-server
pip install --no-cache-dir -r requirements.txt
python collect-server.py

Now, You can now access the server at http://localhost:8080/.

Docker Setup

Make sure Docker is installed.

Spin up the containers

docker-compose up -d --build

Running the command will expose 7 services with the following ports:

  • Alert-server:9000
  • Analysis-server:8000
  • Backend:3000
  • Frontend:8080
  • Kafka:9092|9093
  • Zookeeper:2181
  • Mongodb:2181

You can now access the server at http://localhost:8080/.

App preview

Want more details?

For more details or if you want to recommend me for other projects. Just contact me on my email: [email protected]

GitHub

View Github