Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/apursley2012/corner-grocer/llms.txt

Use this file to discover all available pages before exploring further.

The browser demo is a static HTML/JS recreation of the full Python application, built so anyone can interact with Corner Grocer through GitHub Pages without installing Python or a database. Every menu operation from the command-line version — frequency lookup, sorting, searching, histogram display, and file export — is available directly in the browser, powered by JavaScript logic that mirrors the original Python implementation. The demo loads with a pre-populated sample dataset so visitors can explore the features immediately.

What the demo includes

Item frequency lookup

Type any grocery item name to retrieve how many times it appears in the dataset.

Print all frequencies

Display the complete list of every tracked item alongside its purchase count.

Text histogram display

Render an asterisk-based histogram — one * per occurrence — for every item in the dataset.

Alphabetical sort (A–Z)

Re-order the full item list in ascending alphabetical order.

Frequency sort (high → low)

Re-order items from most purchased to least purchased.

Item search

Search for an exact item name or a partial match across all stored items.

Add new items

Enter one item per line to add new purchase records to the in-browser dataset.

Save/download frequency list

Trigger a browser download of frequency_list.txt containing all item counts.

Save/download histogram

Trigger a browser download of frequency_histogram.txt containing the asterisk histogram.

How it works

The demo recreates the Python/SQLite application logic entirely in JavaScript. The same normalization rules, sorting algorithms, search behavior, and histogram formatting that exist in the Python source are re-implemented client-side so the output matches what the command-line application produces. Browser localStorage is used to simulate the persistence that SQLite provides in the Python version. When a visitor adds new items or modifies the dataset, those changes are written to localStorage under the key cornerGrocerItems. If the visitor returns to the demo in the same browser on the same origin, the previously saved items are automatically restored — the demo picks up where they left off. First-time visitors (or visitors whose localStorage is empty) are shown a built-in default dataset of real grocery items so every feature can be exercised right away.

Limitations vs. the Python version

The Python application stores all item data in a SQLite database via a dedicated db_handler.py module, which supports parameterized queries, persistent storage across machines, and server-side validation. The browser demo stores data in localStorage, which is scoped to a single browser profile on a single device. Data is not shared between browsers, devices, or private/incognito sessions.
The Python version writes files directly to the file system using Python’s file I/O and context managers, and confirms the full save path in the terminal. The browser demo cannot write to the file system directly. Instead, it constructs a Blob object and triggers a download through the browser’s download API. The result is functionally equivalent for end users, but the mechanism is entirely different.
The Python application can read arbitrarily large input files from disk and process them through SQLite. The browser demo operates entirely client-side with no server and no file-parsing pipeline, so it cannot ingest external .dat or .txt purchase-history files the way the Python version can. Items must be entered manually through the Add New Items form.
The browser demo is intended to showcase the project interactively for visitors who do not have Python installed — it is not intended to replace the Python source code as the authoritative implementation. The original C++ application, the enhanced Python rewrite, and the SQLite integration remain the complete, canonical versions of Corner Grocer.

Build docs developers (and LLMs) love