A review queue is an ordered holding area for records that did not fail outright but are not trustworthy enough for automatic storage. Validation issues and low-confidence results enter the queue; only trusted records continue to the catalog. section 12.6
A practical review-queue workflow:
- Track explicit outcomes such as success, needs_review, and failed instead of treating every non-success as the same failure. section 12.4
- Record the pipeline stage, confidence, URL, and validation notes so reviewers can understand why an item was flagged. section 12.4 section 12.6
- Keep needs_review and failed records out of the database or CSV; persist only records whose status is success. section 12.6
Triage and save
show_review_queue prints each flagged product, confidence, URL, and issue notes. save_results filters outcome["results"] for status == "success" and writes the trusted records to enriched_products.csv. Adjusting price ranges, required fields, or confidence thresholds changes how many records require human attention. section 12.6 section 12.5
Listing 12.9 Working the review queue and saving results
import pandas as pd
def show_review_queue(outcome): #A
"""Print why each flagged record needs a human."""
queue = outcome["review_queue"]
if not queue:
print("Nothing to review.")
return
for record in queue:
print(f"\n{record.search_key} ({record.confidence} conf.)")
print(f" url: {record.url}")
print(f" issues: {', '.join(record.notes) or 'low confidence'}")
def save_results(outcome, path="enriched_products.csv"): #B
"""Persist only the trusted records to a CSV catalog."""
good = [
r.enriched.model_dump() #C
for r in outcome["results"]
if r.status == "success" and r.enriched
]
df = pd.DataFrame(good)
df.to_csv(path, index=False) #D
print(f"Saved {len(df)} trusted records to {path}")
return df
show_review_queue(outcome) #E
catalog = save_results(outcome)
Inspect the Python implementation for displaying flagged records and saving only trusted results. section 12.6
