Add rx-history plugin - #396
Open
milosdjakovic-vicert wants to merge 1 commit into
Open
Conversation
Automates Surescripts medication history requests for upcoming appointments and surfaces the returned history in the patient chart. Two daily cron tasks send eligibility and medication history requests for patients with appointments 1 and 7 days out. A chart action button opens a side panel that groups the history by drug and flags each row as matched or unmatched against the active medication list, with add to note and dismiss actions. A provider menu application batches eligibility and medication history requests for a set of appointments inside a date range.
milosdjakovic-vicert
marked this pull request as ready for review
July 2, 2026 23:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
rx-history automates Surescripts medication history for upcoming appointments and surfaces it in the chart. Two daily cron tasks send Surescripts eligibility and medication history requests for patients with appointments 1 and 7 days out. A chart action button in the medications section opens a side panel that groups the returned history by drug, flags each row as matched or unmatched against the active medication list, and lets the provider add a missing medication to the open note or dismiss a row. A provider menu application opens a bulk requests page where staff trigger eligibility and medication history requests for any patient set inside a date range.
Problem it solves
At the point of care a provider often lacks a complete picture of what a patient is actually filling at the pharmacy. Surescripts holds that dispensed history, but pulling it by hand for each upcoming visit is slow and easy to forget. The plugin sends the requests automatically ahead of the appointment and lays the returned history next to the active medication list, so reconciliation gaps surface before the patient is in the room.
How it works
The two cron tasks run daily and fan out one request per eligible patient. The chart action button renders the comparison panel server side on click, so the panel does not wait on a fetch. The bulk page and the panel actions are backed by SimpleAPI endpoints under staff session auth. Adding a medication from the panel originates a MedicationStatementCommand on the open note. Each Surescripts row is matched against the active medication list by drug code rather than name, checking RxNorm CUI, then NDC on the digits only form, then an NDC to RxNorm cross reference through the FDB ontologies service. Matching flags a row but never suppresses it.
Configuration
The plugin owns the vicert__rx_history custom data namespace for its dismissal store. Set the namespace_read_write_access_key secret to the read and write key that Canvas generates when the plugin first installs. Manual and bulk requests are blocked unless the patient has a non cancelled appointment within a 7 day care event window.
Testing
The plugin ships a pytest suite covering the cron tasks, the action button and modal, the modal and bulk SimpleAPI endpoints, the dismissal store, and the static asset endpoint. All 109 tests pass and mypy is clean across 15 source files.