# joyfoxed/ghcontrol architecture

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

- Interactive diagram: https://gitdiagram.com/joyfoxed/ghcontrol
- Repository: https://github.com/joyfoxed/ghcontrol

## Overview

GHControl is a Django laboratory inventory and chemical-safety application. Its main workflow is staff or student requests routed to inventory views, where access rules govern reagent lookup and stock operations; the application tracks quantities and movement history while applying chemical compatibility and expiry information. The README also documents barcode search, GHS/FISPQ access, dashboards, and printable audit reports. Those capabilities are represented at the documented module level; the sampled source does not include the implementation of the inventory views or models.

Main entry points: [`estoque/views.py`](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/views.py) (Inventory views), [`estoque/models.py`](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/models.py) (GHS and FISPQ), [`estoque/urls.py`](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/urls.py) (App routes), [`estoque/forms.py`](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/forms.py) (Inventory forms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and access"]
  node_urls["App routes<br/>[urls.py]"]
  node_views["Inventory views<br/>[views.py]"]
  node_forms["Inventory forms<br/>[forms.py]"]
  node_permissions["Role permissions<br/>[permissions.py]"]
end

subgraph group_inventory["Inventory operations"]
  node_dashboard["Dashboard and expiry alerts<br/>[views.py]"]
  node_search["Barcode and reagent search<br/>[views.py]"]
  node_stock["Stock and unit conversion<br/>[models.py]"]
end

subgraph group_safety["Chemical safety"]
  node_compat["Storage compatibility<br/>[models.py]"]
  node_ghs["GHS and FISPQ<br/>[models.py]"]
end

subgraph group_records["Inventory records"]
  node_reports["Reports and audit<br/>[views.py]"]
  node_history["Movement history<br/>[models.py]"]
  node_db[("PostgreSQL / Neon")]
end

node_staff(("Technician / admin"))
node_student(("Student / reader"))
node_fispq(("FISPQ source"))

node_staff -->|"requests stock actions"| node_urls
node_student -->|"requests read-only access"| node_urls
node_urls -->|"routes requests"| node_views
node_views -->|"checks access"| node_permissions
node_views -->|"validates input"| node_forms
node_views -->|"renders dashboard"| node_dashboard
node_views -->|"handles lookup"| node_search
node_views -->|"reads and changes stock"| node_stock
node_views -->|"checks placement"| node_compat
node_views -->|"provides hazard details"| node_ghs
node_views -->|"generates reports"| node_reports
node_views -->|"records movements"| node_history
node_stock -->|"reads and writes"| node_db
node_compat -->|"reads classifications"| node_db
node_ghs -->|"reads hazard data"| node_db
node_history -->|"stores audit entries"| node_db
node_reports -->|"presents printable report"| node_staff
node_ghs -.->|"links to source sheet"| node_fispq

click node_urls "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/urls.py"
click node_views "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/views.py"
click node_forms "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/forms.py"
click node_permissions "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/permissions.py"
click node_dashboard "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/views.py"
click node_search "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/views.py"
click node_stock "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/models.py"
click node_compat "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/models.py"
click node_ghs "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/models.py"
click node_reports "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/views.py"
click node_history "https://github.com/joyfoxed/ghcontrol/blob/main/estoque/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_urls,node_views,node_forms,node_permissions toneBlue
class node_dashboard,node_search,node_stock toneAmber
class node_compat,node_ghs toneMint
class node_reports,node_history,node_db toneRose
class node_staff,node_student,node_fispq toneIndigo
```

## Components

### Web and access

- [App routes](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/urls.py): `estoque/urls.py`
- [Inventory views](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/views.py): `estoque/views.py`
- [Inventory forms](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/forms.py): `estoque/forms.py`
- [Role permissions](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/permissions.py): `estoque/permissions.py`

### Inventory operations

- [Dashboard and expiry alerts](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/views.py): `estoque/views.py`
- [Barcode and reagent search](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/views.py): `estoque/views.py`
- [Stock and unit conversion](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/models.py): `estoque/models.py`

### Chemical safety

- [Storage compatibility](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/models.py): `estoque/models.py`
- [GHS and FISPQ](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/models.py): `estoque/models.py`

### Inventory records

- [Reports and audit](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/views.py): `estoque/views.py`
- [Movement history](https://github.com/joyfoxed/ghcontrol/blob/main/estoque/models.py): `estoque/models.py`
- **PostgreSQL / Neon**

### Other components

- **Technician / admin**
- **Student / reader**
- **FISPQ source**

## Connections

- Technician / admin → App routes: requests stock actions
- Student / reader → App routes: requests read-only access
- App routes → Inventory views: routes requests
- Inventory views → Role permissions: checks access
- Inventory views → Inventory forms: validates input
- Inventory views → Dashboard and expiry alerts: renders dashboard
- Inventory views → Barcode and reagent search: handles lookup
- Inventory views → Stock and unit conversion: reads and changes stock
- Inventory views → Storage compatibility: checks placement
- Inventory views → GHS and FISPQ: provides hazard details
- Inventory views → Reports and audit: generates reports
- Inventory views → Movement history: records movements
- Stock and unit conversion → PostgreSQL / Neon: reads and writes
- Storage compatibility → PostgreSQL / Neon: reads classifications
- GHS and FISPQ → PostgreSQL / Neon: reads hazard data
- Movement history → PostgreSQL / Neon: stores audit entries
- Reports and audit → Technician / admin: presents printable report
- GHS and FISPQ → FISPQ source: links to source sheet
