EPCSApproval
ComplexMedications
<co-epcs-approval>EPCSApproval is the two-factor signing step for controlled-substance e-prescriptions: summary, PDMP check, PIN and token code.
import { EPCSApproval } from 'health-components';
Examples
Pin And Done
Wrong Pin
Locked
Done
Usage
<EPCSApproval drug="Oxycodone 5 mg" schedule="C-II" sig="..." qty={20} prescriber="Tom Reyes" dea="BR1234563" />
When to use
- Signing any C-II to C-V prescription.
When not to use
- Non-controlled prescriptions.
Variants and states
| Variant | What it is |
|---|---|
| pin | Waiting for factors. |
| done | Signed and sent. |
| locked | Too many failures. |
Accessibility
- PIN dots announce progress.
Do and don't
- Do: Show the PDMP check time.
- Don't: Store or prefill factors.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
drug * | string | — | Drug, strength and form; required |
schedule * | string | — | DEA schedule ("C-II"); required |
sig * | string | — | Directions; required |
qty * | string | number | — | Quantity; required |
prescriber * | string | — | Prescriber name; required |
dea * | string | — | Prescriber DEA number; required |
pdmp | string | "Checked today 10:02 AM, no concerns" | PDMP check result |
pharmacy | string | "the pharmacy" | Pharmacy, in the done message |
audit | string | "000123" | Audit record number, in the done message |
state | EPCSState | 'pin' | 'pin' (waiting for factors) | 'done' (signed and sent) | 'locked' (too many failures) |
pin | string | undefined (uncontrolled, starts empty: never prefill factors) | Signing PIN (controlled) |
onPinChange | (pin: string) => void | none | Called as PIN digits are entered or deleted |
code | string | undefined (uncontrolled, starts empty) | One-time token code (controlled) |
onCodeChange | (code: string) => void | none | Called as the token code changes |
error | string | none | Error under the PIN dots ("Wrong PIN. 2 tries left.") |
onSign | (factors: EPCSFactors) => void | none | Sign and Send clicked with both factors complete |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-epcs-approval>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
Angular template
<co-epcs-approval drug="…" schedule="…" [qty]="qty" (co-pin-change)="onPinChange($event.detail)"></co-epcs-approval>
| Kind | Name | Description |
|---|---|---|
| attribute | drug | Drug, strength and form; required |
| attribute | schedule | DEA schedule ("C-II"); required |
| attribute | sig | Directions; required |
| property / JSON attribute | qty | Quantity; required |
| attribute | prescriber | Prescriber name; required |
| attribute | dea | Prescriber DEA number; required |
| attribute | pdmp | PDMP check result; default "Checked today 10:02 AM, no concerns" |
| attribute | pharmacy | Pharmacy, in the done message; default "the pharmacy" |
| attribute | audit | Audit record number, in the done message; default "000123" |
| attribute | state | 'pin' (waiting for factors) | 'done' (signed and sent) | 'locked' (too many failures); default 'pin' |
| attribute | pin | Signing PIN (controlled); default undefined (uncontrolled, starts empty: never prefill factors) |
| attribute | code | One-time token code (controlled); default undefined (uncontrolled, starts empty) |
| attribute | error | Error under the PIN dots ("Wrong PIN. 2 tries left."); default none |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-pin-change | Called as PIN digits are entered or deleted; default none (React: onPinChange) |
| event | co-code-change | Called as the token code changes; default none (React: onCodeChange) |
| event | co-sign | Sign and Send clicked with both factors complete; default none (React: onSign) |