This web app was written to serve the needs of a hands-on workshop. Much of the data preparation work is automated.
The source data was downloaded as a csv and is served via a PostgreSQL database. The prediction feature can use one of two data sources.
csv files
that contain prediction data with 720 data pointsApache Kafka
which simulates data as it would be streamed from sensors
Last tested with:
- Python 3.8
- OpenShift 4.10
- Shell: bash
- OS: mac,linux (various)
- Podman 4.4.4
- DBeaver 23.*
You can find the workshop instructions here
You can view the default parameters for bootstrap.sh
here.
For more info about interacting with the database in OpenShift look here
# workshop user parameters
# note: run this ONLY if you are a WORKSHOP USER before bootstrap.sh
export NAMESPACE=$(oc whoami)
export DB_HOSTNAME="predict-db.edge-failure-prediction.svc.cluster.local"
export KAFKA_HOSTNAME="kafka-cluster-kafka-bootstrap.edge-kafka.svc.cluster.local"
scripts/bootstrap.sh
Setup local postgres container
. scripts/bootstrap.sh
container_setup_db
Setup local development
Note: Python version 3.9+ may fail. replace python3
with python3.8
if needed.
The following section only needs to be run once
python3 -m venv venv
# activate your virtual env with the following
. venv/bin/activate
pip install -r src/requirements.txt
Run local web app
# custom connection example
export DB_HOSTNAME="waterpump.ci3tyclo8vsc.us-east-1.rds.amazonaws.com"
export DB_DATABASE="postgres"
export DB_USERNAME="postgres"
export DB_PASSWORD="FR2s3rv2ll3y"
export DB_PORT="5432"
# reactivate your virtual env with the following
. venv/bin/activate
cd src
python3 wsgi.py
Run local Jupyter Notebook
pip install -r notebooks/requirements.txt
jupyter-lab
Data preparation to train the model is an adaptation the work done by Xiaxiau: here
Source of the data used in this application is found: here
The ML model used in this application needs improvement, particularly in the prediction. The next version will include those improvements.
- Audrey Reznik
- Cameron Garrison
- Cory Latschkowski
- Eli Guidera