Skip to content

Label Parser Utility

goldy4719 edited this page Apr 10, 2026 · 1 revision

Overview:

The parser converts raw Rekognition detect_labels responses into a normalized and reusable tag format. It outputs a deterministic list of label names and confidence scores for consistent use across backend and frontend systems.

Prerequisites

  • Raw JSON responses from the lab harness
  • Defined tag schema: [{ "name": string, "confidence": number }]
  • Unit testing setup
  • Established normalization policy

Implementation/Steps

  1. The system extracts label names and confidence values from the raw response.
  2. The system normalizes label names using a consistent casing policy (lowercase).
  3. The system returns a list of tag objects following the defined schema.
  4. The system sorts tags in descending order by confidence.
  5. The system validates output using fixture-based tests without AWS calls.
  6. The system routes lab harness output through the parser for consistency.

Key Takeaways

  • The parser remains pure Python for reuse and testing.
  • Normalization ensures consistent output across consumers.
  • Deterministic ordering supports downstream reliability.
  • All transformation logic is centralized in one place.

Clone this wiki locally