The first deployed Data Tagger use case. Driscoll Foods emails a purchase order to orders@ai-globalfoodsolutions.co. The system parses the PDF, recognizes the sender as Driscoll, looks up the saved template tpl_driscoll_po_so_v3, and applies 8 field tags: regex_after_label for P.O. #, literal_constant for entity, multi_line_span for shipaddress, regex_after_label for Delivery Date, whole_section for memo, and three table_with_headers for line items (item / qty / price). Overall confidence 0.92 (above 0.85 auto-draft threshold) so an SO draft is staged as a proposed_action. Mike approves in admin-dashboard. NS_PUSH_QUEUE writes the SO with otherrefnum set to the customer PO# — establishing the PO# trace thread that carries through Invoice and CashSale downstream.
| # | strategy | ns field | pattern / anchor | example value | conf |
|---|---|---|---|---|---|
| 1 | regex_after_label | SalesOrd.bodyFields.otherrefnum | /P\.?O\.?\s*#\s*([0-9A-Z\-]{4,20})/i | 8801772 | 0.97 |
| 2 | literal_constant | SalesOrd.bodyFields.entity | customer_id from sender domain | 478 (Driscoll Foods) | 1.00 |
| 3 | multi_line_span | SalesOrd.bodyFields.shipaddress | anchor SHIP TO: + 4 lines | 450 Industrial Blvd, Trenton NJ ... | 0.88 |
| 4 | regex_after_label | SalesOrd.bodyFields.shipdate | /Delivery Date\s*:?\s*([0-9\/\-\.]{8,10})/i | 2026-06-03 | 0.95 |
| 5 | whole_section | SalesOrd.bodyFields.memo | between SPECIAL INSTRUCTIONS: and END NOTES | delivery instructions text | 0.83 |
| 6 | table_with_headers | SalesOrd.lineFields.item | header Item # | [SKU-419, SKU-2014, ...] | 0.94 |
| 7 | table_with_headers | SalesOrd.lineFields.quantity | header Qty | [24, 12, 36, ...] | 0.96 |
| 8 | table_with_headers | SalesOrd.lineFields.rate | header Price or Unit Price | [18.50, 22.75, ...] | 0.92 |
| kind | name | purpose |
|---|---|---|
| Mailbox | orders@ai-globalfoodsolutions.co | customer PO intake |
| R2 bucket | gfs-inbound-attachments | PDF storage |
| D1 table | inbound_email_log | email audit |
| D1 table | data_tagger_templates | tpl_driscoll_po_so_v3 lives here |
| D1 table | data_tagger_extractions | one row per inbound PO |
| D1 table | proposed_actions | HITL queue (kind=data_tagger_extraction) |
| D1 table | ns_pending_pushes | NS_PUSH_QUEUE state |
| D1 table | customers | email_domain match column |
| D1 table | items | customer_item_alias mapping |
| D1 table | events | event ledger - so.created_from_po |
| Endpoint | POST /api/data-tagger/apply | run template against inbound doc |
| Endpoint | POST /api/proposed-actions/decide | approve SO draft |
| Endpoint | POST /api/ns/push/sales-order | NS SO write |
| NS RESTlet | customscript_gfs_platform_push_so | SO creator |
| Code path | src/email.ts | orders@ inbound handling |
| Code path | src/document_converter.ts | PDF parse |
| Durable Object | PushMutexDO | per-customer NS write mutex |
otherrefnum threading continues