Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 42 minutes ago History
waste_logs.json · 4.5 KB · 43 lines
1{
2 "name": "waste_logs",
3 "title": "Waste Log",
4 "version": 2,
5 "description": "What was thrown away, why, by whom, and where it went. Two ways to count it, because a kitchen has both: BY COUNT for a whole item off the shelf (three croissants, stale) -- a waste stock move goes with it, so the shelf is right -- and BY WEIGHT for what nobody counts (a bin of peelings, the day's coffee grounds), recorded per bin or category and turned into an ESTIMATED cost by the shop's cost per kilo (counter.waste_cost_per_kg_cents, or counter.waste_cost_per_kg_cents.<category>), stamped on the row at the moment it is recorded (docs/logic-decisions.md #1). Weight moves no stock: it is not an item the shelf counted. An estimate that cannot be made (no cost per kilo set) is left blank with a warning, never written as zero. DESTINATION says where it went (trash, compost, animal feed, donation, rendering, digester) and recipient_contact_id who took it. Some destinations need a licence or registration in some places (feeding food waste to animals is restricted or banned in many; rendering and digesters are licensed trades); this records needs_licence and the licence number and expiry the shop gives, and stamps licence_warning when a licence is marked needed but none is given or it has expired. It RECORDS AND WARNS; it never decides what is legal, because that depends on the place, the waste and the recipient, and a box that claimed to know would be claiming more than it can prove. Written only by action_counter_waste (the reason code is checked against correction_reasons; the person is the row's owner). Never edited or deleted afterwards. Corner Cup (a Haiku simulation of a counter cafe) had no waste log at all: waste was a stock move or nothing.",
6 "views": {
7 "list_mode": "table",
8 "list_fields": ["occurred_at", "mode", "product_id", "quantity", "category", "weight_grams", "estimated_cost_cents", "destination", "owner_id"],
9 "filter_fields": ["mode", "destination", "reason_code"]
10 },
11 "fields": [
12 {"name": "id"},
13 {"name": "mode", "type": "enum", "required": true, "default": "count", "label": "Counted by",
14 "enum": ["count", "weight"]},
15 {"name": "product_id", "type": "text", "label": "Item", "validation": {"max_length": 64}},
16 {"name": "quantity", "type": "number", "label": "How many"},
17 {"name": "category", "type": "text", "label": "Bin or category", "validation": {"max_length": 80}},
18 {"name": "weight_grams", "type": "integer", "label": "Weight (grams)", "validation": {"min": 0}},
19 {"name": "cost_per_kg_cents", "type": "integer", "read_only": true, "label": "Cost per kg used",
20 "description": "The setting's value when this was recorded, stamped so a later price change restates nothing."},
21 {"name": "estimated_cost_cents", "type": "integer", "read_only": true, "label": "Estimated cost (cents)",
22 "description": "By count: quantity x the unit cost stamped on the waste move. By weight: grams x cost per kg / 1000, rounded half up. Blank when it could not be estimated."},
23 {"name": "reason_code", "type": "text", "required": true, "label": "Reason code",
24 "validation": {"max_length": 64}},
25 {"name": "destination", "type": "enum", "required": true, "default": "trash", "label": "Went to",
26 "enum": ["trash", "compost", "animal_feed", "donation", "rendering", "digester"]},
27 {"name": "recipient_contact_id", "type": "relation", "label": "Taken by",
28 "relation": {"collection": "contacts", "display_field": "first_name", "requires": "read"}},
29 {"name": "needs_licence", "type": "boolean", "default": "false", "label": "Needs a licence"},
30 {"name": "licence_number", "type": "text", "label": "Licence or registration", "validation": {"max_length": 120}},
31 {"name": "licence_expires_on", "type": "date", "label": "Licence expires"},
32 {"name": "licence_warning", "type": "text", "read_only": true, "label": "Licence warning",
33 "validation": {"max_length": 300}},
34 {"name": "stock_move_id", "type": "text", "read_only": true, "label": "Waste move",
35 "validation": {"max_length": 64}},
36 {"name": "approval_id", "type": "text", "read_only": true, "label": "Approval",
37 "description": "The counter_approvals row (kind waste) that let a cashier write off more than counter.waste_approval_quantity in one entry."},
38 {"name": "note", "type": "text", "label": "Note", "validation": {"max_length": 300}},
39 {"name": "occurred_at", "type": "datetime", "label": "When"},
40 {"name": "owner_id", "type": "text", "label": "Recorded by"},
41 {"name": "created_at", "type": "datetime", "read_only": true}
42 ]
43}