Skip to content
All projects
Core engineering libraryEngineer

redcap_client.py — Type-Safe REDCap Facade

BCHPR · 4 REDCap servers · 13+ projects · 2023 – present

1,986-line type-safe REDCap API facade with configurable retry / backoff, SQLite operation tracking, parallel exports, and Polars-optimised record processing.

Highlights

  • HTTPAdapter + urllib3 Retry for bulletproof retry on 5xx with exponential backoff.
  • ThreadPoolExecutor parallel export of multi-instrument / multi-report fetches (3-5× vs sequential).
  • SQLite operation log: every API call with timestamp, response time, and success / failure — enabling forensic performance analysis.
  • Chunked imports (configurable, default 2,000 records per request) with automatic retry on partial failure.
  • Polars-first record processing with pandas fallback; runtime detection without hard dependency.