Skip to content

arturodmor/GreenWater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GreenWater

A Python package to deploy FastAPI capable to optimize the water purification dosing process of the chemical "xy". The structure contains a SQLite3 database that collect measurements from sensors A and B with the information cleaned. Also, it has integrated regression model to train and predict de chemical dosing.

Installation

  1. If the user wants to isolate dependencies, he can install a virtual environment as follows:
    python -m venv GreenWater
    source GreenWater/bin/activate  # En Windows: GreenWater\Scripts\activate
  2. Install dependencies with a conda environment:
    conda env create --name GreenWater --file environment.yml
  3. If the user prefers use requirements:
    pip install -r requirements.txt
  4. To install the package GreenWater with setup file:
    pip install -e .

Folders

Data

Contains the file data.csv with the raw data.

Database

Contains the sqlite predictions.db with RegressionModel results ordered by timestamp execution. in the following image you can see its structure using the Dbeaver desktop interface.

GreenWater

This is the project package with which the api executes its functionalities. It is governed by the Utils() class that stores the different project directories. The methods inside the class are:

  • data_processing : To perform data processing.
  • train_model : To train and save model, updating it with .pkl file.
  • prediction_and_write_database : To determine prediction of the chemical and save the results in a sqlite3 database.

Models

Is the folder that contains the train results, updating it according to the date of the last training session.

API demostration

To start the API service, execute the following command: bash uvicorn api:app --reload

The terminal will display the IP to which the service is pointing. If you using the extension /docs, we can see the main menu:

  • /upload : Insert csv from data folder.
  • /train-model : Updating training. In the next images, you can see how the .pkl file was updated in the source code when the process was executed in API.
  • /train-model : A box is available for entering new sensor B measurements with which to generate predictions. As a result, a json is generated corresponding to the new instance that is added to the database.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages