Skip to content

Commit e53ac49

Browse files
cloud3000claude
andcommitted
Expand SEARCH_ALIASES to ~55 business terms + entity-first targets
Grow the find.py alias map from 12 to 55 business terms across Finance, CRM, Sales, Procurement, Inventory/Supply, HR, Healthcare, Manufacturing, Quality, and Product. Every entry verified to fire as an alias and resolve to >0 items (dropped shadowed/dead candidates, e.g. 'asset' which substring-matches the Maintenance category, and 'ar' which falsely matched 'warehouse'). Also resolve alias *targets* entity-first so a bare target like "order" means the order entity, not the whole "Sales / Order Management" category (fulfillment 637 -> 289; sku/item -> 188). Multi-word category targets still fall through to the category lookup. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 2a80eac commit e53ac49

2 files changed

Lines changed: 74 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ chronological development log see [`PROGRESS.md`](PROGRESS.md).
1414

1515
- `tools/find.py` — find data items by a business term via a layered resolver
1616
(category → entity → alias → keyword), with a reviewable `SEARCH_ALIASES` map
17-
for business vocabulary (e.g. `billing → invoice`) and a `--ddl` flag that
18-
emits a validated `CREATE TABLE` per matched entity.
17+
of ~55 business terms (billing, payee, receivable, shipping, employee,
18+
appointment, inspection, …) and a `--ddl` flag that emits a validated
19+
`CREATE TABLE` per matched entity. Alias targets resolve entity-first for
20+
precision.
1921

2022
## [1.0.0] - 2026-06-27
2123

tools/find.py

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,71 @@
4646
# name -- those resolve on their own via layers 1-2.
4747
# ---------------------------------------------------------------------------
4848
SEARCH_ALIASES = {
49-
"billing": ["invoice", "invoiceitem", "charge", "payment_intent"],
50-
"payee": ["payout", "refund"],
51-
"payer": ["customer", "charge"],
52-
"shipping": ["stock.picking", "stock.move"],
53-
"logistics": ["Supply Chain / Logistics"],
54-
"stock": ["stock.quant", "stock.lot", "material_lot"],
55-
"warehouse": ["Inventory / Warehouse"],
56-
"vendor": ["purchase_order", "payout"],
57-
"supplier": ["purchase_order"],
58-
"hr": ["Human Resources"],
59-
"people": ["person", "patient", "customer", "hr.employee"],
60-
"bom": ["bom", "bom_item", "bom_operation", "mrp.bom"],
49+
# --- Finance / billing ---
50+
"billing": ["invoice", "invoiceitem", "charge", "payment_intent"],
51+
"payee": ["payout", "refund"],
52+
"payer": ["customer", "charge"],
53+
"receivable": ["invoice", "invoiceitem"],
54+
"payable": ["purchase_order", "payout"],
55+
"ap": ["purchase_order", "payout"],
56+
"ledger": ["account.move", "account.move.line"],
57+
"journal": ["account.move", "account.move.line"],
58+
"gl": ["account.move", "account.move.line"],
59+
"tax": ["account.invoice.tax", "invoice"],
60+
# --- CRM / parties ---
61+
"client": ["customer", "account", "party.party", "organization"],
62+
"company": ["organization", "account"],
63+
"partner": ["party.party", "organization", "account"],
64+
"prospect": ["lead", "opportunity"],
65+
"address": ["party.address"],
66+
# --- Sales ---
67+
"quotation": ["quote", "offer"],
68+
"deal": ["opportunity", "quote"],
69+
"pricing": ["price", "offer"],
70+
# --- Procurement ---
71+
"po": ["purchase_order"],
72+
"rfq": ["purchase_order"],
73+
"vendor": ["purchase_order", "payout"],
74+
"supplier": ["purchase_order"],
75+
# --- Inventory / supply chain ---
76+
"shipping": ["stock.picking", "stock.move"],
77+
"delivery": ["stock.picking", "stock.move"],
78+
"transfer": ["stock.picking", "stock.move"],
79+
"fulfillment": ["stock.picking", "order"],
80+
"lot": ["stock.lot", "material_lot"],
81+
"batch": ["stock.lot", "material_lot"],
82+
"serial": ["stock.lot", "material_lot"],
83+
# --- Human Resources ---
84+
"employee": ["hr.employee", "person", "personnel_class"],
85+
"staff": ["hr.employee", "person"],
86+
"worker": ["hr.employee", "person"],
87+
"department": ["hr.department"],
88+
"position": ["hr.job"],
89+
"people": ["person", "patient", "customer", "hr.employee"],
90+
# --- Healthcare ---
91+
"appointment": ["patient_appointment"],
92+
"visit": ["patient_encounter", "encounter"],
93+
"vitals": ["vital_signs"],
94+
"diagnosis": ["clinical_procedure", "observation"],
95+
"doctor": ["practitioner"],
96+
"physician": ["practitioner"],
97+
"provider": ["practitioner"],
98+
"insurance": ["coverage"],
99+
# --- Manufacturing ---
100+
"mfg": ["Manufacturing"],
101+
"workcenter": ["mrp.workcenter", "workstation"],
102+
"assembly": ["bom", "mrp.bom", "work_order"],
103+
# --- Quality ---
104+
"qa": ["Quality Management"],
105+
"qc": ["Quality Management"],
106+
"inspection": ["quality_inspection", "quality_inspection_reading"],
107+
"defect": ["non_conformance"],
108+
"nonconformance": ["non_conformance"],
109+
# --- Product ---
110+
"sku": ["product", "price"],
111+
"catalog": ["product", "price"],
112+
"item": ["product", "price"],
113+
"barcode": ["gs1"],
61114
}
62115

63116
FIELD_COLS = ("Name", "Title", "Description", "DataType", "ByteLength",
@@ -121,7 +174,11 @@ def resolve(conn, term):
121174
if term.lower() in SEARCH_ALIASES:
122175
seen, items, targets = set(), [], []
123176
for tgt in SEARCH_ALIASES[term.lower()]:
124-
sub = _items_for_category(conn, tgt) or _items_for_entity(conn, tgt)
177+
# entity-first: a target like "order" means the order entity, not
178+
# the whole "Sales / Order Management" category. Multi-word category
179+
# names (e.g. "Quality Management") won't match an entity and fall
180+
# through to the category lookup.
181+
sub = _items_for_entity(conn, tgt) or _items_for_category(conn, tgt)
125182
if sub:
126183
targets.append(tgt)
127184
for r in sub:

0 commit comments

Comments
 (0)