Project

Open Pharmacy

A reference implementation of a US pharmacy backend: a REST API over prescriptions, patients, prescribers, medications, and dispensing locations, built with Django REST Framework on PostgreSQL.

  • python
  • django
  • rest-api
  • postgresql
  • docker
  • healthcare

A reference implementation of the backend for a US pharmacy. It exposes a REST API over prescriptions and the records they reference: patients, prescribers, medications, pharmacies, their dispensing locations, the staff they employ, and addresses. Django and Django REST Framework on PostgreSQL 18, packaged as a single container, with a Docker Compose quickstart that needs no local Python or database.

The domain is modelled the way the US pharmacy ecosystem identifies things rather than as generic CRUD:

  • Prescribers and dispensing sites carry an NPI, validated against its check-digit scheme.
  • Medications are keyed by NDC, accepted in any of the four segmented forms and normalized to the 11-digit layout.
  • Dispensing sites are keyed by NCPDP ID and may carry a DEA number.
  • Staff are keyed by state board registration, and a location records its pharmacist-in-charge.

It is a starting point to build on rather than a product. Authorization, an external identity provider, dispense events, and allergies are deliberately left for later.