A web app that forecasts daily and cumulative COVID-19 cases in South Africa using ARIMA modeling. It scrapes real-time data, provides a 7-day forecast, and displays interactive graphs and tables.
COVID-19 Forecasting System
Overview
This project provides a system to track COVID-19 cases in South Africa and predict the number of new cases over the next seven days using ARIMA modeling. The system involves scraping the latest COVID-19 statistics, applying machine learning to forecast future cases, and presenting the results via a web interface.
Components
1. Data Ingestion
The system scrapes the number of daily COVID-19 cases in South Africa from Worldometers.
URL:
worldometers.info
The scraping is performed using BeautifulSoup to extract the daily cases.
2. Modeling
The data is processed and modeled using the ARIMA (AutoRegressive Integrated Moving Average) method from the statsmodels library.
ARIMA is used to predict new COVID-19 cases for the next seven days based on past data.
The model is trained using daily new cases obtained from the scraped data.
3. Simple Reporting
The forecast results (for the next 7 days) are saved in a CSV file: forecasted_covid_data_7_days.csv.
A time series plot of the forecasted data is saved as a PNG file: forecast_plot.png.
A .txt file with recommendations for improving the forecasting system is generated.
4. Web Application (Bonus Task)
A simple web interface displays the forecasting results in a table and as time series plots.
The API provides two routes: /forecast and /original, exposing the forecasted and original COVID-19 data.
Project Structure
.
├── 2024 ASSESSMENT/
│ ├── app.py # Flask app for API
│ ├── forecast.js # JavaScript for frontend (API interaction and plotting)
│ ├── forecasted_covid_data_7_days.json # Forecasted data in JSON format
│ ├── index.html # Frontend HTML page
│ ├── main.py # Main script that runs the entire system
│ ├── model.py # Data scraping, processing, and forecasting script
│ ├── original_covid_data.json # Original C …