Reference
A compact data-and-screen reference for the Pharmacy module: the sidebar items and their routes, the controllers behind each screen, every permission key, the main database tables, the workflow status values, the scheduled jobs and dashboard widgets, and the two API surfaces. Written to be looked up, not read cover to cover.
Module slug: pharmacy | Version: 0.5.0 | Route prefix: pharmacy
Menu items & routes
The Pharmacy sidebar group (display label "Pharmacy"), in order. Each item is gated by its permission; the two advanced items also by a sub-toggle.
| Menu item | Route | Permission | Sub-toggle |
|---|---|---|---|
| Overview | /pharmacy | pharmacy | — |
| Drug Catalog | /pharmacy/products | pharmacy_product | — |
| Near-Expiry & Lots | /pharmacy/expiry | pharmacy_expiry | — |
| Prescriptions | /pharmacy/prescriptions | pharmacy_prescription | — |
| Patients & Prescribers | /pharmacy/patients | pharmacy_patient | — |
| Controlled Drugs | /pharmacy/controlled | pharmacy_controlled_view | module_pharmacy_controlled |
| Quality & Safety | /pharmacy/quality | pharmacy_quality | module_pharmacy_quality |
| Compliance Center | /pharmacy/compliance | pharmacy_compliance | — |
| Settings | /pharmacy/settings | pharmacy_settings | — |
Additional routed surfaces that live within these workspaces: /pharmacy/licenses, /pharmacy/credentials, /pharmacy/duty, /pharmacy/tasks, /pharmacy/inspection_packs (Compliance Center tabs); /pharmacy/generic_groups, /pharmacy/suppliers (Drug Catalog tabs); and /pharmacy/prescribers (Patients hub tab).
Controllers & the screens they drive
| Controller | Screen / responsibility |
|---|---|
Pharmacy | Overview command center (read-only dashboard). |
Compliance_center | The tabbed compliance hub (readiness + on-duty summary). |
Pharmacy_licenses | Licenses & Permits CRUD (FDA LTO / permit / RMP). |
Pharmacy_credentials | Pharmacist credentials CRUD (PRC / PIC / training). |
Duty_sessions | Start / end pharmacist duty sessions (validates a non-expired credential). |
Pharmacy_compliance_tasks | Renewal-task checklist + mark-done + overdue detection. |
Inspection_packs | Generate / delete inspection-readiness snapshots. |
Pharmacy_products | Drug Catalog hub (Catalog / Generic Groups / Suppliers tabs), drug-profile CRUD, regulatory verifications. |
Pharmacy_generic_groups | Generic-group CRUD (interchangeable products). |
Pharmacy_suppliers | Supplier FDA-LTO licensing (extends Procurement vendors). |
Pharmacy_expiry | Read-only near-expiry / lot dashboard over the Warehouse ledger. |
Pharmacy_prescriptions | Rx queue, capture, items, status transitions, record-fill, dispensing label, BIR receipt. |
Pharmacy_patients | Patients hub, patient CRUD, representatives, medication profile, audited ID reveal. |
Pharmacy_prescribers | Prescriber directory CRUD. |
Controlled_register | Append-only controlled ledger, correction-by-reversal, reconciliation. |
Pharmacy_quality | Recalls (with batch quarantine), adverse events, cold-chain readings. |
Pharmacy_settings | Branch profiles + the advanced sub-toggles. |
Pharmacy_api | Integration (client) API controller. |
Pharmacy_euapi | End-User API controller. |
Permission keys
Keys are grouped by category as they appear in the Roles editor. The base pharmacy key is the module Enable toggle. Admins bypass all checks.
| Category | Keys |
|---|---|
| Base | pharmacy |
| Compliance | pharmacy_compliance, pharmacy_compliance_create, pharmacy_compliance_update, pharmacy_compliance_delete |
| Operations | pharmacy_duty |
| Catalog | pharmacy_product, pharmacy_product_create, pharmacy_product_update, pharmacy_product_delete, pharmacy_expiry |
| Dispensing | pharmacy_prescription, pharmacy_prescription_create, pharmacy_prescription_update, pharmacy_prescription_delete, pharmacy_prescription_validate, pharmacy_dispense |
| Patients | pharmacy_patient, pharmacy_patient_create, pharmacy_patient_update, pharmacy_patient_delete, pharmacy_patient_view_sensitive |
| Controlled | pharmacy_controlled_view, pharmacy_controlled_post, pharmacy_controlled_correct |
| Quality | pharmacy_quality, pharmacy_quality_create, pharmacy_quality_update, pharmacy_quality_delete, pharmacy_recall_manage |
| Settings | pharmacy_settings |
Database tables
The 26 tables the module owns (all in the tenant database, tracked in migrations_pharmacy). No stock, payment, supplier or product master is created here — those are reused from other modules.
| Group | Tables |
|---|---|
| Compliance | pharmacy_branch_profiles, pharmacy_licenses, pharmacy_credentials, pharmacy_duty_sessions, pharmacy_compliance_tasks, pharmacy_inspection_packs |
| Catalog | pharmacy_product_profiles, pharmacy_generic_groups, pharmacy_regulatory_verifications, pharmacy_supplier_profiles |
| Patients & prescribers | pharmacy_patients, pharmacy_patient_representatives, pharmacy_prescribers |
| Prescriptions & dispensing | pharmacy_prescriptions, pharmacy_prescription_items, pharmacy_prescription_documents, pharmacy_dispensing_records, pharmacy_dispensing_items |
| Statutory benefit | pharmacy_benefit_rule_versions, pharmacy_benefit_decisions, pharmacy_benefit_line_calculations |
| Safety | pharmacy_controlled_ledger, pharmacy_controlled_reconciliations, pharmacy_recall_cases, pharmacy_adverse_events, pharmacy_temperature_readings |
Status & workflow values
Prescription status
draft → submitted → validated → partially_filled → completed, with rejected and cancelled as exits. Transitions are atomic and one-way; validation and fills require a pharmacist on duty.
Controlled entry types
IN to balance: opening, receipt. OUT of balance: dispense, return, destruction. Plus correction — a linked reversing entry.
Recall status
draft → active (activation quarantines the matching Warehouse batch). Closed/other states track the case to resolution.
Statutory benefit
Benefit types: none, senior, pwd (mutually exclusive). Rule defaults: 20% discount, 12% VAT, senior booklet off. Order: VAT-exempt base, then 20% off. (₱112 → ₱80.)
Drug classification
Rx, pharmacist-OTC, OTC, medical device, supplement, controlled — plus a controlled schedule, FDA CPR number/status, storage condition, cold-chain flag, Senior/PWD eligibility and a price ceiling.
Expiry buckets
Expired · 0–30 days · 31–90 · 91–180 · over-180, computed live from the Warehouse batch ledger with on-hand value.
Cron jobs & dashboard widgets
| Type | Key | Detail |
|---|---|---|
| Cron job | pharmacy_license_expiry | Daily 07:00 — licenses/credentials expiring within 30 days or expired. |
| Cron job | pharmacy_near_expiry_stock | Daily 06:30 — pharmacy-classified stock lots expiring within 90 days (needs Warehouse). |
| Widget | pharmacy_compliance_readiness | Staff dashboard — branch readiness score. On by default. |
| Widget | pharmacy_expiring_compliance | Staff dashboard — expiring licenses & credentials. On by default. |
Both widgets are gated on module_pharmacy + pharmacy_compliance; both jobs self-gate on module_pharmacy and run per tenant.
API endpoints
Integration API — /api/v1/pharmacy
Bearer token, scope pharmacy:read ("Pharmacy (Read)"). Read-only: drug catalog + aggregate compliance readiness only.
| Method & path | Returns |
|---|---|
GET /api/v1/pharmacy/products | Paginated drug catalog (?page, ?per_page, ?classification). |
GET /api/v1/pharmacy/products/{id} | A single drug profile (404 product_not_found if missing). |
GET /api/v1/pharmacy/compliance | Aggregate compliance-readiness counts (no record-level detail). |
End-User API — /v1/api/pharmacy
Authenticated employee; gated by module_pharmacy + the matching web permit. Read-only; no patient/dispensing/controlled data.
| Method & path | Permit | Returns |
|---|---|---|
GET /v1/api/pharmacy/products | pharmacy_product | Paginated drug catalog. |
GET /v1/api/pharmacy/products/{id} | pharmacy_product | A single drug profile. |
GET /v1/api/pharmacy/near-expiry | pharmacy_expiry | Near-expiry lots (?within days; needs Warehouse — empty list without it). |
404 module_unavailable — the endpoint hides the resource's existence rather than returning a 403.Next: Research → — the live files this guide was built from.