Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Releases: CalciumKing/SLAC-LCLS-Stock-Management

v0.9.0 - First Release

21 Aug 23:18
d45fab5

Choose a tag to compare

Pre-release

This marks the first pre-release and first ever tag of the stock-management project.

Purpose & Overview

This application streamlines inventory and stock management for the SLAC National Accelerator Laboratory's LCLS division. Designed for both software engineers and inventory managers, it combines a GUI, a CLI, database synchronization, and dual-storage redundancy, all with a modern, modular architecture.

Key Features

  1. Dual Interface (GUI + CLI)
    • GUI is built using PyQt5 for intuitive point-and-click management.
    • CLI enables scripting, automation, and command-line workflows.
  2. Inventory Table View
    • Live-synced table, resembling a Google Sheet, with browsing, searching, updating, and removal capabilities.
  3. Restock Status Flags
    • Clear indicators for stock levels (In Stock, Low Stock, and Out Of Stock).
  4. QR Code Scanning & Generation
    • Scan item and user QR codes via webcam or camera to log actions, identify users, and manage inventory.
    • Generate QR codes for new items or user badges.
  5. Data Export & File Generation
    • Export inventory data to formats like .csv, .tsv, and .psv for reporting and analysis.
  6. Redundant Dual Data Storage
    • Maintains both a local MySQL database and a cloud-based Google Sheet for high availability and recoverability.
  7. Live Inventory Tracking
    • Real-time synchronization between physical stock, the GUI, CLI, and both databases ensures consistency.
  8. Asynchronous Programming For Responsiveness
    • Asynchronous handling of expensive tasks (camera capture, database operations, QR scanning, etc.) keeps the UI responsive.
  9. Modular Architecture
    • Clean separation of concerns with controllers, utilities, models, and UI modules-facilitating future enhancements.
  10. Robust Logging & Error Handling
    • Comprehensive logging of user actions (logins, scans, syncs), errors, and system events.
    • Error handling surfaces clear messages (e.g., "camera not found" or "Google Sheets inaccessible"), with logs for diagnosis.

Cross-Platform Compatibility & Deployment

  • Cross-Platform Ready: Verified on multiple Windows laptops and deployed successfully on a Raspberry Pi, demonstrating flexible and resilient deployment across diverse environments.
  • Works with Python 3.10 on Windows and Linux (such as Raspberry Pi OS).
  • This ensures suitability for both lab workstation setups and lightweight, low-power embedded systems.

CLI Commands

Top-Level Flags

Command Description
-h/--help show a help message and exits
-r/--run Runs Application GUI, Same As Running python -m stock_manager
-v/--version Prints stock_manager's git version
-t/--tree Prints stock_manager's commands, subcommands, and positional arguments in tree layout

Top-Level Commands

Command Description
export Exports All Item Data To A Specified File Type And Location (Used With Path And Extension Arguments)
qr Generates A QR Code Of A Specified Item And Stores It As A .png In A Specified Location (Used With Path And Part Number Arguments)
sync Synchronize Both Databases, Setting The Values Of The SQL Database To That Of The Google Sheet (Only Run If A Database Is Changed Externally)
test Runs All Tests Located In stock_manager/tests/ Using PyTest
items Commands Related To Item Management (e.g., list, add, search, remove, edit)
users Commands Related To User Management (e.g., list, add, search, remove)

items Subcommands/Flags

Command/Flag Description
-l/--list Lists All Items In The Database
search Searches For A Specified Value In All Fields In All Items (Used With Part Number Argument)
add Add An Item With Specified Values To Both Databases (Used With Sequence Of 10 Item Detail Arguments)
remove Remove A Specified Item From Both Databases (Used With Part Number Argument)
edit Edit A Specified Item With At Least One Field Name And New Value (Used With Part Number Argument And Up To 9 Field Arguments)

users Subcommands/Flags

Command/Flag Description
-l/--list Lists All Users In The Database
search Searches For A Specified Username In All Usernames (Used With Username Argument
remove Add A User With Specified Username To Both Databases (Used With Username Argument
remove Remove A Specified User From Both Databases (Used With Username Argument)

Contributors