Skip to content

A State-Machine based Work Permit System enforcing strict safety logic gates (ISO 45001). Designed to prevent unsafe state transitions in high-risk industrial workflows. πŸ—οΈ πŸ›‘οΈ

Notifications You must be signed in to change notification settings

gauravdev148/Digital_Work_Permit_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ Digital Work Permit System (Formal State Machine)

Python Logic Status

A deterministic state-machine system for enforcing safety protocol compliance.

This project models the "Permit-to-Work" (PTW) process as a Finite State Machine (FSM). Unlike standard databases, this system uses formal transition rules to ensure that a permit cannot reach an ACTIVE state without passing through mandatory SAFETY_CHECK and APPROVAL states. This prevents "process skipping," a common cause of industrial accidents.


πŸ“Έ State Transition Visualization

State Machine UI (Figure 1: Visual tracking of the permit lifecycle. Transitions are strictly enforced by the backend logic.)


πŸš€ Key Features

  • Deterministic Logic:
    • Implements a strict FSM using the transitions library.
    • Invalid transitions (e.g., jumping from Idle to Active) raise immediate FormalViolation errors.
  • Process Enforcement:
    • Safety Check Constraint: Work cannot begin until the safety verification state is successfully resolved.
    • Auditability: Every state change is tracked and validated against the logic model.
  • Visual Status Tracking:
    • Provides a clear, linear view of the safety workflow for site managers.

πŸ› οΈ Technical Implementation

Component Technology Purpose
Logic Engine Python transitions Formal State Machine implementation
Backend Flask Web Interface & API
Frontend Bootstrap 5 Visual State Diagram
# Logic Sample: Strict Transition Rules
transitions = [
    {'trigger': 'verify_safety', 'source': 'requested', 'dest': 'safety_check'},
    {'trigger': 'manager_approve', 'source': 'safety_check', 'dest': 'approved'},
    # If a user tries to skip 'safety_check', the system rejects the action.
]

⚑ How to Run

1. Setup Environment

# Create Virtual Environment (Sandbox)
python -m venv venv

# Activate (Windows)
.\venv\Scripts\activate

# Install Dependencies (Flask + Transitions)
pip install -r requirements.txt

2. Launch Application

# Navigate to the Source Folder
cd src

# Start the Logic Engine
python app.py

Access the system at: http://127.0.0.1:5002


πŸ”§ Troubleshooting (Windows Users)

If you see a "running scripts is disabled" error when trying to activate the environment, run this command in PowerShell to allow script execution:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

Then try running .\venv\Scripts\activate again.


πŸ‘€ Author

Gaurav Dev

  • Focus: Safety-Critical Systems, Process Automation, Formal Methods.

About

A State-Machine based Work Permit System enforcing strict safety logic gates (ISO 45001). Designed to prevent unsafe state transitions in high-risk industrial workflows. πŸ—οΈ πŸ›‘οΈ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published