(KLiN'iT CLI)

Date, 2023/10/24

By Moses O. Oyelade

KLiN'iT - A Company User-manager CLI

As a former site-Manager, one of the biggest organizational challenges was keeping track of the activies of workers per time. Some of the biggest issues included:

  • Hygiene-clerk(worker) constantly forgetting or misplacing their tools and materials
  • Needing to access the tool and materials for inspection
  • Having to get the total stock of consumables and materials
  • Tracking a tool inventory separately from area of activity

KLiN'iT is a Command Line Interface allowing users to query from a SQLAlchemy database of users(workers), Area of activities, Tools and materials. The database is set up with many-to-many relationships backrefered through the user table. Users can have many Tools and Users can have many areas of activities.

The main menu options include:

  • Search the database
  • Print records from the database
  • Create new records

This CLI is set up specifically for CLEANING FIRMS user/worker data, but could be adapted for other industries.

Installation instruction

Git clone https://github.com/Moses-Oyelade/phase-3-project.git

Fork and clone a copy of the repository. This project requires python3 and pip to be installed on your computer. Install dependencies by running pipenv install, then start up a virtual environment by running pipenv shell.

Seed Database

In order to seed the database, run the following commands:

cd lib
cd byt
python seed.py

Run CLI

cd back to the lib folder, then run the following command:

./klinit.py

You can now access and interact with the data from the database through the CLI.

Usage

File Overview

The lib folder holds all of the CLI files as well as the db database folder.

Db folder:

Within the db folder, the models.py file holds the table models for the classes Equipment, Area, and User. There is also a folder of migrations which track the alembic upgrades and migrations made throughout the project. The seed.py file is set up to seed the main.db database with content generated by Faker. If you would like to use your own data, you can edit the seed.py file or create a new .py file at the same level with instances of your data. The debug.py file can be run to test instances of classes you'd like to add to the database.

Lib folder:

Within the lib folder, the bando.py file runs the CLI. This file contains imports from the subfunctions folder to help organize the CLI by CRUD function aligned with the CLI main menu options:

  • Search the database = /ctrlA.py
  • Print records from the database = /ctrlB2.py
  • Create new records = /ctrlC3.py

Control folder: Each of the helper functions in the subfunctions folder import the necessary models and packages to query the database using SQLAlchemy. As a user makes selections in the CLI, each subfunction carries out the logic of their choice.

Technologies used

Python Github

Resources

To learn more about querying using SQLAlchemy: SQLAlchemy Documentation

Check out Faker for all of your database seeding needs: Faker Documentation

Do your tables look awful? Check out Pandas to learn how to pretty-print your data! Pandas Documentation

Test out user input verification: Regex101

Display selectable options in the terminal and return the selection ID (or whatever you want!) using Inquirer: Inquirer Documentation

Surport and contact details

github.com/Moses-Oyelade oyelademoses@gmail.com

License

The content of this site is license under the MIT license Copyright (c) 2018.