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.
Related projects
Architect
my_functions.py — Centralised Python Library
The 21,086-line shared Python library that every BCHPR data project depends on — APIManager, PathsManager, REDCap wrappers, study-ID generation, SharePoint I/O, and dozens of cross-project utilities.
Architect
data_quality_manager.py — Enterprise DQA Framework
11,007-line data quality platform with fluent QueryBuilder, persistent query lifecycle tracking, duplicate analysis, and double-data-entry verification across 28+ instruments — with SQLite persistence and Polars acceleration.
Engineer
study_id_patterns.py — Study-ID Regex Registry
2,611-line centralised registry of 8 study-ID patterns and 14 site-code patterns across Cameroon, Nigeria, and Vietnam projects — with vectorised extraction, validation, classification, and cleaning.