SAGEA LogoDocs & API
CookbooksOCR Cookbooks

Read Handwriting with Confidence Review

Transcribe handwritten intake forms and route uncertain blocks to staff for review.

  • Transcribe handwriting blocks with per-block confidence scores
  • Apply a confidence threshold to flag uncertain fields
  • Build a review queue with page numbers and text

Time to complete: ~10 minutes

Prerequisites

  • A SAGEA_API_KEY exported as an environment variable
  • A scanned intake form in PDF, PNG, JPG, TIFF, or WEBP format, max 100MB, ideally 300 DPI
  • Python 3.9+ with the requests package installed
  • Set up document processing
  • ARVA OCR model card

Step 1: Transcribe the intake form

Use model="arva-ocr" with JSON output to get handwriting blocks and confidence.

curl -X POST https://api.sagea.space/v1/ocr/process \
  -H "Authorization: Bearer $SAGEA_API_KEY" \
  -F model="arva-ocr" \
  -F [email protected] \
  -F output_format="json" \
  -o intake.json

Expected block shape:

{"text": "...", "pages": 1, "confidence": 0.992, "blocks": [{"type": "handwriting", "page": 1, "bbox": [x0,y0,x1,y1], "confidence": 0.87, "text": "..."}], "model_used": "arva-ocr"}

ARVA OCR supports 150+ languages and hits 99.2% on clean 300 DPI scans. Handwriting scores lower, so review matters.

Step 2: Flag low-confidence blocks

Split blocks into accepted and needs-review sets with a threshold.

curl -X POST https://api.sagea.space/v1/ocr/process \
  -H "Authorization: Bearer $SAGEA_API_KEY" \
  -F model="arva-ocr" \
  -F [email protected] \
  -F output_format="text"

Step 3: Build a review file for staff

Write a Markdown review queue that counselors can check quickly.

with open("review-queue.md", "w") as f:
    f.write("# Intake review queue\n\n")
    if not review:
        f.write("All blocks above threshold. No review needed.\n")
    for i, r in enumerate(review, 1):
        f.write(f"## Item {i} (page {r['page']}, conf {r['confidence']:.2f})\n\n")
        f.write(f"Type: {r['type']}\n\n")
        f.write(f"Text: {r['text']}\n\n")
        f.write("Staff check: [ ] confirmed / [ ] corrected\n\n")
 
print("wrote review-queue.md")

Standard pages cost $1.00 per 1000 pages, complex pages $2.50 per 1000 pages.

Verify

ErrorCauseFix
401 UnauthorizedMissing or invalid API keyExport a valid key as SAGEA_API_KEY and retry
400 unsupported_formatFile type not in PDF, PNG, JPG, TIFF, WEBPConvert the scan to JPG or PDF and retry
413 Payload Too LargeFile is over 100MBDownsample or split the scan, then retry
429 rate_limit_exceededToo many requests at onceBack off with retries and reduce concurrency

What's next

On this page