Urgent.News

What's breaking now, across thousands of outlets.

Tech

An Empty Array Is Not Proof That a Vehicle Has No Fines

Design a traffic-fine API that distinguishes empty results from unavailable sources, preserves provenance, and gives drivers and fleet operators usable answers.

An Empty Array Is Not Proof That a Vehicle Has No Fines

Checking a used car's traffic fine history before purchase can be misleading if one result appears as a green total without proper context. This is because the database, API, and JSON may be technically available, but the information could still be incomplete or inaccurate. The design problem lies in aggregating records from independent sources, requiring the response to clearly describe what was observed and what remains unknown.

The proposed solution is a design pattern that separates source outcomes from records, rather than using an array to claim no fines. Four explicit outcomes should be included: completed with records, completed without records, unavailable, and not queried. Each outcome should have a reason, such as timeout or access challenge. A successful empty result should only occur after the integration validates and recognizes the source's response.

Completeness should be determined based on an explicit set of intended sources for the query. Coverage does not guarantee checking every possible jurisdiction. The message should inform the user about the sources checked and the one that could not be checked. Retries should resolve unknown results instead of erasing the original observation.

Document which source and query the retry belongs to, replacing the outcome only when a newer attempt produces a valid result. Limit retries and make retryability explicit. Temporary network failures and access challenges require different handling. Notifications should retain the last confirmed observation and communicate unresolved refreshes separately.

Preserve provenance while normalizing dates, currencies, and status labels. Deduplication should avoid merging records that look similar but are not the same. Financial totals should state which records and statuses they include. Testing the reassurance is crucial, covering combinations of source completions, failures, and cached observations.

The product promise must match the available evidence to the user. Clear boundaries between checked, found, and unknown results are essential for drivers evaluating used cars and fleet operators monitoring vehicles.

Written by urgent.news from HackerNoon's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at hackernoon.com →

More in Tech

More from Thursday 29 October →