8 mapped rules
9 extracted rules were evaluated against the bounded catalog.
Translate an SRS or incident brief into bounded DataHub-shaped mappings and reviewable SQL. Submitted text is processed for this response, not saved, and SQL is never executed.
!Rule 9 is UNMAPPED; no bounded DataHub asset was selected.
9 extracted rules were evaluated against the bounded catalog.
Domains are shown in the order first selected by the computed mappings.
Each rule is mapped to one bounded dataset, its fields, owner, and business term.
Commerce orders record the customer, order total, and ordered-at timestamp.
commerce.ordersCommerce · Commerce Dataorder_id, customer_id, ordered_at, order_totalOrder lifecycleInvoices create the accounts-receivable amount that must be posted to finance.
finance.ar_transactionsFinance · Accounts Receivabletransaction_id, invoice_id, order_id, customer_id, amount, posted_atAR transactionPayments and settlement records reduce the invoice balance when funds settle.
payments.settlementsPayments · Payments Platformsettlement_id, invoice_id, settled_amount, settled_at, statusSettlementReturns and refunds reduce the balance when merchandise is returned.
commerce.returns_refundsReturns & Refunds · Customer Carereturn_id, order_id, refund_amount, returned_at, reasonRefundFulfillment shipments provide delivery timestamps for the chronological event trail.
fulfillment.shipmentsFulfillment · Fulfillment Operationsshipment_id, order_id, shipped_at, delivered_at, statusShipmentCustomer identity links customer IDs to accounts and regional scope.
identity.customersCustomer Identity · Identity Platformcustomer_id, account_id, customer_region, statusCustomerRegional policy determines tax and credit-day rules for reconciliation.
policy.regional_ar_rulesRegional Policy · Regional Policyregion_code, effective_from, effective_to, tax_rate, credit_daysRegional AR policyThe incident investigation must compare all events by customer and event timestamp.
identity.customersCustomer Identity · Identity Platformcustomer_id, account_id, customer_region, statusCustomerThe final reconciliation should flag negative running balances and missing joins.
Human mapping neededNo bounded catalog keyword matched this rule.No generated query evidenceExactly which DataHub context types shaped this investigation—and which require a live DataHub connection.
Repeated bounded catalog lookups select datasets, columns, owners, domains, and business terms that directly constrain the generated SQL.
The included DataHub MCP adapter reads live schemas and lineage. The hosted demo uses bundled synthetic context so it stays fast and Docker-free.
Quality, freshness, documentation, dashboards, ML models, real-time metadata events, audit access, and governance remain clearly labeled until supplied by live DataHub.
Every bundled lookup names the asset and exact metadata that changed the query. Live mode replaces these fixtures with MCP schema and lineage reads.
Bundled catalog discovery selected the dataset; schema-shaped context selected order_id, customer_id, ordered_at, order_total; the context graph linked domain Commerce, owner Commerce Data, and glossary term Order lifecycle.
Bundled catalog discovery selected the dataset; schema-shaped context selected transaction_id, invoice_id, order_id, customer_id, amount, posted_at; the context graph linked domain Finance, owner Accounts Receivable, and glossary term AR transaction.
Bundled catalog discovery selected the dataset; schema-shaped context selected settlement_id, invoice_id, settled_amount, settled_at, status; the context graph linked domain Payments, owner Payments Platform, and glossary term Settlement.
Bundled catalog discovery selected the dataset; schema-shaped context selected return_id, order_id, refund_amount, returned_at, reason; the context graph linked domain Returns & Refunds, owner Customer Care, and glossary term Refund.
Bundled catalog discovery selected the dataset; schema-shaped context selected shipment_id, order_id, shipped_at, delivered_at, status; the context graph linked domain Fulfillment, owner Fulfillment Operations, and glossary term Shipment.
Bundled catalog discovery selected the dataset; schema-shaped context selected customer_id, account_id, customer_region, status; the context graph linked domain Customer Identity, owner Identity Platform, and glossary term Customer.
Bundled catalog discovery selected the dataset; schema-shaped context selected region_code, effective_from, effective_to, tax_rate, credit_days; the context graph linked domain Regional Policy, owner Regional Policy, and glossary term Regional AR policy.
Generated from extracted mappings; it is a draft and was not executed.
/* Generated by contextIsKey · DataHub context layer; review required; not executed.
Incident question: Why is AsterVale Living's accounts-receivable balance different from the customer-facing order and settlement records?
*/
WITH customer_scope AS (
-- Mapped DataHub context: identity customers with regional policy.
SELECT c.customer_id, c.account_id, c.customer_region, p.credit_days,
CASE WHEN p.region_code IS NULL THEN 1 ELSE 0 END AS policy_join_missing
FROM identity.customers AS c
LEFT JOIN policy.regional_ar_rules AS p ON p.region_code = c.customer_region
), order_events AS (
SELECT o.order_id AS event_id, o.order_id, o.customer_id, o.ordered_at AS event_at,
o.order_total AS amount, 0 AS source_join_missing
FROM commerce.orders AS o
), invoice_events AS (
SELECT a.invoice_id AS event_id, a.order_id, a.customer_id, a.posted_at AS event_at,
a.amount, 0 AS source_join_missing
FROM finance.ar_transactions AS a
), order_comparison AS (
SELECT o.order_id, o.customer_id, o.event_at AS ordered_at, o.amount AS order_total,
a.amount AS invoice_amount
FROM order_events AS o
LEFT JOIN invoice_events AS a ON a.order_id = o.order_id
), payment_events AS (
SELECT s.settlement_id AS event_id, a.customer_id, s.settled_at AS event_at,
-s.settled_amount AS amount,
CASE WHEN a.invoice_id IS NULL THEN 1 ELSE 0 END AS source_join_missing
FROM payments.settlements AS s
LEFT JOIN finance.ar_transactions AS a ON a.invoice_id = s.invoice_id
), return_refund_events AS (
SELECT r.return_id AS event_id, o.customer_id, r.returned_at AS event_at,
-r.refund_amount AS amount,
CASE WHEN o.order_id IS NULL THEN 1 ELSE 0 END AS source_join_missing
FROM commerce.returns_refunds AS r
LEFT JOIN commerce.orders AS o ON o.order_id = r.order_id
), fulfillment_events AS (
SELECT s.shipment_id AS event_id, o.customer_id, s.delivered_at AS event_at,
CAST(0 AS decimal(18, 2)) AS amount,
CASE WHEN o.order_id IS NULL THEN 1 ELSE 0 END AS source_join_missing
FROM fulfillment.shipments AS s
LEFT JOIN commerce.orders AS o ON o.order_id = s.order_id
), normalized_events AS (
SELECT event_id, customer_id, event_at, amount, 'ORDER' AS event_type, 0 AS affects_ar,
source_join_missing
FROM order_events
UNION ALL
SELECT event_id, customer_id, event_at, amount, 'INVOICE' AS event_type, 1 AS affects_ar,
source_join_missing
FROM invoice_events
UNION ALL
SELECT event_id, customer_id, event_at, amount, 'PAYMENT' AS event_type, 1 AS affects_ar,
source_join_missing
FROM payment_events
UNION ALL
SELECT event_id, customer_id, event_at, amount, 'REFUND' AS event_type, 1 AS affects_ar,
source_join_missing
FROM return_refund_events
UNION ALL
SELECT event_id, customer_id, event_at, amount, 'FULFILLMENT' AS event_type, 0 AS affects_ar,
source_join_missing
FROM fulfillment_events
), running_balance AS (
SELECT event_id, customer_id, event_at, amount, event_type, affects_ar,
source_join_missing,
SUM(CASE WHEN affects_ar = 1 THEN amount ELSE CAST(0 AS decimal(18, 2)) END)
OVER (PARTITION BY customer_id,
CASE WHEN customer_id IS NULL THEN event_id END
ORDER BY event_at, event_id
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_balance
FROM normalized_events
), order_invoice_mismatches AS (
SELECT order_id, customer_id
FROM order_comparison
WHERE invoice_amount IS NULL OR order_total <> invoice_amount
), final_results AS (
SELECT r.event_id, r.customer_id, r.event_at, r.amount, r.event_type, r.affects_ar,
r.running_balance, c.account_id, c.customer_region, c.credit_days,
CASE
WHEN r.source_join_missing = 1 OR c.customer_id IS NULL
OR c.policy_join_missing = 1 THEN 'MISSING_JOIN'
WHEN m.order_id IS NOT NULL THEN 'ORDER_INVOICE_MISMATCH'
WHEN r.affects_ar = 1 AND (r.running_balance < 0 OR r.amount IS NULL)
THEN 'AR_BALANCE_EXCEPTION'
ELSE NULL
END AS issue_label
FROM running_balance AS r
LEFT JOIN order_invoice_mismatches AS m
ON m.customer_id = r.customer_id AND m.order_id = r.event_id
LEFT JOIN customer_scope AS c ON c.customer_id = r.customer_id
)
SELECT f.*
FROM final_results AS f
ORDER BY f.customer_id, f.event_at, f.event_id;