# johnston-kweku/pharmaflow architecture

> Architecture diagram of the GitHub repository johnston-kweku/pharmaflow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/johnston-kweku/pharmaflow
- Repository: https://github.com/johnston-kweku/pharmaflow

## Overview

PharmaFlow is a Django pharmacy-management application. Staff sign in under a role, then manage users and customers, maintain the drug catalog, or enter wholesale and retail sales; sales create records and update stock, while administrators review dashboard analytics and receipts. The graph separates those domain capabilities from their Django view/model layer and browser interfaces. README-described capabilities such as AJAX carts and printable receipts are included, but their template wiring is not shown in the excerpts, so those links cite the README.

Main entry points: [`config/settings.py`](https://github.com/johnston-kweku/pharmaflow/blob/main/config/settings.py) (Relational Database), [`accounts/views.py`](https://github.com/johnston-kweku/pharmaflow/blob/main/accounts/views.py) (Sign-in & Roles), [`sales/views.py`](https://github.com/johnston-kweku/pharmaflow/blob/main/sales/views.py) (Wholesale Sales), [`sales/models.py`](https://github.com/johnston-kweku/pharmaflow/blob/main/sales/models.py) (Sales & Line Items)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity &amp; Customers"]
  node_access["Sign-in &amp; Roles<br/>[views.py]"]
  node_user_records["Staff Accounts<br/>[models.py]"]
  node_customer_records["Customer Records<br/>[models.py]"]
  node_customer_admin["Customer Management<br/>[views.py]"]
end

subgraph group_inventory["Inventory &amp; Analytics"]
  node_drug_catalog["Drug Catalog<br/>[models.py]"]
  node_stock_admin["Stock Management<br/>[views.py]"]
  node_dashboard["Business Dashboard<br/>[views.py]"]
  node_dashboard_ui["Dashboard Charts<br/>[dashboard.js]"]
  node_chart_library["Chart.js<br/>[chart.js]"]
end

subgraph group_sales["Sales Operations"]
  node_wholesale_ui["Wholesale Cart<br/>[wholesale.js]"]
  node_wholesale_flow["Wholesale Sales<br/>[views.py]"]
  node_retail_ui["Retail Cart<br/>[retail.js]"]
  node_retail_flow["Retail Sales<br/>[views.py]"]
  node_sale_records["Sales &amp; Line Items<br/>[models.py]"]
  node_sales_history["Sales History<br/>[views.py]"]
  node_receipts["Digital Receipts<br/>[views.py]"]
end

subgraph group_runtime["Application Runtime"]
  node_database[("Relational Database<br/>[settings.py]")]
  node_toast["Toast Notifications<br/>[toastManager.js]"]
end

node_staff(("Pharmacy Staff"))

node_staff -->|"signs in"| node_access
node_access -->|"checks roles"| node_user_records
node_access -->|"routes by role"| node_stock_admin
node_access -->|"routes by role"| node_wholesale_flow
node_access -->|"routes by role"| node_retail_flow
node_customer_admin -->|"manages"| node_customer_records
node_wholesale_ui -.->|"submits cart"| node_wholesale_flow
node_retail_ui -.->|"submits cart"| node_retail_flow
node_wholesale_flow -->|"loads stock"| node_drug_catalog
node_wholesale_flow -->|"loads customers"| node_customer_records
node_wholesale_flow -->|"creates sale"| node_sale_records
node_retail_flow -->|"loads stock"| node_drug_catalog
node_retail_flow -->|"loads customers"| node_customer_records
node_retail_flow -->|"creates sale"| node_sale_records
node_sale_records -.->|"reduces stock"| node_drug_catalog
node_stock_admin -->|"manages catalog"| node_drug_catalog
node_dashboard -->|"aggregates metrics"| node_sale_records
node_dashboard -->|"counts drugs"| node_drug_catalog
node_dashboard -.->|"provides chart data"| node_dashboard_ui
node_dashboard_ui -.->|"renders charts"| node_chart_library
node_sales_history -->|"lists sales"| node_sale_records
node_receipts -->|"loads sale"| node_sale_records
node_access -.->|"stores accounts"| node_database
node_customer_admin -->|"stores customers"| node_database
node_stock_admin -->|"reads and writes"| node_database
node_wholesale_flow -->|"stores sale"| node_database
node_retail_flow -->|"stores sale"| node_database
node_dashboard -->|"queries metrics"| node_database
node_sales_history -->|"queries sales"| node_database
node_receipts -->|"loads sale"| node_database

click node_access "https://github.com/johnston-kweku/pharmaflow/blob/main/accounts/views.py"
click node_user_records "https://github.com/johnston-kweku/pharmaflow/blob/main/accounts/models.py"
click node_customer_records "https://github.com/johnston-kweku/pharmaflow/blob/main/accounts/models.py"
click node_customer_admin "https://github.com/johnston-kweku/pharmaflow/blob/main/accounts/views.py"
click node_drug_catalog "https://github.com/johnston-kweku/pharmaflow/blob/main/inventory/models.py"
click node_stock_admin "https://github.com/johnston-kweku/pharmaflow/blob/main/inventory/views.py"
click node_dashboard "https://github.com/johnston-kweku/pharmaflow/blob/main/inventory/views.py"
click node_dashboard_ui "https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/inventory/dashboard.js"
click node_chart_library "https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/lib/chart.js"
click node_wholesale_ui "https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/sales/wholesale.js"
click node_wholesale_flow "https://github.com/johnston-kweku/pharmaflow/blob/main/sales/views.py"
click node_retail_ui "https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/sales/retail.js"
click node_retail_flow "https://github.com/johnston-kweku/pharmaflow/blob/main/sales/views.py"
click node_sale_records "https://github.com/johnston-kweku/pharmaflow/blob/main/sales/models.py"
click node_sales_history "https://github.com/johnston-kweku/pharmaflow/blob/main/sales/views.py"
click node_receipts "https://github.com/johnston-kweku/pharmaflow/blob/main/sales/views.py"
click node_database "https://github.com/johnston-kweku/pharmaflow/blob/main/config/settings.py"
click node_toast "https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/utils/toastManager.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_access,node_user_records,node_customer_records,node_customer_admin toneBlue
class node_drug_catalog,node_stock_admin,node_dashboard,node_dashboard_ui,node_chart_library toneAmber
class node_wholesale_ui,node_wholesale_flow,node_retail_ui,node_retail_flow,node_sale_records,node_sales_history,node_receipts toneMint
class node_database,node_toast toneRose
class node_staff toneIndigo
```

## Components

### Identity & Customers

- [Sign-in & Roles](https://github.com/johnston-kweku/pharmaflow/blob/main/accounts/views.py): `accounts/views.py`
- [Staff Accounts](https://github.com/johnston-kweku/pharmaflow/blob/main/accounts/models.py): `accounts/models.py`
- [Customer Records](https://github.com/johnston-kweku/pharmaflow/blob/main/accounts/models.py): `accounts/models.py`
- [Customer Management](https://github.com/johnston-kweku/pharmaflow/blob/main/accounts/views.py): `accounts/views.py`

### Inventory & Analytics

- [Drug Catalog](https://github.com/johnston-kweku/pharmaflow/blob/main/inventory/models.py): `inventory/models.py`
- [Stock Management](https://github.com/johnston-kweku/pharmaflow/blob/main/inventory/views.py): `inventory/views.py`
- [Business Dashboard](https://github.com/johnston-kweku/pharmaflow/blob/main/inventory/views.py): `inventory/views.py`
- [Dashboard Charts](https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/inventory/dashboard.js): `static/js/inventory/dashboard.js`
- [Chart.js](https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/lib/chart.js): `static/js/lib/chart.js`

### Sales Operations

- [Wholesale Cart](https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/sales/wholesale.js): `static/js/sales/wholesale.js`
- [Wholesale Sales](https://github.com/johnston-kweku/pharmaflow/blob/main/sales/views.py): `sales/views.py`
- [Retail Cart](https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/sales/retail.js): `static/js/sales/retail.js`
- [Retail Sales](https://github.com/johnston-kweku/pharmaflow/blob/main/sales/views.py): `sales/views.py`
- [Sales & Line Items](https://github.com/johnston-kweku/pharmaflow/blob/main/sales/models.py): `sales/models.py`
- [Sales History](https://github.com/johnston-kweku/pharmaflow/blob/main/sales/views.py): `sales/views.py`
- [Digital Receipts](https://github.com/johnston-kweku/pharmaflow/blob/main/sales/views.py): `sales/views.py`

### Application Runtime

- [Relational Database](https://github.com/johnston-kweku/pharmaflow/blob/main/config/settings.py): `config/settings.py`
- [Toast Notifications](https://github.com/johnston-kweku/pharmaflow/blob/main/static/js/utils/toastManager.js): `static/js/utils/toastManager.js`

### Other components

- **Pharmacy Staff**

## Connections

- Pharmacy Staff → Sign-in & Roles: signs in (evidence: `accounts/views.py`)
- Sign-in & Roles → Staff Accounts: checks roles (evidence: `accounts/views.py`)
- Sign-in & Roles → Stock Management: routes by role (evidence: `accounts/views.py`)
- Sign-in & Roles → Wholesale Sales: routes by role (evidence: `accounts/views.py`)
- Sign-in & Roles → Retail Sales: routes by role (evidence: `accounts/views.py`)
- Customer Management → Customer Records: manages (evidence: `accounts/views.py`)
- Wholesale Cart → Wholesale Sales: submits cart (evidence: `README.md`)
- Retail Cart → Retail Sales: submits cart (evidence: `README.md`)
- Wholesale Sales → Drug Catalog: loads stock (evidence: `sales/views.py`)
- Wholesale Sales → Customer Records: loads customers (evidence: `sales/views.py`)
- Wholesale Sales → Sales & Line Items: creates sale (evidence: `sales/views.py`)
- Retail Sales → Drug Catalog: loads stock (evidence: `sales/views.py`)
- Retail Sales → Customer Records: loads customers (evidence: `sales/views.py`)
- Retail Sales → Sales & Line Items: creates sale (evidence: `sales/views.py`)
- Sales & Line Items → Drug Catalog: reduces stock
- Stock Management → Drug Catalog: manages catalog (evidence: `inventory/views.py`)
- Business Dashboard → Sales & Line Items: aggregates metrics (evidence: `inventory/views.py`)
- Business Dashboard → Drug Catalog: counts drugs (evidence: `inventory/views.py`)
- Business Dashboard → Dashboard Charts: provides chart data (evidence: `README.md`)
- Dashboard Charts → Chart.js: renders charts (evidence: `README.md`)
- Sales History → Sales & Line Items: lists sales (evidence: `sales/views.py`)
- Digital Receipts → Sales & Line Items: loads sale (evidence: `sales/views.py`)
- Sign-in & Roles → Relational Database: stores accounts
- Customer Management → Relational Database: stores customers (evidence: `accounts/views.py`)
- Stock Management → Relational Database: reads and writes (evidence: `inventory/views.py`)
- Wholesale Sales → Relational Database: stores sale (evidence: `sales/views.py`)
- Retail Sales → Relational Database: stores sale (evidence: `sales/views.py`)
- Business Dashboard → Relational Database: queries metrics (evidence: `inventory/views.py`)
- Sales History → Relational Database: queries sales (evidence: `sales/views.py`)
- Digital Receipts → Relational Database: loads sale (evidence: `sales/views.py`)
