Prescribe Formulary Benefits | Canvas Medical

kristenoneill/prescribe-formulary-benefits

Prescribe Formulary & Benefits

Surfaces real-time Surescripts formulary and benefits information as custom HTML inside the Prescribe, Refill, and Adjust Prescription commands, right after the prescriber selects a medication.

How it works

The plugin chains three Surescripts SDK capabilities across the request/response cycle:

  1. Medication present — when a medication (and its dispensable form/NDC) is chosen in a prescribe-family command, PrescribeBenefitsTrigger fires a SendSurescriptsEligibilityRequestEffect and writes a "checking coverage…" placeholder into the command via set_custom_html. It listens to both POST_ORIGINATE and POST_UPDATE, so commands that appear with a medication already set (refill/adjust of an existing prescription, favorites, re-prescribe) are covered too. For Adjust Prescription the medication is read from change_medication_to (the new drug), not the original prescription.
  2. Eligibility response — EligibilityResponseHandler receives the SURESCRIPTS_ELIGIBILITY_RESPONSE event, extracts the patient's plan, and fires a SendSurescriptsBenefitsRequestEffect for the chosen medication + plan.
  3. Benefits response — BenefitsResponseHandler receives the SURESCRIPTS_BENEFITS_RESPONSE event and renders the formulary status, prior authorization / step therapy flags, quantity limits, copays, and formulary alternatives as the command's custom HTML.

Each request effect carries a correlation_id that the home-app interpreter echoes back on the matching response. The plugin stashes per-command context under that id (in the SDK cache) so each response can be matched to the originating command — and so the handlers ignore responses they didn't start.

POST_ORIGINATE / POST_UPDATE (medication present)
   └─> eligibility request  ──┐  (correlation_id A, context cached)
                              ▼
        SURESCRIPTS_ELIGIBILITY_RESPONSE (A)
   └─> benefits request  ─────┐  (correlation_id B, context cached)
                              ▼
        SURESCRIPTS_BENEFITS_RESPONSE (B)
   └─> command.set_custom_html(<formulary detail>)

Requirements

This plugin depends on Surescripts SDK functionality:

These must be available on the target instance (the Surescripts effects are gated server-side behind the Surescripts feature switch).

Notes & assumptions

Install

canvas install prescribe_formulary_benefits

Tests

pytest

Learn more about Canvas