# chaithz/petvetpro architecture

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

- Interactive diagram: https://gitdiagram.com/chaithz/petvetpro
- Repository: https://github.com/chaithz/petvetpro

## Overview

PetVetPro is a Flask pet-health website. Its main user workflow submits pet health details, trains and runs a health predictor, stores the prediction in the session, and displays results with reviews. The app also provides account registration and login, review management, and informational pages. The README provides no architecture details; links below are based on the sampled source, with unsampled template and database internals represented only where their use is explicit.

Main entry points: [`website/views.py`](https://github.com/chaithz/petvetpro/blob/main/website/views.py) (Page routes), [`website/auth.py`](https://github.com/chaithz/petvetpro/blob/main/website/auth.py) (Authentication routes), [`website/__init__.py`](https://github.com/chaithz/petvetpro/blob/main/website/__init__.py) (Flask app setup), [`petml.py`](https://github.com/chaithz/petvetpro/blob/main/petml.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_launcher["App launcher<br/>[main.py]"]
  node_factory["Flask app setup<br/>[__init__.py]"]
  node_routes["Page routes<br/>[views.py]"]
end

subgraph group_health["Health prediction"]
  node_petdata["Animal dataset<br/>[datasetanimals.csv]"]
  node_csv["Dataset loading<br/>[petml.py]"]
  node_prep["Feature preparation<br/>[petml.py]"]
  node_training["Model training<br/>[petml.py]"]
  node_prediction["Health prediction<br/>[petml.py]"]
end

subgraph group_accounts["Accounts and reviews"]
  node_auth["Authentication routes<br/>[auth.py]"]
  node_models["User and review models<br/>[model.py]"]
  node_database[("SQL database")]
  node_review_ui["Review controls<br/>[index.js]"]
end

subgraph group_content["Site content"]
  node_templates["Page templates"]
  node_informational["Informational pages<br/>[views.py]"]
end

node_user(("Website user"))

node_user -.->|"opens site"| node_launcher
node_launcher -->|"creates app"| node_factory
node_factory -->|"registers routes"| node_routes
node_factory -->|"registers routes"| node_auth
node_user -.->|"submits health details"| node_routes
node_routes -->|"loads dataset"| node_csv
node_csv -->|"reads"| node_petdata
node_routes -->|"trains model"| node_training
node_training -->|"uses features"| node_prep
node_routes -->|"requests prediction"| node_prediction
node_prediction -->|"trains model"| node_training
node_routes -->|"renders pages"| node_templates
node_routes -->|"queries reviews"| node_models
node_routes -->|"saves reviews"| node_database
node_auth -->|"queries users"| node_models
node_auth -->|"persists users"| node_database
node_models -->|"maps records"| node_database
node_review_ui -->|"posts deletion"| node_routes
node_routes -->|"serves pages"| node_informational
node_informational -->|"renders pages"| node_templates
node_user -.->|"registers or logs in"| node_auth

click node_launcher "https://github.com/chaithz/petvetpro/blob/main/main.py"
click node_factory "https://github.com/chaithz/petvetpro/blob/main/website/__init__.py"
click node_routes "https://github.com/chaithz/petvetpro/blob/main/website/views.py"
click node_petdata "https://github.com/chaithz/petvetpro/blob/main/datasetanimals.csv"
click node_csv "https://github.com/chaithz/petvetpro/blob/main/petml.py"
click node_prep "https://github.com/chaithz/petvetpro/blob/main/petml.py"
click node_training "https://github.com/chaithz/petvetpro/blob/main/petml.py"
click node_prediction "https://github.com/chaithz/petvetpro/blob/main/petml.py"
click node_auth "https://github.com/chaithz/petvetpro/blob/main/website/auth.py"
click node_models "https://github.com/chaithz/petvetpro/blob/main/website/model.py"
click node_review_ui "https://github.com/chaithz/petvetpro/blob/main/website/static/js/index.js"
click node_templates "https://github.com/chaithz/petvetpro/tree/main/website/templates"
click node_informational "https://github.com/chaithz/petvetpro/blob/main/website/views.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_launcher,node_factory,node_routes,node_user toneBlue
class node_petdata,node_csv,node_prep,node_training,node_prediction toneAmber
class node_auth,node_models,node_database,node_review_ui toneMint
class node_templates,node_informational toneRose
```

## Components

### Web application

- [App launcher](https://github.com/chaithz/petvetpro/blob/main/main.py): `main.py`
- [Flask app setup](https://github.com/chaithz/petvetpro/blob/main/website/__init__.py): `website/__init__.py`
- [Page routes](https://github.com/chaithz/petvetpro/blob/main/website/views.py): `website/views.py`

### Health prediction

- [Animal dataset](https://github.com/chaithz/petvetpro/blob/main/datasetanimals.csv): `datasetanimals.csv`
- [Dataset loading](https://github.com/chaithz/petvetpro/blob/main/petml.py): `petml.py`
- [Feature preparation](https://github.com/chaithz/petvetpro/blob/main/petml.py): `petml.py`
- [Model training](https://github.com/chaithz/petvetpro/blob/main/petml.py): `petml.py`
- [Health prediction](https://github.com/chaithz/petvetpro/blob/main/petml.py): `petml.py`

### Accounts and reviews

- [Authentication routes](https://github.com/chaithz/petvetpro/blob/main/website/auth.py): `website/auth.py`
- [User and review models](https://github.com/chaithz/petvetpro/blob/main/website/model.py): `website/model.py`
- **SQL database**
- [Review controls](https://github.com/chaithz/petvetpro/blob/main/website/static/js/index.js): `website/static/js/index.js`

### Site content

- [Page templates](https://github.com/chaithz/petvetpro/tree/main/website/templates): `website/templates`
- [Informational pages](https://github.com/chaithz/petvetpro/blob/main/website/views.py): `website/views.py`

### Other components

- **Website user**

## Connections

- Website user → App launcher: opens site
- App launcher → Flask app setup: creates app (evidence: `main.py`)
- Flask app setup → Page routes: registers routes (evidence: `website/__init__.py`)
- Flask app setup → Authentication routes: registers routes (evidence: `website/__init__.py`)
- Website user → Page routes: submits health details
- Page routes → Dataset loading: loads dataset (evidence: `website/views.py`)
- Dataset loading → Animal dataset: reads (evidence: `petml.py`)
- Page routes → Model training: trains model (evidence: `website/views.py`)
- Model training → Feature preparation: uses features (evidence: `petml.py`)
- Page routes → Health prediction: requests prediction (evidence: `website/views.py`)
- Health prediction → Model training: trains model (evidence: `petml.py`)
- Page routes → Page templates: renders pages (evidence: `website/views.py`)
- Page routes → User and review models: queries reviews (evidence: `website/views.py`)
- Page routes → SQL database: saves reviews (evidence: `website/views.py`)
- Authentication routes → User and review models: queries users (evidence: `website/auth.py`)
- Authentication routes → SQL database: persists users (evidence: `website/auth.py`)
- User and review models → SQL database: maps records (evidence: `website/model.py`)
- Review controls → Page routes: posts deletion (evidence: `website/static/js/index.js`)
- Page routes → Informational pages: serves pages (evidence: `website/views.py`)
- Informational pages → Page templates: renders pages (evidence: `website/views.py`)
- Website user → Authentication routes: registers or logs in
