# bogdanmaslyuk/pharmdesk architecture

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

- Interactive diagram: https://gitdiagram.com/bogdanmaslyuk/pharmdesk
- Repository: https://github.com/bogdanmaslyuk/pharmdesk

## Overview

PharmDesk is a local pharmacy-inventory web app: a pharmacist searches drawers and products, reviews inventory records, and manages stock through the browser. Separate workflows support CSV/XLSX import, manual photo-based verification, and a human-entered drug-registry catalog with explicit product links. The README also describes catalog-quality checks and conservative typo-tolerant search; it explicitly disclaims automated interaction checking. Some route wiring and subsystem calls are not visible in the excerpts, so those links are marked unverified rather than asserted.

Main entry points: [`app/main.py`](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/main.py) (Web application), [`app/batch.py`](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/batch.py) (File import), [`app/review.py`](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/review.py) (Photo review), [`app/search.py`](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/search.py) (Inventory search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflows"]
  node_web_app["Web application<br/>[main.py]"]
  node_inventory_views["Drawer and medicine views<br/>[main.py]"]
  node_search["Inventory search<br/>[search.py]"]
end

subgraph group_inventory["Inventory operations"]
  node_inventory_management["Stock management<br/>[manage.py]"]
  node_file_import["File import<br/>[batch.py]"]
  node_row_import["Row import<br/>[importer.py]"]
  node_inventory_replace["Inventory replacement"]
end

subgraph group_verification["Review and quality"]
  node_review_workflow["Photo review<br/>[review.py]"]
  node_review_import["Review import<br/>[review_import.py]"]
  node_review_progress["Review progress<br/>[review_progress.py]"]
  node_catalog_quality["Catalog checks<br/>[catalog_quality.py]"]
  node_quality_routes["Quality report<br/>[quality.py]"]
end

subgraph group_reference["Drug reference"]
  node_registry_catalog["Registry catalog<br/>[catalog.py]"]
  node_catalog_sources["Source validation<br/>[catalog_sources.py]"]
  node_identity["Substance identity<br/>[identity.py]"]
end

subgraph group_storage["Persistence"]
  node_database["Database access<br/>[database.py]"]
  node_domain_models["Domain records<br/>[models.py]"]
end

node_pharmacist(("Pharmacist"))

node_pharmacist -->|"uses locally"| node_web_app
node_web_app -->|"searches via"| node_search
node_web_app -->|"serves views"| node_inventory_views
node_web_app -.->|"routes to"| node_inventory_management
node_web_app -.->|"routes to"| node_file_import
node_web_app -.->|"routes to"| node_review_workflow
node_web_app -.->|"routes to"| node_registry_catalog
node_web_app -.->|"routes to"| node_quality_routes
node_file_import -.->|"delegates to"| node_row_import
node_review_workflow -.->|"uses import"| node_review_import
node_catalog_sources -->|"normalizes with"| node_search
node_database -->|"loads models"| node_domain_models

click node_web_app "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/main.py"
click node_inventory_views "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/main.py"
click node_search "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/search.py"
click node_inventory_management "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/manage.py"
click node_file_import "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/batch.py"
click node_row_import "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/importer.py"
click node_inventory_replace "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/replace_inventory.py"
click node_review_workflow "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/review.py"
click node_review_import "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/review_import.py"
click node_review_progress "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/review_progress.py"
click node_catalog_quality "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/catalog_quality.py"
click node_quality_routes "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/quality.py"
click node_registry_catalog "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/catalog.py"
click node_catalog_sources "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/catalog_sources.py"
click node_identity "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/identity.py"
click node_database "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/database.py"
click node_domain_models "https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/models.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_web_app,node_inventory_views,node_search toneBlue
class node_inventory_management,node_file_import,node_row_import,node_inventory_replace toneAmber
class node_review_workflow,node_review_import,node_review_progress,node_catalog_quality,node_quality_routes toneMint
class node_registry_catalog,node_catalog_sources,node_identity toneRose
class node_database,node_domain_models,node_pharmacist toneIndigo
```

## Components

### Web workflows

- [Web application](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/main.py): `app/main.py`
- [Drawer and medicine views](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/main.py): `app/main.py`
- [Inventory search](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/search.py): `app/search.py`

### Inventory operations

- [Stock management](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/manage.py): `app/manage.py`
- [File import](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/batch.py): `app/batch.py`
- [Row import](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/importer.py): `app/importer.py`
- [Inventory replacement](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/replace_inventory.py): `app/replace_inventory.py`

### Review and quality

- [Photo review](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/review.py): `app/review.py`
- [Review import](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/review_import.py): `app/review_import.py`
- [Review progress](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/review_progress.py): `app/review_progress.py`
- [Catalog checks](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/catalog_quality.py): `app/catalog_quality.py`
- [Quality report](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/quality.py): `app/quality.py`

### Drug reference

- [Registry catalog](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/catalog.py): `app/catalog.py`
- [Source validation](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/catalog_sources.py): `app/catalog_sources.py`
- [Substance identity](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/identity.py): `app/identity.py`

### Persistence

- [Database access](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/database.py): `app/database.py`
- [Domain records](https://github.com/bogdanmaslyuk/pharmdesk/blob/main/app/models.py): `app/models.py`

### Other components

- **Pharmacist**

## Connections

- Pharmacist → Web application: uses locally (evidence: `README.md`)
- Web application → Inventory search: searches via (evidence: `app/main.py`)
- Web application → Drawer and medicine views: serves views (evidence: `app/main.py`)
- Web application → Stock management: routes to (evidence: `app/main.py`)
- Web application → File import: routes to
- Web application → Photo review: routes to (evidence: `app/main.py`)
- Web application → Registry catalog: routes to (evidence: `app/main.py`)
- Web application → Quality report: routes to (evidence: `app/main.py`)
- File import → Row import: delegates to (evidence: `app/batch.py`)
- Photo review → Review import: uses import (evidence: `app/review.py`)
- Source validation → Inventory search: normalizes with (evidence: `app/catalog_sources.py`)
- Database access → Domain records: loads models (evidence: `app/database.py`)
