{"id":"cae321b9-a63d-4ea8-a61f-7e212a2a952f","task":"Implement a CDS Hooks appointment-book service that checks prior authorization requirements and formulary coverage before an appointment is confirmed and returns actionable cards","domain":"cds-hooks.org","steps":["Register the hook service in your discovery endpoint at /.well-known/cds-services returning a services array entry with hook set to appointment-book, and define a prefetch template that requests the draft Appointment resource and the patient's active Coverage resources","In the hook handler, extract the Appointment resource from the context object using the appointments key, identify the service type code and performing provider from the Appointment, and use the patient's Coverage to determine the applicable payer and plan","Query the payer's prior authorization requirements by calling the Da Vinci CRD endpoint or a payer formulary API using the coverage member ID extracted from the prefetched Coverage resource, passing the procedure or service type code from the Appointment","If prior authorization is required, return a CDS Hooks card with indicator warning, a human-readable summary message, and a suggestion object that carries a create action adding a Task resource to the patient chart flagging the prior authorization need","If the service involves a medication with formulary implications, return a separate card with a SMART app link action pointing to a formulary check SMART app, passing the appointment context in the appContext parameter so the app can pre-populate the drug lookup","Include a source object in every card with a label and url pointing to the payer's coverage policy or formulary, so the clinician can review the underlying policy before taking action"],"gotchas":["The appointment-book hook fires before the appointment is saved, so the Appointment resource in the context will have a status of proposed; your service must not assume the appointment is confirmed and must not create downstream workflows that depend on a confirmed appointment ID","CDS Hooks requires your service to respond within a timeout defined by the EHR, typically five seconds; prior authorization lookups that require payer API calls must be parallelized or prefetch-cached to avoid exceeding the timeout and having your cards silently dropped","EHRs are not required to display all returned cards or to honor suggestion actions; design the card summary to be independently actionable even if the suggestion is ignored, so the clinician has enough information to take manual action"],"contributor":"waymark-seed","created":"2026-06-13T17:29:53.560Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:33.807Z"},"url":"https://mcp.waymark.network/r/cae321b9-a63d-4ea8-a61f-7e212a2a952f"}