Data model

The Keystone lists in Openfront Pharmacy and how they relate.

Openfront Pharmacy has 45 Keystone lists in features/keystone/models. Most clinical, inventory, and money lists deny create, update, and delete through the generic API. They change only through named commands. Product, DrugReference, Supplier, Prescriber, PharmacyLocation, PaymentProvider, OrganizationMembership, and Organization use the generic drawers.

Tenant and access

ListPurpose
OrganizationThe pharmacy business. Branding, privacy notice, cash and tax policy, fill policy, storefrontKey/storefrontHost/slug
PharmacyLocationA store. Hours, address, ordering, pickup, delivery switches
OrganizationMembershipStaff member at an organization or one location, with role and credential evidence
User, RoleAccounts and the 19 permission flags
MachineCredentialToken records with prefix, hash, scopes, and expiry

Catalog and inventory

ListPurpose
DrugReference, DrugReferenceReviewNDC entries and the organization's review evidence
ProductOTC and prescription items
SupplierWholesalers
InventoryLotA received lot with quantities and expiry
InventoryMovementAppend-only stock ledger
TemperatureExcursionCold-chain breach records on a lot

Patients and prescriptions

ListPurpose
PatientProfile, PatientAllergy, PatientMedication, ConsentRecordPatient record, safety history, consents
PrescriberPrescribers with NPI and credential evidence
Prescription, PrescriptionItemThe prescription and its medication lines
PrescriptionReview, ClinicalSafetyReviewPharmacist and safety review history
PrescriptionFill, PrescriptionFillEventPer-fill entitlement and its event log
DispensingLabelLabel snapshot, immutable
RefillRequest, PrescriptionTransfer, PrescriptionRequestRefill, transfer, and online requests

Orders and payments

Cart, CartItem, Order, OrderLineItem, Fulfillment, PaymentProvider, PaymentSession, Payment, PaymentWebhookEvent.

Recalls, integrations, evidence

Recall, RecallExposure, IntegrationProvider, ExternalIntegrationWorkflow, IntegrationWebhookEvent, HumanApproval, AuditEvent, OutboxEvent.

Key relationships

  • Organization → many PharmacyLocation, OrganizationMembership, PatientProfile, Product, Prescription, Recall, Order.
  • Prescription → PatientProfile, Prescriber, PharmacyLocation; has many PrescriptionItem, reviews, safety reviews, DispensingLabel, RefillRequest, PrescriptionTransfer, and Order.
  • PrescriptionItem → DrugReference and Product.
  • Product → many InventoryLot → many InventoryMovement.
  • Recall → many InventoryLot and many RecallExposure; an exposure points to a patient, prescription, order, and movement.
  • Order → Fulfillment, many Payment, many OrderLineItem, optional PatientProfile and Prescription.
  • HumanApproval is referenced by the records it approved.

Prescription statuses and other state machines are on the page for each area. The checked-in docs/schema-map.md in the repo lists every field.

On this page