Implement a FHIR Bulk Data group-level $export to export data for a specific cohort of patients defined by a FHIR Group resource, then reconcile exported data against the group membership
Create or identify a FHIR Group resource that defines the patient cohort, ensuring the Group has type=person and actual=true with member elements listing patient references
Send the async kick-off request to [base]/Group/[id]/$export with required headers including Accept: application/fhir+json and Prefer: respond-async
Include _since parameter if performing an incremental export to retrieve only resources modified after the last export timestamp
Poll the status endpoint and process the manifest, noting that group exports include all resource types for group members not just Patient resources
Reconcile the exported Patient resources against the Group.member list to detect any members that were excluded due to consent restrictions or server-side policy
Known gotchas
Not all FHIR servers support dynamic Group-based exports; some require Group resources to be pre-created by server admins rather than created via the FHIR REST API
The _since timestamp must use FHIR instant format (YYYY-MM-DDThh:mm:ss.sssZ) and is compared against the lastUpdated meta field which may not reflect the actual clinical event time
Group membership can change between when the export is kicked off and when it completes; the exported data reflects membership at kick-off time, creating potential for stale cohort definitions
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp