# rasool-muhiddin/pharmacy_app architecture

> Architecture diagram of the GitHub repository rasool-muhiddin/pharmacy_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rasool-muhiddin/pharmacy_app
- Repository: https://github.com/rasool-muhiddin/pharmacy_app

## Overview

This repository contains a Django pharmacy-management backend alongside Flutter platform shells; the README does not document product features, and the Flutter application source is absent from the tree. The visible backend workflow is an authenticated client request handled by API views, which apply licensing and membership permissions and delegate pharmacy operations to domain modules backed by pharmacy records. Distinct capabilities include stock and purchasing, supplier accounting, reports, and offline-data import. The graph preserves these substantial backend modules; relationships are limited to those supported by sampled excerpts or the SOURCE INDEX.

Main entry points: [`backend/pharmacy_data/views.py`](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/views.py) (Pharmacy API), [`backend/pharmacy_data/models.py`](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/models.py) (Pharmacy records), [`backend/pharmacy_data/stock.py`](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/stock.py) (Stock operations), [`backend/pharmacy_data/supplier_ledger.py`](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/supplier_ledger.py) (Supplier ledger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["API and access"]
  node_api["Pharmacy API<br/>[views.py]"]
  node_desktop_api["Desktop API<br/>[views.py]"]
  node_permissions["License permissions<br/>[permissions.py]"]
  node_serializers["API serializers<br/>[serializers.py]"]
end

subgraph group_records["Pharmacy records"]
  node_license_records["License and membership<br/>[models.py]"]
  node_pharmacy_records[("Pharmacy records<br/>[models.py]")]
end

subgraph group_operations["Business operations"]
  node_stock["Stock operations<br/>[stock.py]"]
  node_purchase_list["Purchase invoices<br/>[purchase_list.py]"]
  node_purchase_returns["Purchase returns"]
  node_supplier_ledger["Supplier ledger<br/>[supplier_ledger.py]"]
end

subgraph group_insights["Reporting and migration"]
  node_reports["Business reports<br/>[reports.py]"]
  node_offline_import["Offline data import<br/>[offline_import.py]"]
end

node_client(("Pharmacy client"))

node_client -.->|"sends requests"| node_api
node_api -.->|"checks access"| node_permissions
node_api -.->|"queries records"| node_pharmacy_records
node_api -->|"uses serializers"| node_serializers
node_api -->|"delegates stock"| node_stock
node_api -->|"delegates purchasing"| node_purchase_list
node_api -->|"delegates returns"| node_purchase_returns
node_api -->|"uses ledger"| node_supplier_ledger
node_api -->|"delegates reports"| node_reports
node_api -->|"delegates import"| node_offline_import
node_permissions -->|"checks license"| node_license_records
node_license_records -->|"validates plan"| node_permissions
node_serializers -->|"serializes records"| node_pharmacy_records
node_stock -->|"updates stock"| node_pharmacy_records
node_purchase_list -->|"updates stock"| node_stock
node_purchase_list -->|"uses ledger"| node_supplier_ledger
node_purchase_list -->|"reads and writes"| node_pharmacy_records
node_purchase_returns -->|"restores stock"| node_stock
node_purchase_returns -->|"adjusts ledger"| node_supplier_ledger
node_purchase_returns -->|"updates records"| node_pharmacy_records
node_supplier_ledger -->|"uses money helpers"| node_stock
node_supplier_ledger -->|"calculates balances"| node_pharmacy_records
node_reports -->|"uses stock logic"| node_stock
node_reports -->|"uses ledger figures"| node_supplier_ledger
node_reports -->|"queries records"| node_pharmacy_records
node_offline_import -->|"checks permissions"| node_permissions
node_offline_import -->|"reconciles stock"| node_stock
node_offline_import -->|"imports records"| node_pharmacy_records

click node_api "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/views.py"
click node_desktop_api "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/desktop_api/views.py"
click node_permissions "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/desktop_api/permissions.py"
click node_license_records "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/desktop_api/models.py"
click node_pharmacy_records "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/models.py"
click node_serializers "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/serializers.py"
click node_stock "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/stock.py"
click node_purchase_list "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/purchase_list.py"
click node_purchase_returns "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/purchase_returns.py"
click node_supplier_ledger "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/supplier_ledger.py"
click node_reports "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/reports.py"
click node_offline_import "https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/offline_import.py"

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_api,node_desktop_api,node_permissions,node_serializers,node_client toneBlue
class node_license_records,node_pharmacy_records toneAmber
class node_stock,node_purchase_list,node_purchase_returns,node_supplier_ledger toneMint
class node_reports,node_offline_import toneRose
```

## Components

### API and access

- [Pharmacy API](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/views.py): `backend/pharmacy_data/views.py`
- [Desktop API](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/desktop_api/views.py): `backend/desktop_api/views.py`
- [License permissions](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/desktop_api/permissions.py): `backend/desktop_api/permissions.py`
- [API serializers](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/serializers.py): `backend/pharmacy_data/serializers.py`

### Pharmacy records

- [License and membership](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/desktop_api/models.py): `backend/desktop_api/models.py`
- [Pharmacy records](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/models.py): `backend/pharmacy_data/models.py`

### Business operations

- [Stock operations](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/stock.py): `backend/pharmacy_data/stock.py`
- [Purchase invoices](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/purchase_list.py): `backend/pharmacy_data/purchase_list.py`
- [Purchase returns](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/purchase_returns.py): `backend/pharmacy_data/purchase_returns.py`
- [Supplier ledger](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/supplier_ledger.py): `backend/pharmacy_data/supplier_ledger.py`

### Reporting and migration

- [Business reports](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/reports.py): `backend/pharmacy_data/reports.py`
- [Offline data import](https://github.com/rasool-muhiddin/pharmacy_app/blob/main/backend/pharmacy_data/offline_import.py): `backend/pharmacy_data/offline_import.py`

### Other components

- **Pharmacy client**

## Connections

- Pharmacy client → Pharmacy API: sends requests
- Pharmacy API → License permissions: checks access (evidence: `backend/pharmacy_data/views.py`)
- Pharmacy API → Pharmacy records: queries records (evidence: `backend/pharmacy_data/views.py`)
- Pharmacy API → API serializers: uses serializers (evidence: `backend/pharmacy_data/views.py`)
- Pharmacy API → Stock operations: delegates stock (evidence: `backend/pharmacy_data/views.py`)
- Pharmacy API → Purchase invoices: delegates purchasing (evidence: `backend/pharmacy_data/views.py`)
- Pharmacy API → Purchase returns: delegates returns (evidence: `backend/pharmacy_data/views.py`)
- Pharmacy API → Supplier ledger: uses ledger (evidence: `backend/pharmacy_data/views.py`)
- Pharmacy API → Business reports: delegates reports (evidence: `backend/pharmacy_data/views.py`)
- Pharmacy API → Offline data import: delegates import (evidence: `backend/pharmacy_data/views.py`)
- License permissions → License and membership: checks license (evidence: `backend/desktop_api/permissions.py`)
- License and membership → License permissions: validates plan (evidence: `backend/desktop_api/models.py`)
- API serializers → Pharmacy records: serializes records (evidence: `backend/pharmacy_data/serializers.py`)
- Stock operations → Pharmacy records: updates stock (evidence: `backend/pharmacy_data/stock.py`)
- Purchase invoices → Stock operations: updates stock (evidence: `backend/pharmacy_data/purchase_list.py`)
- Purchase invoices → Supplier ledger: uses ledger (evidence: `backend/pharmacy_data/purchase_list.py`)
- Purchase invoices → Pharmacy records: reads and writes (evidence: `backend/pharmacy_data/purchase_list.py`)
- Purchase returns → Stock operations: restores stock (evidence: `backend/pharmacy_data/purchase_returns.py`)
- Purchase returns → Supplier ledger: adjusts ledger (evidence: `backend/pharmacy_data/purchase_returns.py`)
- Purchase returns → Pharmacy records: updates records (evidence: `backend/pharmacy_data/purchase_returns.py`)
- Supplier ledger → Stock operations: uses money helpers (evidence: `backend/pharmacy_data/supplier_ledger.py`)
- Supplier ledger → Pharmacy records: calculates balances (evidence: `backend/pharmacy_data/supplier_ledger.py`)
- Business reports → Stock operations: uses stock logic (evidence: `backend/pharmacy_data/reports.py`)
- Business reports → Supplier ledger: uses ledger figures (evidence: `backend/pharmacy_data/reports.py`)
- Business reports → Pharmacy records: queries records (evidence: `backend/pharmacy_data/reports.py`)
- Offline data import → License permissions: checks permissions (evidence: `backend/pharmacy_data/offline_import.py`)
- Offline data import → Stock operations: reconciles stock (evidence: `backend/pharmacy_data/offline_import.py`)
- Offline data import → Pharmacy records: imports records (evidence: `backend/pharmacy_data/offline_import.py`)
