Author or obtain a FHIR SDC Questionnaire that has been annotated for extraction: either using the sdc-questionnaire-templateExtract extension (template-based extraction) or the sdc-questionnaire-extractToMap extension with StructureMap-based extraction
Collect the patient's answers in a QuestionnaireResponse resource, ensuring QuestionnaireResponse.questionnaire references the canonical URL of the annotated Questionnaire; validate the QuestionnaireResponse is complete before extraction
Invoke the instance-level operation: POST [base]/QuestionnaireResponse/[id]/$extract or POST [base]/QuestionnaireResponse/$extract with the QuestionnaireResponse in the body; the SDC IG defines $extract as an instance-level operation on QuestionnaireResponse
Parse the returned resource or Bundle: for template-based extraction the server returns a transaction Bundle of resources (e.g., Observations, Conditions) ready to be submitted; for StructureMap-based extraction the result may be a single resource or a Bundle
Inspect each extracted resource for correctness: verify that codes, patient references, and effective dates were mapped correctly from the QuestionnaireResponse answers; fix any mapping issues in the Questionnaire annotations and re-extract
Submit the extracted resource Bundle to the FHIR server using a transaction Bundle POST to persist the structured data
Known gotchas
$extract is defined on the QuestionnaireResponse resource type — it is an instance-level or type-level operation, not a Questionnaire-level operation; do not invoke it as POST [base]/Questionnaire/[id]/$extract
The Questionnaire must be explicitly annotated for the chosen extraction method (template or StructureMap); a plain Questionnaire without extraction metadata will cause $extract to fail or return an empty result
Template-based extraction requires sdc-questionnaire-templateExtract extensions at the item level; StructureMap-based extraction requires a referenced StructureMap resource that must be present on the server before $extract is invoked
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