MANAGER.py — Manager.io Accounting API Client
BCHPR · finance and supply chain · 2023 – present
15,661-line Manager.io API client. Full create / update / delete across 18 document types — sales quotes, orders, invoices, credit notes, delivery notes and receipts; purchase quotes, orders, invoices and debit notes; inventory items, locations, transfers, write-offs, goods receipts, production orders and starting balances; and payments. Customers, suppliers, projects, accounts, assets and tax codes are exposed read-only.
Highlights
- Manager.io list endpoints return summaries only, so every full record needs a second call — those run thread-parallel rather than in sequence.
- Server-side pagination, sort and field projection via a fluent QueryBuilder; timestamp filtering is client-side because the API does not support it.
- A dedicated timestamp pipeline built to fix three named defects: same-second edits dropped by a “+1 microsecond” hack, naive-versus-aware datetime comparisons raising TypeError, and untimestamped records silently discarded.
- Manual redirect handling — Manager.io's load balancer answers writes with a 302, and following it naively turns a POST into a GET and loses the body.
- Per-business custom fields (seven types) expanded onto sales, purchase, inventory and account records so callers get named columns rather than opaque IDs.
- Retry with exponential backoff and jitter on 408, 429 and 5xx; in-memory TTL caches on chart-of-accounts and inventory lookups.
Related projects
Data Manager
data_quality_manager.py — Data-Quality Engine
REDCap validates one field at a time, at entry. It cannot express “this specimen date precedes the enrolment date on a different form”, or “these two record IDs are the same participant”. This 14,274-line engine does, and it remembers — every issue it raises has an open date, a close date, and a resolution time.
Data Manager
data_utilities.py — Shared DataFrame Toolbox
The dependency root of the library — 9,746 lines that import nothing else in the codebase and that everything else imports. 84 public callables covering REDCap activity-log parsing, data-dictionary recoding, checkbox column expansion, export diffing, and file I/O that survives a SharePoint sync.
Data Manager
redcap_api.py — Typed REDCap API Facade
REDCap exposes one POST endpoint per project, dispatched by form parameters rather than typed routes, with no retry, no pagination, and no bulk file endpoint. This 6,561-line facade wraps 16 of those endpoints behind a typed surface of 42 exported names.