This technical note summarizes the internal architecture and design logic of SmartShelf, a PyWebIO-based interactive pantry management system. The focus is on structural design, dispatch logic, and data-driven UI rendering.
SmartShelf follows a simple layered structure:
CSV Storage → Pandas DataFrames → Utility Layer (pantry_utils)
→ UI Rendering (PyWebIO) → User Interaction → Data Update
pantry_utils.The application uses a dispatch table to map UI choices to handler functions. This enables modular expansion without altering core control flow.
choice_handlers = {
'View Pantry': render_pantry,
'Edit Pantry Quantities': render_edit_pantry,
'Add to Pantry': render_pantry_update,
...
}
Instead of static page reloads, SmartShelf uses scoped rendering:
clear_scope('main')
with use_scope('main'):
put_table(...)
This creates a lightweight reactive behavior similar to modern frontend frameworks.
To dynamically generate forms, item names are sanitized:
safe_name = re.sub(r'\W+', '_', item['item_name'])
This prevents invalid variable binding and ensures safe dictionary mapping.
As an extension to this index, the full SmartShelf implementation can be treated as a standalone applied Python architecture example.