m365_graph.py — Microsoft Graph Client
BCHPR · Microsoft 365 estate · 2023 – present
5,573-line Microsoft Graph client wrapping 73 distinct operations across Entra ID users and groups, SharePoint sites and lists, Microsoft Planner, and Teams. Planner is the centre of gravity at 43% of the file — activity tracking across study sites.
Highlights
- App-only OAuth 2.0 client-credentials flow; GraphUsers holds a TTL-checked token and refreshes on expiry.
- Resumable bulk Planner task creation — JSON checkpointing, deduplication against existing tasks, parallel ETag fetching, and batch size that adapts up on a 90% success rate and down below 50%.
- ETag-based optimistic concurrency on every Planner write, matching Planner's mandatory concurrency model.
- Graph $batch wrapper chunked to the 20-request limit, with responses correlated back by request id.
- Respects Retry-After on 429 and 503 with exponential backoff and jitter; @odata.nextLink pagination throughout.
- One-call directory export flattening each user's manager into manager_* columns via a second $expand pass.
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
MANAGER.py — Manager.io Accounting API Client
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.
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.