Context and problem
The problem shaped the architecture.
Document pipelines need to accept inconsistent PDFs, photographs and scans while giving downstream systems predictable text and metadata. A useful OCR service must make slow jobs, uncertain recognition and malformed inputs manageable through the API.
Documents that look similar to a person can require very different processing: a born-digital PDF may already contain a text layer, while a rotated phone photograph needs normalization before recognition. The service therefore had to expose one stable contract while preserving enough state and confidence information to handle imperfect inputs honestly.