The name of this distributable package (as defined in pyproject.toml) is performance_calculator.
This project was developed with the main goal of demonstrating Domain-Driven Design (DDD) Software Architecture, Modularization, and Object-Oriented Programming (OOP).
The oee-calc-lib repository houses the library that isolates the Domain Logic (OEE Performance calculation) from the Application Logic (e.g., the Django web interface and AWS integrations). This modular separation ensures the core calculation can be reused across any part of the system or in different future platforms.
For the purpose of development and integration with the main project (e.g., your Django application), we recommend installing it in editable mode (-e). This utilizes the modern Python packaging standard defined in pyproject.toml.
-
Clone the Repository:
git clone [https://github.com/sergio-oliveira-br/oee-calc-lib](https://github.com/sergio-oliveira-br/oee-calc-lib) cd oee-calc-lib -
Install into Your Main Virtual Environment (Editable Mode):
Replace
/full/path/to/with the actual location where you saved the library.# Ensure you are in your main Django project's virtual environment (venv-django) $ pip install -e /full/path/to/oee-calc-libThe
-e(editable) flag ensures that any code change in the library's source directory (src/oee_lib) is immediately reflected in the main project.
The library is class-oriented and requires you to instantiate the OEECalculator class.
# 1. Import the External Library
# NOTE: The import path uses the source folder name 'oee_lib'.
from oee_lib.calculator import OEECalculator
# 1.1. Instantiate the class
oee_calculator = OEECalculator()
# 1.2. Input Data
# nominal_rate_ref: Ideal Rate
nominal_rate_ref = 600.0 # Units/Hour
# actual_rate_from_user: Actual Rate
actual_rate_from_user = 580.0 # Units/Hour
# 2. Invoke the core calculation method
performance = oee_calculator.calculate_performance_rate(
actual_rate=actual_rate_from_user,
nominal_rate=nominal_rate_ref
)
# 3. The result will be displayed in percentage.
print(f"Performance: {performance}")
# Expected result: 96.67%