Skip to content

davidcavazos/predictive-maintenance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Predictive Maintenance for Water Utilities

Setup

First, make sure you have installed the Google Cloud SDK.

Then, you will need to create a new Google Cloud project.

PROJECT_ID=your-project-id
gcloud projects create $PROJECT_ID

Once you have a project, you will also need to create a Cloud Storage bucket.

BUCKET_NAME=your-bucket-name
gsutil mb gs://$BUCKET_NAME

Generating data

Please follow the data-generator.ipynb interactive notebook. This notebook will go through all the steps and explanations on how to create the datasets, upload them to BigQuery, and train the BigQuery ML model.

Running the app

Once you have the data, you can now run the applications

To run the app, you have two options: to run it on Google Cloud, or to run it locally.

Running locally is only recommended for development and testing. It won't be available to anyone outside your own local computer, and it won't run very fast.

It is recommended to run on Google Cloud once you are happy with your results. It will run globally and accessible to anyone on the Internet.

Option A: Deploying to App Engine

Deploying will take a couple minutes, but after that the application will autoscale to match the current load of the application.

# Deploy the servr with the BigQuery integration.
bash server/deploy.sh

# Deploy the Angular web application.
bash webapp/deploy.sh

Option B: Running locally

You will need to run the server and the web application on different terminals.

#===--- Terminal A ---===#

# Create and activate a virtual environment.
python3 -m virtualenv env
source env/bin/activate

# Install dependencies.
pip install -U -r requirements.txt

# Run the server locally.
python server/main.py

Now that the server is running, you can now run the web application on another terminal.

#===--- Terminal B ---===#

# Serve the web application.
cd webapp
ng serve

Once everything is running, you can browse to the app at localhost.

http://localhost:5000