Implement FHIR Group resource management to define a patient cohort for population health queries and use the Group as the subject of a Bulk Data $export
domain: hl7.org/fhir/R4 · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Create a Group resource with type=person, actual=true, and characteristic entries defining cohort membership criteria (e.g., patients with an active Condition for diabetes)
Add member entries with entity references to Patient resources for an explicit (enumerated) group, or use characteristic-based definition for a dynamic group
POST the Group to the FHIR server and capture the returned Group.id
Initiate a Bulk Data group-level export with GET /Group/{id}/\$export using Prefer: respond-async and capture the Content-Location polling URL
Poll the Content-Location URL until HTTP 200 is returned; download each NDJSON file from the output array for each resource type
Known gotchas
Dynamic groups defined by characteristics are not universally supported for Bulk Data export; some servers only support explicit (member-enumerated) groups for $export — verify in the CapabilityStatement
Group.actual=true means the group lists real subjects; actual=false is a definitional group (e.g., a definition of who qualifies) and may not be usable as a Bulk Data export target
The Bulk Data export for a Group returns data only for current group members at the time of export initiation; members added to the group after the export starts are not included in that export run
Give your agent this knowledge — and 6,400+ more routes
One MCP install gives any agent live access to the full route map across 2,100+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp