Skip to content

An University Laboratory Manager developped in Python/Flask

License

Notifications You must be signed in to change notification settings

lgmarin/lab-manager

Repository files navigation

lab-manager

An University Laboratory Management tool developed in Python/Flask

A Laboratory Management Web Application based in Flask

Python 3.10

I created this app based on the needs of the Laboratório de Máquinas Térmicas at the Federal University of Paraná.

There is a lot of different users in the lab, on different projects (Engineering Projects, such as Formula SAE, Baja SAE, Aerodesing, etc), so the idea is to create a simple way for the students to create their account with basic data, and allow for the Professors responsible for each projects to validate their accounts.

Further down the road, the idea is to connect directly to the Access Point API (A biometric lock) to create the users account and to allow the users to create their biometric key (after the permission of the leader of the project).

ProfilePage

UsersAdmPage

Objectives

Develop a Laboratory Manager using Flask to develop some skills with, and work with the following technology or programming solutions:

  • Work with Web Development in Python
  • Development of a full stack web application
  • Implement Elasticsearch
  • Work with form validation in Flask
  • Work with HTML and Bootstrap
  • Work with DataTables.js together with Flask
  • Work with GIT
  • Work with relational database (SQL)
  • Configure and use DB Migrations

To-do

  • Deploy the final app
  • Implement Unity Testing

Dependencies

  • Flask
  • SQLAlchemy
  • FlaskLogin
  • WTForms
  • Werkzeug
  • Flask-Migrate
  • Elasticsearch

Database Schema

LabManager Database

Run Development Mode Locally

Prepare the virtual environment (Using Linux):

python -m venv .venv
source .venv/bin/activate

Install all dependencies:

pip install -r requirements.txt

Run Elasticsearch Docker Container (For DEV mode)

docker run --name elasticsearch -d -p 9200:9200 -p 9300:9300 --rm \
    -e "discovery.type=single-node" \
    docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2

You can run either with MySql server or SqLite. For Sqlite modify the config.py file to use local Sqlite DB.

To Run with MySQL Docker Container

 docker run --name mysql -d -e MYSQL_RANDOM_ROOT_PASSWORD=yes \
    -e MYSQL_DATABASE=lab_manager -e MYSQL_USER=lab_manager \
    -e MYSQL_PASSWORD=MYSQL_PASSWORD_GOES_HERE \
    mysql/mysql:8.0.28

Run Flask server (In DEV mode)

export FLASK_ENV=development; flask run

Testing

Run Tests

python -m pytest

Run Production Server in Docker

Build and Run Docker Compose

docker-compose up