| name | asteria-data-quality-reconciliation |
| description | Reconcile Asteria Fleet Data Quality Hub collections and return strict JSON audit or certification answers. Use when a task references an Asteria hub, TASK_ENV_BASE_URL, environment_access.md, case_scope.json, answer_template.json, source snapshots, contacts, fuel, freight, maintenance events, reference aliases, unit conversions, FX, duplicate reconciliation, quarantine/exception counts, readiness, certification gates, or compact Asteria decision/control codes. |
Asteria Data Quality Reconciliation
Use this skill to solve Asteria Fleet Data Quality Hub tasks that provide a prompt, payloads/case_scope.json, payloads/answer_template.json, and environment_access.md.
Intake
- Read the prompt, the full case scope, and the full answer template before querying data.
- Treat
environment_access.md as the only source for network base URL, allowed endpoints, and query authorization.
- Return exactly one JSON object matching the answer template. Do not include Markdown, comments, extra keys, or task-local explanations.
- Preserve all ordering, length, enum, uniqueness, rounding, and
additionalProperties constraints from the template.
- Use only stable public IDs present in hub data or supplied by case scope.
Hub Access
- Prefer
POST /api/query with header Authorization: Bearer ... from environment_access.md.
- The query request body uses
{"query":"select ..."}.
- Inspect
/api/catalog/collections, /api/catalog/schema, and /api/source-snapshots first.
- Query logical views exposed by schema:
v_contacts
v_fuel_transactions
v_freight_charges
v_maintenance_events
v_reference_aliases
v_unit_conversions
v_fx_rates
v_source_snapshots
- Do not assume a single REST list response contains the full collection. Use SQL aggregation or explicit pagination.
Source Snapshot Rules
- Scope rows by
collection_id and the business cutoff/as-of dates in case_scope.json.
- Use source snapshot metadata to identify snapshot status, business cutoff, creation time, and row counts.
- For overlapping logical records in certified and provisional snapshots, retain the certified occurrence when present.
- Retain provisional-only logical records unless the prompt or template says otherwise.
- Count raw rows before deduplication; count logical records after grouping by the stable logical ID (
transaction_id, charge_id, event_id, or resolved contact/person).
- Compute duplicate raw count as raw occurrence count minus distinct logical count, unless the template defines a narrower duplicate set.
- For duplicate group outputs, include every logical ID with multiple raw occurrences, sort by logical ID, sort
snapshot_ids lexicographically, and report the retained snapshot.
Reference Matching
Use v_reference_aliases for fuel and freight classification.
- Normalize candidate descriptions and aliases case-insensitively.
- Match aliases as meaningful phrases/tokens, not arbitrary substrings inside unrelated words.
- Apply reference business-date validity (
valid_from, valid_to) and reference_status.
- Count a zero-match description as unrecognized.
- Count a description that matches aliases for more than one canonical value as ambiguous.
- Treat both zero-match and ambiguous classifications as unresolved/quarantined when the template asks for unrecognized or quarantine IDs.
- Compare recognized canonical value to expected value to compute valid mismatches.
- Valid mismatches remain in normalized totals unless the prompt says otherwise.
Common alias domains:
- Fuel canonical values:
BIODIESEL, DIESEL, ELECTRIC_CHARGE, PREMIUM_UNLEADED, UNLEADED.
- Freight canonical values:
EXPRESS, HAZMAT, OVERSIZE, REFRIGERATED, STANDARD.
Unit, Currency, And Rounding
- Use
v_unit_conversions for volume, weight, distance, and odometer conversions.
- Use the canonical units from case scope or template, usually
L, KG, KM, and USD.
- Use certified FX rows in
v_fx_rates for the business date and currency. Multiply source amount by usd_per_unit.
- Exclude quarantined transactions or charges from normalized totals.
- Include valid category/class mismatches in normalized totals.
- Round only at the final requested output precision. Most normalized totals use 2 decimal places; rates may require 4 decimal places.
Fuel Audit Rules
- Group raw rows by
transaction_id.
- Retain certified occurrence if duplicated; otherwise retain the only occurrence.
- A transaction is quarantined when quantity is nonpositive/invalid or classification is unresolved.
- A mismatch is a retained, valid transaction whose recognized fuel type differs from
expected_fuel_type.
exception_transaction_count is the distinct logical transactions with a mismatch or quarantine condition.
- Merchant exception ranking sorts by exception count descending, then
merchant_id ascending.
- Focus-asset rollups use retained logical transactions for the requested assets. Report logical count, valid count, mismatch count, quarantine count, exception count, and normalized valid totals.
Freight Audit Rules
- Group raw rows by
charge_id.
- Retain certified occurrence if duplicated; otherwise retain the only occurrence.
- A charge is quarantined when service class is unresolved, billed weight is nonpositive/invalid, or distance is nonpositive/invalid.
- A class mismatch is a retained, valid charge whose recognized service class differs from
expected_service_class.
- Quarantine reason counts are not mutually exclusive unless the template says they are; inspect wording carefully.
- Normalized totals include valid mismatches and exclude quarantines.
- Carrier ranking exposure is normalized USD on valid mismatches. Sort by mismatch exposure descending, then carrier ID ascending.
Maintenance Audit Rules
- Group raw rows by
event_id for cross-snapshot duplicate detection and source retention.
- Retain certified occurrence when an event appears in both certified and provisional snapshots.
- Reject events with missing/unparsable timestamps, invalid odometer values, negative labor, or extreme labor according to the case/template thresholds and evidence.
- Reconstruct the requested-period history from retained, non-rejected events inside the business period.
- Detect odometer regressions after unit-normalizing odometers to kilometers and sorting each asset by event time, then event ID as a deterministic tie-break.
- Report sequence-only regressions separately from invalid-event rejections when the template distinguishes them.
- Corrected distance is usually the sum across assets of last reliable odometer minus first reliable odometer in reconstructed history.
- Asset risk rankings follow the ranking policy in case scope exactly, including all tie-breaks.
Contact Reconciliation Rules
- Work over all in-scope contact rows for the collection and cutoff.
- Normalize emails with trim, Unicode NFKC, and lowercase.
- Normalize phones to digits only; if an 11-digit North American number starts with
1, drop the leading 1.
- Treat blank, null-like,
N/A, none, and NULL channel values as unusable.
- Build person clusters as connected components from strong evidence:
- same normalized usable email;
- same normalized usable phone plus corroborating name/source evidence;
- reliable shared
master_hint that does not represent a shared helpdesk/contact channel.
- Do not auto-merge shared phone or shared
master_hint groups when names/emails identify different people; mark them contested when requested.
- Choose a stable master/survivor from the retained source evidence using the task's source status, verified flags, business update times, and field-level precedence. Do not invent IDs.
- Canonical contact fields are field-level decisions, not whole-row copies. Record the source system for each canonical field when requested.
- Preserve Unicode names; clean whitespace and casing without stripping meaningful diacritics.
- A contact/person is dispatch-ready only when active, has at least one usable canonical email or phone, and consent is granted.
- Partition readiness counts mutually exclusively. Typical blockers are non-granted consent, no usable contact channel, and inactive record status.
- Quarantine rows are source rows with no usable contact channel when the task asks for row-level quarantine.
Compact Code Panels
Many templates require opaque Asteria codes. Infer them from the reconciled evidence and the enum family.
RB-* reference-policy codes partition reference alias rows by effective active/current, superseded/out-of-window/inactive, and provisional/unapproved states.
SB-* source-basis or source-retention codes partition retained logical records by certified-only, provisional-only, and cross-snapshot duplicate-retained cases.
LD-* ledger-disposition codes partition retained fuel/freight records by valid aligned, valid mismatch, unresolved zero-match classification, ambiguous classification, and invalid physical measure.
MS-* maintenance-source codes partition maintenance events by certified-only, provisional-only, and cross-snapshot duplicate-retained cases.
HR-* history-route codes partition maintenance events by accepted history, rejected invalid event, and sequence/regression handling.
IC-*, OR-*, and FP-* contact control codes partition identity resolution, outreach/readiness, and field-provenance outcomes.
When a case scope supplies anchored control cases or decision IDs, classify each anchor into its evidence bucket first, then assign the corresponding allowed code consistently across every row in that bucket. Do not guess a code from enum order alone if anchors make the mapping clear.
Certification And Status
- Apply status thresholds and action maps from
case_scope.json.
- If explicit certification gates are supplied, use them exactly.
- Typical pattern:
- no exceptions/quarantine/regressions:
PASS with release action;
- exceptions within tolerance:
PASS_WITH_EXCEPTIONS with review action;
- gate failure or threshold breach:
HOLD with block/remediate action.
- Use the exact key names from the template, such as
next_action, action, or routing.
Output Assembly Checklist
Before finalizing:
- Validate top-level required keys and forbid extra keys.
- Check every scoped panel has exactly the requested IDs and order.
- Sort all stable-ID lists as specified, usually lexicographically.
- Confirm counts reconcile: raw, logical, duplicate, valid, mismatch, quarantine, readiness partitions, and ranking totals.
- Confirm normalized totals exclude quarantines and include valid mismatches.
- Confirm all enum values appear exactly as allowed.
- Confirm numbers use requested precision and JSON numbers remain numbers, not strings.