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

0 downloads

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.

danq9 signup: the person chooses the password and name on the confirm page 83c7aa6 2 weeks, 5 days ago History
scans.json · 5.2 KB · 58 lines
1{
2 "name": "scans",
3 "title": "Scans",
4 "version": 1,
5 "description": "A photographed or emailed document on its way into the books. The record is EVIDENCE and is never edited (docs/logic-decisions.md #8): the image is what an auditor actually wants, the OCR text is what a machine read, and the extraction is what a machine GUESSED. None of it posts anything. The write that matters happens when a human confirms, which creates a draft expense (or bill, or bank import) stamped generated_from scans/{id} and attributed to them -- so a weak extractor costs somebody thirty seconds of typing rather than putting a wrong number in the ledger. That boundary is why this can ship with no AI at all: the free path reads totals with regex over OCR text, an AI vision pass simply guesses better, and confirmation cannot tell them apart. content_sha256 makes re-snapping the same receipt land on the same scan, because the second photo of a crumpled receipt is the normal case, not the exception.",
6 "fields": [
7 {"name": "id"},
8 {"name": "filename", "type": "text", "label": "File"},
9 {"name": "content_type", "type": "text", "label": "Type"},
10 {"name": "size", "type": "integer", "default": "0", "label": "Bytes"},
11 {"name": "content_sha256", "type": "text", "label": "Content Hash",
12 "help": "Of the stored bytes. The dedup key: photographing the same receipt twice, or emailing what somebody already snapped, must not become two expenses."},
13 {"name": "file_id", "type": "text", "label": "Stored File",
14 "help": "Where the bytes live under the owner's files. The image IS the audit evidence; everything else here is derived from it."},
15 {"name": "source", "type": "enum", "default": "web", "label": "Source",
16 "enum": ["web", "phone", "email", "mcp", "api"],
17 "help": "Where it came in from. Capture has to happen at the moment the paper exists -- a receipt that needs a laptop later is a receipt that is already lost."},
18 {"name": "category_hint", "type": "enum", "default": "receipt", "label": "Kind",
19 "enum": ["receipt", "bill", "invoice", "statement", "document", "photo"],
20 "help": "What the person capturing it says it is. Cheap at capture time, expensive to infer afterwards."},
21 {"name": "status", "type": "enum", "default": "pending", "label": "Status",
22 "enum": ["pending", "processing", "extracted", "confirmed", "ignored", "error"],
23 "transitions": {
24 "pending": ["processing", "extracted", "ignored", "error"],
25 "processing": ["extracted", "error", "ignored"],
26 "extracted": ["confirmed", "ignored", "error"],
27 "error": ["pending", "ignored"],
28 "ignored": ["pending"],
29 "confirmed": []
30 },
31 "help": "pending goes straight to extracted when a pass reads it in one go; processing exists for an engine slow enough that somebody would otherwise wonder whether it hung. error returns to pending so a fixed engine can retry the backlog. ignored is for the blurry duplicate nobody needs -- reversible, because 'ignore' should never mean 'lose'. confirmed is terminal: the record it produced is the thing to correct now, not this evidence of what arrived."},
32 {"name": "ocr_text", "type": "textarea", "label": "Text Read",
33 "help": "What the engine read. Kept even when extraction found nothing, because it is searchable and because it is how somebody works out why a reading was wrong."},
34 {"name": "ocr_engine", "type": "text", "label": "Engine",
35 "help": "Which engine produced the text and the guess. Recorded so a bad batch can be found and re-run when the engine changes."},
36 {"name": "extracted", "type": "textarea", "label": "Extraction (JSON)",
37 "help": "The structured GUESS: vendor, date, total, tax, line items. Stored, shown beside the image, never posted."},
38 {"name": "confidence", "type": "text", "default": "0", "label": "Confidence",
39 "help": "How much was actually found, not how sure a model claims to be. For sorting 'probably fine' above 'look at this one' -- never a threshold for acting unattended."},
40 {"name": "confirmed_record", "type": "text", "label": "Became",
41 "help": "collection/id of what a human created from this. Present means confirmed: one scan, one record, however many times anyone clicks."},
42 {"name": "error", "type": "text", "label": "Error"},
43 {"name": "attempts", "type": "integer", "default": "0", "label": "Attempts",
44 "help": "Processing tries. A document that fails repeatedly stops being retried and starts being visible, rather than churning a paid extractor forever."},
45 {"name": "notes", "type": "textarea", "label": "Notes"},
46 {"name": "owner_id", "type": "text", "label": "Owner"},
47 {"name": "entity_id", "type": "text", "label": "Entity",
48 "relation": {"collection": "entities", "display_field": "name"}},
49 {"name": "created_at", "type": "datetime", "read_only": true, "label": "Received"}
50 ],
51 "hooks": {"before_write": "hook_scans"},
52 "search": {"fields": ["filename", "ocr_text", "notes"]},
53 "forms": {"default": {"fields": ["filename", "source", "category_hint", "notes"]}},
54 "views": {"list_mode": "table",
55 "list_fields": ["created_at", "filename", "category_hint", "status",
56 "confidence"],
57 "filter_fields": ["status", "category_hint", "source"]}
58}