Giter Club home page Giter Club logo

oxygen-cs-grp1-eq8's Introduction

LOG-680 : Template for Oxygen-CS

image

This Python application continuously monitors a sensor hub and manages HVAC (Heating, Ventilation, and Air Conditioning) system actions based on received sensor data.

It leverages signalrcore to maintain a real-time connection to the sensor hub and utilizes requests to send GET requests to a remote HVAC control endpoint.

This application uses pipenv, a tool that aims to bring the best of all packaging worlds to the Python world.

Requierements

  • Python 3.8+
  • pipenv

Getting Started

  1. Clone the repository :
git clone https://github.com/MarioGith/log680.git
cd log680
  1. Install the project's dependencies :
pipenv install

or for development use :

pipenv install --dev
pre-commit install

Setup

You need to setup the following variables inside the Main class:

  • HOST: The host of the sensor hub and HVAC system.
  • TOKEN: The token for authenticating requests.
  • TICKETS: The number of tickets.
  • T_MAX: The maximum allowed temperature.
  • T_MIN: The minimum allowed temperature.
  • DATABASE: The database connection details.

Running the Program

After setup, you can start the program with the following command:

pipenv run start

Running the tests

After setup, you can start the unit tests with the following command:

pipenv run test

Running the linting

After setup, you can start the unit tests with the following command:

pipenv run lint

Logging

The application logs important events such as connection open/close and error events to help in troubleshooting.

To Implement

There are placeholders in the code for sending events to a database and handling request exceptions. These sections should be completed as per the requirements of your specific application.

License

MIT

Contact

For more information, please feel free to contact the repository owner.

oxygen-cs-grp1-eq8's People

Contributors

chargag avatar balnian avatar mariogith avatar alex6ripetti avatar

oxygen-cs-grp1-eq8's Issues

Configure the application

Is your feature request related to a problem? Please describe.
We need to configure the application with environment variables. The solution needs to have tests.

Describe the solution you'd like
We want a file that contains the environment variable to configure the application.

Describe alternatives you've considered
No alternatives.

Additional context
If a environment variable is not defined, we need to set a default value. If the token is not set we need to return an error. For each modification in the code we need to add unit tests.

Deploy Database container to k8s

Is your feature request related to a problem? Please describe.
Our database is not accessible in the k8s cluster

Describe the solution you'd like
We should have a postgresql container up and running in our k8s cluster with the correct schema

Describe alternatives you've considered
No alternatives exist

Additional context
Both the Metrics app and the OxygenCs app use the same database. The container deployed should have the necessary schema of both applications

Create Graphana dashboard

Is your feature request related to a problem? Please describe.
We have no way of visualizing the oxygencs app data

Describe the solution you'd like
A Graphana dashboard allowing us to visualize the oxygencs data

Describe alternatives you've considered
no alternatives allowed

Average time for build pipeline Metric

Is your feature request related to a problem? Please describe.
I would like to get the average time for a build pipeline in a given period.

Describe the solution you'd like
A REST endpoint that returns the average time for a build pipeline execution between two dates

Describe alternatives you've considered
No alternatives exist.

Deploy image to k8s

Is your feature request related to a problem? Please describe.
We have no way of deploying our application to our k8s cluster

Describe the solution you'd like
In the pipeline that creates and publishes a new application docker image, we should also deploy this new image to the k8s cluster

Describe alternatives you've considered
we could manually deploy our images to k8s, but it is not scalable

Create a basic Github pipeline

Is your feature request related to a problem? Please describe.
Create a basic Github pipeline to validate PRs

Describe the solution you'd like
Check the code with the linter
Check that the project start correctly

Describe alternatives you've considered
Azure Pipeline could be considered, but it's easier to use the solution offered by Github to stay in the same ecosystem

Additional context
We need automated testing of the PRs, we can't always expect reviewer to pull down and test the PR

Time for build pipeline execution

Is your feature request related to a problem? Please describe.
I would like to be able to fetch the time required for a build pipeline execution

Describe the solution you'd like
A REST endpoint that returns the time of execution for a build pipeline.

Describe alternatives you've considered
The only alternative is to navigate to the Github UI

Create Docker image and publish it in a CI pipeline

Is your feature request related to a problem? Please describe.
When new changes are added to the main branch of the oxygen app, a new Docker image should be built and published on DockerHub

Describe the solution you'd like
A new Docker image should be published to DockerHub when changes are pushed in the main branch of the oxygen app.

Describe alternatives you've considered
The only alternative is to create and publish manually

Additional context
The docker image should run the metrics flask app on execution (including connecting to the database)

Pre-commit git hook

Is your feature request related to a problem? Please describe.
Add pre-commit git hook to run linting, static analysis and formatting

Describe the solution you'd like
integrate in git hooks the following linter and formatter:

  • Pylint 2.10.3-dev0
  • Black 21.9b0

Describe alternatives you've considered
flake8

Additional context
N/A

Send Event to DB

Is your feature request related to a problem? Please describe.
Send program events to the DB

Describe the solution you'd like
Complete the code stub, to send the data to the postgress database.

  • add event point when sensor data is recieved
  • add event point when sending action to hvac

Describe alternatives you've considered
No alternative where considered (client constraint)

Additional context
N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.