Agentic AI & Automation
The AI that runs inside 1QRx — not a chatbot bolted on, but agents wired into the compounding workflow
Safety gates
Agents that stop a bad outcome before it happens
A Schedule II–V fill cannot be released until a PMP/PDMP check is recorded. Pharmacist override is logged.
controlledDispenseGate() · scheduleOf()Coverage is adjudicated up front. A rejected/PA-required claim blocks compounding so you don't make what won't be paid.
adjudicate() (NCPDP 70/75/79)Verifying a compound is blocked when the lab assay is >±10% off label — the lot must be rejected, not signed.
assayInSpec()Captured weights are validated live against ±0.5% (liquids) / ±2% (solids); an out-of-tolerance reading won't check the step off.
weightWithinTolerance()A sterile or hazardous lot can't advance into compounding at a station whose environment doesn't match — it's blocked until moved to a compliant one, with the valid stations listed.
stationEnvOk() · USP <797>/<800>A too-soon refill (last-fill + days-supply) or an out-of-refills Rx is flagged and held before it enters the fill pipeline — heading off a payer '79 — Refill Too Soon' reject.
refillEligible()When a compound's assay is outside ±10% of label, the lot is auto-quarantined and routed to a disposition (Destroy / Rework / documented RPh waiver) — never silently signed.
assayInSpec() → dispositionBefore a lot is compounded, every non-QS active is checked against perpetual inventory; a short ingredient blocks the advance and low-stock (below reorder) warns.
ingredientsSufficient()Copilots
Agents that compute, pre-fill and diagnose for you
Beyond-Use Date auto-computed from the formula's real stability span at lot creation — replacing a naive +30-day stub.
budFromDate() · budShort()Every incoming Rx is risk-scored: controlled, prior-auth likely, BUD review, or sig↔dosage-form mismatch — before the fill starts.
triageRx()Auto-reconciles when billed-vs-expected is under 5%; for larger gaps it drafts a root-cause (missing line, copay split, discount).
reconcileVariance()Type an NPI, hit Look up — name, credential, specialty, clinic, address and phone pre-fill from the national registry.
/api/npi → NPPESStart typing a street address; pick a suggestion and city/state/ZIP fill automatically.
/api/address → geocoderWorkflow automations
Agents that remove the manual steps between stages
Recommends carrier + service by priority and destination (STAT→overnight, High→2-day, in-state→pickup) with one-click apply.
routeOrder()Payer rejections become tracked PA cases with SLA aging — on-track → due (5d) → overdue (9d) — and an escalate action.
paSla()Quarantine a lot, then cascade a recall to lots that share or reuse the formula, with an estimated patient scope to notify.
lot-as-ingredient cascadeAny report opens a real From/To calendar (current date default) with quick presets — Today, Last 7/30, This month.
native date pickersEvery controlled dispense is aged against its state PMP reporting window (CII next business day; tighter in AZ/CA) — on-track → due today → overdue — so nothing files late.
pdmpSubmissionDeadline() · pdmpDeadlineDays()The conversational AI Copilot is reachable from every screen (top bar). It answers in context for the active persona — pharmacist, prescriber, patient or HQ — on formulas, BUD/stability, SOPs, claims and order status.
- Real-time NCPDP D0 claim routing to live payers
- State PDMP submission orchestrator (ASAP 4.2)
- Carrier APIs for shipping + recall automation
- CoverMyMeds prior-auth status sync
Every agent is grounded in the business-rules engine (lib/rules.ts) — testable, auditable, and reused by both the UI and the server actions.