# bhim100/pharmacy_managament architecture

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

- Interactive diagram: https://gitdiagram.com/bhim100/pharmacy_managament
- Repository: https://github.com/bhim100/pharmacy_managament

## Overview

This is a Flask pharmacy-management application for staff to manage medicine inventory, customers, suppliers, billing, dashboards, and reports. The main workflow enters through Flask routes: staff search or manage records, or submit a checkout; route handlers call domain services, which query Oracle when configured and otherwise some services return sample data. Billing writes bills and stock changes transactionally. SQL schema and PL/SQL add database-side capabilities, but their runtime invocation is not shown in the excerpts, so they are represented as a separate database layer without speculative links.

Main entry points: [`backend/app.py`](https://github.com/bhim100/pharmacy_managament/blob/main/backend/app.py) (Flask routes), [`backend/db.py`](https://github.com/bhim100/pharmacy_managament/blob/main/backend/db.py) (Connection provider), [`backend/services/inventory_service.py`](https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/inventory_service.py) (Inventory management), [`backend/services/dashboard_service.py`](https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/dashboard_service.py) (Dashboard metrics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_flask["Flask routes<br/>[app.py]"]
  node_dashboard_ui["Dashboard views<br/>[home.html]"]
  node_billing_ui["Billing interface<br/>[billing.js]"]
  node_inventory_ui["Inventory interface<br/>[inventory.js]"]
end

subgraph group_domains["Pharmacy workflows"]
  node_dashboard["Dashboard metrics"]
  node_medicine["Medicine search"]
  node_inventory["Inventory management"]
  node_billing["Billing checkout<br/>[billing_service.py]"]
  node_customers["Customer records"]
  node_suppliers["Supplier records"]
  node_reports["Reports and exports<br/>[report_service.py]"]
end

subgraph group_data["Data access"]
  node_settings["Application settings<br/>[settings_store.py]"]
  node_connection["Connection provider<br/>[db.py]"]
  node_oracle[("Oracle database")]
end

subgraph group_database["Oracle database features"]
  node_schema["Relational schema<br/>[schema.sql]"]
  node_plsql["PL/SQL logic"]
end

node_staff(("Pharmacy staff"))

node_staff -->|"uses"| node_flask
node_flask -->|"requests metrics"| node_dashboard
node_flask -->|"searches"| node_medicine
node_flask -->|"manages stock"| node_inventory
node_flask -->|"submits checkout"| node_billing
node_flask -->|"manages customers"| node_customers
node_flask -->|"manages suppliers"| node_suppliers
node_flask -->|"requests reports"| node_reports
node_flask -->|"updates settings"| node_settings
node_dashboard -->|"opens connection"| node_connection
node_medicine -->|"opens connection"| node_connection
node_inventory -->|"opens connection"| node_connection
node_inventory -->|"reads thresholds"| node_settings
node_billing -->|"opens connection"| node_connection
node_customers -->|"opens connection"| node_connection
node_suppliers -->|"opens connection"| node_connection
node_reports -->|"opens connection"| node_connection
node_connection -->|"connects"| node_oracle
node_dashboard_ui -.->|"renders through"| node_flask
node_billing_ui -.->|"submits checkout"| node_flask
node_inventory_ui -.->|"uses routes"| node_flask
node_schema -.->|"defines tables"| node_oracle
node_plsql -.->|"database routines"| node_oracle

click node_flask "https://github.com/bhim100/pharmacy_managament/blob/main/backend/app.py"
click node_dashboard "https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/dashboard_service.py"
click node_medicine "https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/medicine_service.py"
click node_inventory "https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/inventory_service.py"
click node_billing "https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/billing_service.py"
click node_customers "https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/customer_service.py"
click node_suppliers "https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/supplier_service.py"
click node_reports "https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/report_service.py"
click node_settings "https://github.com/bhim100/pharmacy_managament/blob/main/backend/settings_store.py"
click node_connection "https://github.com/bhim100/pharmacy_managament/blob/main/backend/db.py"
click node_schema "https://github.com/bhim100/pharmacy_managament/blob/main/database/schema.sql"
click node_plsql "https://github.com/bhim100/pharmacy_managament/tree/main/plsql"
click node_dashboard_ui "https://github.com/bhim100/pharmacy_managament/blob/main/backend/templates/home.html"
click node_billing_ui "https://github.com/bhim100/pharmacy_managament/blob/main/backend/static/js/billing.js"
click node_inventory_ui "https://github.com/bhim100/pharmacy_managament/blob/main/backend/static/js/inventory.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_flask,node_dashboard_ui,node_billing_ui,node_inventory_ui toneBlue
class node_dashboard,node_medicine,node_inventory,node_billing,node_customers,node_suppliers,node_reports toneAmber
class node_settings,node_connection,node_oracle toneMint
class node_schema,node_plsql toneRose
class node_staff toneIndigo
```

## Components

### Web application

- [Flask routes](https://github.com/bhim100/pharmacy_managament/blob/main/backend/app.py): `backend/app.py`
- [Dashboard views](https://github.com/bhim100/pharmacy_managament/blob/main/backend/templates/home.html): `backend/templates/home.html`
- [Billing interface](https://github.com/bhim100/pharmacy_managament/blob/main/backend/static/js/billing.js): `backend/static/js/billing.js`
- [Inventory interface](https://github.com/bhim100/pharmacy_managament/blob/main/backend/static/js/inventory.js): `backend/static/js/inventory.js`

### Pharmacy workflows

- [Dashboard metrics](https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/dashboard_service.py): `backend/services/dashboard_service.py`
- [Medicine search](https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/medicine_service.py): `backend/services/medicine_service.py`
- [Inventory management](https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/inventory_service.py): `backend/services/inventory_service.py`
- [Billing checkout](https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/billing_service.py): `backend/services/billing_service.py`
- [Customer records](https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/customer_service.py): `backend/services/customer_service.py`
- [Supplier records](https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/supplier_service.py): `backend/services/supplier_service.py`
- [Reports and exports](https://github.com/bhim100/pharmacy_managament/blob/main/backend/services/report_service.py): `backend/services/report_service.py`

### Data access

- [Application settings](https://github.com/bhim100/pharmacy_managament/blob/main/backend/settings_store.py): `backend/settings_store.py`
- [Connection provider](https://github.com/bhim100/pharmacy_managament/blob/main/backend/db.py): `backend/db.py`
- **Oracle database**

### Oracle database features

- [Relational schema](https://github.com/bhim100/pharmacy_managament/blob/main/database/schema.sql): `database/schema.sql`
- [PL/SQL logic](https://github.com/bhim100/pharmacy_managament/tree/main/plsql): `plsql`

### Other components

- **Pharmacy staff**

## Connections

- Pharmacy staff → Flask routes: uses
- Flask routes → Dashboard metrics: requests metrics (evidence: `backend/app.py`)
- Flask routes → Medicine search: searches (evidence: `backend/app.py`)
- Flask routes → Inventory management: manages stock (evidence: `backend/app.py`)
- Flask routes → Billing checkout: submits checkout (evidence: `backend/app.py`)
- Flask routes → Customer records: manages customers (evidence: `backend/app.py`)
- Flask routes → Supplier records: manages suppliers (evidence: `backend/app.py`)
- Flask routes → Reports and exports: requests reports (evidence: `backend/app.py`)
- Flask routes → Application settings: updates settings (evidence: `backend/app.py`)
- Dashboard metrics → Connection provider: opens connection (evidence: `backend/services/dashboard_service.py`)
- Medicine search → Connection provider: opens connection (evidence: `backend/services/medicine_service.py`)
- Inventory management → Connection provider: opens connection (evidence: `backend/services/inventory_service.py`)
- Inventory management → Application settings: reads thresholds (evidence: `backend/services/inventory_service.py`)
- Billing checkout → Connection provider: opens connection (evidence: `backend/services/billing_service.py`)
- Customer records → Connection provider: opens connection (evidence: `backend/services/customer_service.py`)
- Supplier records → Connection provider: opens connection (evidence: `backend/services/supplier_service.py`)
- Reports and exports → Connection provider: opens connection (evidence: `backend/services/report_service.py`)
- Connection provider → Oracle database: connects (evidence: `backend/db.py`)
- Dashboard views → Flask routes: renders through
- Billing interface → Flask routes: submits checkout
- Inventory interface → Flask routes: uses routes
- Relational schema → Oracle database: defines tables
- PL/SQL logic → Oracle database: database routines
