# sylphyyyy/final architecture

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

- Interactive diagram: https://gitdiagram.com/sylphyyyy/final
- Repository: https://github.com/sylphyyyy/final

## Overview

This Flask procurement and inventory application supports user access, procurement tracking, stock management, bid-document scanning, and live PhilGEPS notice search. The main workflow is a user uploading a bid document, the scan route invoking OCR extraction, and procurement data being managed through the inventory routes; the excerpts show the upload and extraction steps, but do not establish the complete handoff into inventory. The app factory registers route modules and initializes persistence. Settings, account recovery, and live notice search are distinct capabilities. Some route behavior is only partially excerpted, so uncertain links are omitted.

Main entry points: [`app/__init__.py`](https://github.com/sylphyyyy/final/blob/main/app/__init__.py) (App factory), [`app/models.py`](https://github.com/sylphyyyy/final/blob/main/app/models.py) (Domain models), [`app/routes/auth.py`](https://github.com/sylphyyyy/final/blob/main/app/routes/auth.py) (Authentication), [`api/index.py`](https://github.com/sylphyyyy/final/blob/main/api/index.py) (Flask entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Web runtime"]
  node_entry["Flask entry<br/>[index.py]"]
  node_factory["App factory<br/>[__init__.py]"]
  node_config["App configuration<br/>[config.py]"]
  node_database[("Application database")]
  node_models["Domain models<br/>[models.py]"]
end

subgraph group_procurement["Procurement workflow"]
  node_bid_upload["Bid document upload<br/>[bid_upload.py]"]
  node_ocr["Bid OCR extraction<br/>[ocr_parser.py]"]
  node_bid_routes["Bid listing<br/>[bid_routes.py]"]
  node_philgeps["Notice search<br/>[philgeps.py]"]
end

subgraph group_inventory["Inventory management"]
  node_inventory_overview["Inventory overview<br/>[inventory.py]"]
  node_stock_ops["Stock operations<br/>[inventory.py]"]
  node_procurement_detail["Procurement detail<br/>[inventory.py]"]
end

subgraph group_accounts["Accounts and settings"]
  node_auth["Authentication<br/>[auth.py]"]
  node_settings["User settings<br/>[settings.py]"]
end

subgraph group_integrations["External integrations"]
  node_gemini{{"Gemini API"}}
  node_smtp{{"SMTP mail server"}}
  node_philgeps_service{{"PhilGEPS notices"}}
end

node_user(("User"))

node_user -->|"makes requests"| node_entry
node_entry -->|"creates app"| node_factory
node_factory -->|"loads settings"| node_config
node_factory -->|"initializes"| node_database
node_factory -->|"initializes tables"| node_models
node_factory -->|"registers routes"| node_auth
node_factory -->|"registers routes"| node_settings
node_factory -->|"registers routes"| node_philgeps
node_factory -->|"registers routes"| node_inventory_overview
node_factory -->|"registers routes"| node_bid_upload
node_bid_upload -->|"parses document"| node_ocr
node_ocr -->|"requests extraction"| node_gemini
node_bid_routes -->|"queries procurements"| node_models
node_inventory_overview -->|"queries inventory"| node_models
node_stock_ops -->|"updates stock"| node_models
node_procurement_detail -->|"loads procurement"| node_models
node_auth -->|"checks users"| node_models
node_auth -->|"sends reset mail"| node_smtp
node_settings -->|"updates user data"| node_models
node_philgeps -->|"searches notices"| node_philgeps_service

click node_entry "https://github.com/sylphyyyy/final/blob/main/api/index.py"
click node_factory "https://github.com/sylphyyyy/final/blob/main/app/__init__.py"
click node_config "https://github.com/sylphyyyy/final/blob/main/config.py"
click node_models "https://github.com/sylphyyyy/final/blob/main/app/models.py"
click node_bid_upload "https://github.com/sylphyyyy/final/blob/main/app/routes/bid_upload.py"
click node_ocr "https://github.com/sylphyyyy/final/blob/main/app/utils/ocr_parser.py"
click node_bid_routes "https://github.com/sylphyyyy/final/blob/main/app/routes/bid_routes.py"
click node_inventory_overview "https://github.com/sylphyyyy/final/blob/main/app/routes/inventory.py"
click node_stock_ops "https://github.com/sylphyyyy/final/blob/main/app/routes/inventory.py"
click node_procurement_detail "https://github.com/sylphyyyy/final/blob/main/app/routes/inventory.py"
click node_philgeps "https://github.com/sylphyyyy/final/blob/main/app/routes/philgeps.py"
click node_auth "https://github.com/sylphyyyy/final/blob/main/app/routes/auth.py"
click node_settings "https://github.com/sylphyyyy/final/blob/main/app/routes/settings.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_entry,node_factory,node_config,node_database,node_models,node_user toneBlue
class node_bid_upload,node_ocr,node_bid_routes,node_philgeps toneAmber
class node_inventory_overview,node_stock_ops,node_procurement_detail toneMint
class node_auth,node_settings toneRose
class node_gemini,node_smtp,node_philgeps_service toneIndigo
```

## Components

### Web runtime

- [Flask entry](https://github.com/sylphyyyy/final/blob/main/api/index.py): `api/index.py`
- [App factory](https://github.com/sylphyyyy/final/blob/main/app/__init__.py): `app/__init__.py`
- [App configuration](https://github.com/sylphyyyy/final/blob/main/config.py): `config.py`
- **Application database**
- [Domain models](https://github.com/sylphyyyy/final/blob/main/app/models.py): `app/models.py`

### Procurement workflow

- [Bid document upload](https://github.com/sylphyyyy/final/blob/main/app/routes/bid_upload.py): `app/routes/bid_upload.py`
- [Bid OCR extraction](https://github.com/sylphyyyy/final/blob/main/app/utils/ocr_parser.py): `app/utils/ocr_parser.py`
- [Bid listing](https://github.com/sylphyyyy/final/blob/main/app/routes/bid_routes.py): `app/routes/bid_routes.py`
- [Notice search](https://github.com/sylphyyyy/final/blob/main/app/routes/philgeps.py): `app/routes/philgeps.py`

### Inventory management

- [Inventory overview](https://github.com/sylphyyyy/final/blob/main/app/routes/inventory.py): `app/routes/inventory.py`
- [Stock operations](https://github.com/sylphyyyy/final/blob/main/app/routes/inventory.py): `app/routes/inventory.py`
- [Procurement detail](https://github.com/sylphyyyy/final/blob/main/app/routes/inventory.py): `app/routes/inventory.py`

### Accounts and settings

- [Authentication](https://github.com/sylphyyyy/final/blob/main/app/routes/auth.py): `app/routes/auth.py`
- [User settings](https://github.com/sylphyyyy/final/blob/main/app/routes/settings.py): `app/routes/settings.py`

### External integrations

- **Gemini API**
- **SMTP mail server**
- **PhilGEPS notices**

### Other components

- **User**

## Connections

- User → Flask entry: makes requests (evidence: `api/index.py`)
- Flask entry → App factory: creates app (evidence: `api/index.py`)
- App factory → App configuration: loads settings (evidence: `app/__init__.py`)
- App factory → Application database: initializes (evidence: `app/__init__.py`)
- App factory → Domain models: initializes tables (evidence: `app/__init__.py`)
- App factory → Authentication: registers routes (evidence: `app/__init__.py`)
- App factory → User settings: registers routes (evidence: `app/__init__.py`)
- App factory → Notice search: registers routes (evidence: `app/__init__.py`)
- App factory → Inventory overview: registers routes (evidence: `app/__init__.py`)
- App factory → Bid document upload: registers routes (evidence: `app/__init__.py`)
- Bid document upload → Bid OCR extraction: parses document (evidence: `app/routes/bid_upload.py`)
- Bid OCR extraction → Gemini API: requests extraction (evidence: `app/utils/ocr_parser.py`)
- Bid listing → Domain models: queries procurements (evidence: `app/routes/bid_routes.py`)
- Inventory overview → Domain models: queries inventory (evidence: `app/routes/inventory.py`)
- Stock operations → Domain models: updates stock (evidence: `app/routes/inventory.py`)
- Procurement detail → Domain models: loads procurement (evidence: `app/routes/inventory.py`)
- Authentication → Domain models: checks users (evidence: `app/routes/auth.py`)
- Authentication → SMTP mail server: sends reset mail (evidence: `app/routes/auth.py`)
- User settings → Domain models: updates user data (evidence: `app/routes/settings.py`)
- Notice search → PhilGEPS notices: searches notices (evidence: `app/routes/philgeps.py`)
