Portfolio 09
Initializing sql.js engine...
09 / Revenue Operations & Inventory System
Live ยท sql.js ยท SQLite

Pipeline Architecture

๐Ÿช
Google Sheets
POS + Inventory
โ†’
โš™๏ธ
AppScript
doGet(?sheet=)
โ†’
๐Ÿ
Python
Clean 2 tables
โ†’
๐Ÿ—„๏ธ
SQLite
inventory_db.sqlite
โ†’
๐Ÿ”
sql.js
Browser query
โ†’
๐Ÿ“Š
Dashboard
Real-time viz

Problem Statement

Managing 100 SKUs across a retail POS operation without dedicated inventory software creates stockout blind spots, margin erosion from untracked discounts, and zero visibility into cashier performance or product profitability.

Solution Built

A fully integrated retail operations system: POS transaction recording with auto stock deduction via AppScript onEdit() trigger, product catalog management with COGS-based margin calculation, and receipt PDF generation โ€” all feeding into this analytical dashboard.

Data Collected

104 transaction line items across multiple invoices, 100 SKUs with real-time stock levels, COGS vs selling price per unit, per-cashier sales records, payment method distribution, and margin per product line.

Business Impact

Stock alert system (qty โ‰ค 10), margin percentage per SKU, top products by revenue and quantity, cashier performance benchmarking, inventory capital value vs potential selling value gap analysis.

Tech Stack

Google SheetsGoogle AppScriptPython 3.13SQLitesql.js (WebAssembly)Chart.jsGitHub ActionsLockService (race condition prevention)
Total Revenue
โ€”
all sales
Total Profit
โ€”
margin earned
Invoices
โ€”
unique orders
Items Sold
โ€”
total units
Avg Order Value
โ€”
per invoice
Margin %
โ€”
overall
Active SKU
โ€”
stock > 0
Stockout SKU
โ€”
qty = 0

Monthly Sales & Profit Trend

Top 8 Products by Revenue

Payment Method & Cashier

Payment
Cashier

Stock Alert (qty โ‰ค 10)

0
SKUProductQtyStatus

SKU Performance

0
SKURevenueProfitMargin

Recent Invoices

InvoiceDateItemsTotal
Stockout Transactions (104)
Product Stock (100 SKU)
Saved Queries
Custom Query
No results

Pipeline Stats

โ€”
Transactions
โ€”
SKUs
2
Tables
โ€”
Runs

Last Runs

Python Pipeline (pipeline_09.py)

# Fetches 2 datasets in 1 API call payload["stockout"] # 104 transaction lines payload["products"] # 100 SKU snapshots # Derives margin_per_unit & margin_pct margin = value_selling - value_capital margin_pct = margin / value_capital * 100 # Validates stock consistency if in_stock - out_stock != qty_stock: warnings.append(...)

AppScript Export (export.js)

// Two datasets, one Web App // Supports ?sheet= parameter GET /exec โ†’ both tables GET /exec?sheet=stockout โ†’ sales only GET /exec?sheet=products โ†’ stock only // Auto mode: onEdit() + LockService const lock = LockService .getScriptLock(); lock.waitLock(250); // race prevention

GitHub Actions

# Scheduled 00:01 WIB daily cron: '1 17 * * *' # Or trigger manually: workflow_dispatch: inputs: pipeline: pipeline_09 env: WEBAPP_URL_09: ${{secrets.WEBAPP_URL_09}}