# kubot77/temp architecture

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

- Interactive diagram: https://gitdiagram.com/kubot77/temp
- Repository: https://github.com/kubot77/temp

## Overview

1. This is a small Python application with a layered, MVC-like structure: an entrypoint, controller layer, domain abstractions, and concrete adapters for classification and database access.

2. `classifier_app/main.py` is the top-level runtime entrypoint. It likely wires the app together and dispatches into the controller layer rather than containing business logic itself.

3. The controller layer is split by responsibility:
   - `home_controllers.py` for general/application landing behavior,
   - `classifier_controllers.py` for classification-related actions,
   - `database_controllers.py` for data lookup or persistence-related actions.
   These controllers are the orchestration boundary between the outside world and the internal subsystems.

4. The classification subsystem lives under `classifier_app/classifiers/`. It has:
   - `base_classifier.py` as the abstraction/interface,
   - `linearSVC.py` as the concrete implementation,
   - `models/LinearSVC.joblib` as a serialized trained model artifact.
   This indicates inference is driven by a pre-trained scikit-learn-style LinearSVC model loaded from disk.

5. The data/storage subsystem lives under `classifier_app/databases/`. It has:
   - `base_db.py` as the storage abstraction,
   - `sqlite_db.py` as the concrete SQLite implementation,
   - `data/resources.db` as the local embedded database file.
   So the app uses a file-backed SQLite database rather than an external DB service.

6. The `classifier_app/domain/` package is the shared business-logic layer. It contains:
   - `base_query.py`,
   - `base_db_queries.py`,
   - `base_preprocessor.py`.
   These suggest the domain layer defines reusable query shapes and preprocessing logic that sits between controllers and the concrete classifier/database adapters.

7. The important architectural boundary is between abstractions and implementations:
   - domain/base classes define the contracts,
   - classifier and database modules implement those contracts,
   - controllers coordinate the use of those implementations.
   This keeps model inference and storage concerns separated from orchestration logic.

8. The main data flow is likely:
   user/action -> controller -> domain preprocessing/query logic -> classifier or SQLite adapter -> packaged model/database -> controller response.
   The two persistent artifacts are local and versioned with the repo: `LinearSVC.joblib` for inference and `resources.db` for data.

9. There are no obvious signs of external infrastructure, queues, or remote services. The architecture appears self-contained: local Python code, a serialized ML model, and a bundled SQLite database.

10. For an architecture diagram, the key components to show are:
   - entrypoint (`main.py`),
   - controller layer,
   - domain layer,
   - classifier subsystem with the joblib model,
   - SQLite database subsystem with the `.db` file.
   The main integration points are the controller-to-domain calls and the domain-to-adapter calls.

Main entry points: [`classifier_app/controllers/classifier_controllers.py`](https://github.com/kubot77/temp/blob/main/classifier_app/controllers/classifier_controllers.py) (Classify Ctrl), [`classifier_app/controllers/database_controllers.py`](https://github.com/kubot77/temp/blob/main/classifier_app/controllers/database_controllers.py) (DB Ctrl), [`classifier_app/main.py`](https://github.com/kubot77/temp/blob/main/classifier_app/main.py) (main.py), [`classifier_app/classifiers/linearSVC.py`](https://github.com/kubot77/temp/blob/main/classifier_app/classifiers/linearSVC.py) (LinearSVC)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_main(("main.py<br/>entrypoint<br/>[main.py]"))
end

subgraph group_controllers["Controllers"]
  node_home_ctrl["Home Ctrl<br/>controller"]
  node_class_ctrl["Classify Ctrl<br/>controller"]
  node_db_ctrl["DB Ctrl<br/>controller"]
end

subgraph group_domain["Domain"]
  node_base_query["Base Query<br/>domain contract<br/>[base_query.py]"]
  node_base_db_queries["DB Queries<br/>domain contract<br/>[base_db_queries.py]"]
  node_base_preproc["Preprocessor<br/>domain service"]
end

subgraph group_classification["Classifier"]
  node_base_classifier["Classifier API<br/>classifier contract<br/>[base_classifier.py]"]
  node_linear_svc["LinearSVC<br/>classifier impl<br/>[linearSVC.py]"]
  node_svc_model[("Model<br/>[LinearSVC.joblib]")]
end

subgraph group_storage["Database"]
  node_base_db["DB API<br/>storage contract<br/>[base_db.py]"]
  node_sqlite_db["SQLite DB<br/>storage impl<br/>[sqlite_db.py]"]
  node_resources_db[("Data DB<br/>database file<br/>[resources.db]")]
end

node_main -->|"dispatches"| node_home_ctrl
node_main -->|"dispatches"| node_class_ctrl
node_main -->|"dispatches"| node_db_ctrl
node_home_ctrl -->|"uses"| node_base_query
node_class_ctrl -->|"uses"| node_base_preproc
node_class_ctrl -->|"depends on"| node_base_classifier
node_class_ctrl -->|"invokes"| node_linear_svc
node_linear_svc -->|"loads"| node_svc_model
node_db_ctrl -->|"uses"| node_base_db_queries
node_db_ctrl -->|"depends on"| node_base_db
node_db_ctrl -->|"invokes"| node_sqlite_db
node_sqlite_db -->|"reads/writes"| node_resources_db
node_base_classifier -.->|"implemented by"| node_linear_svc
node_base_db -.->|"implemented by"| node_sqlite_db
node_base_query -.->|"supports"| node_base_db_queries

click node_main "https://github.com/kubot77/temp/blob/main/classifier_app/main.py"
click node_home_ctrl "https://github.com/kubot77/temp/blob/main/classifier_app/controllers/home_controllers.py"
click node_class_ctrl "https://github.com/kubot77/temp/blob/main/classifier_app/controllers/classifier_controllers.py"
click node_db_ctrl "https://github.com/kubot77/temp/blob/main/classifier_app/controllers/database_controllers.py"
click node_base_query "https://github.com/kubot77/temp/blob/main/classifier_app/domain/base_query.py"
click node_base_db_queries "https://github.com/kubot77/temp/blob/main/classifier_app/domain/base_db_queries.py"
click node_base_preproc "https://github.com/kubot77/temp/blob/main/classifier_app/domain/base_preprocessor.py"
click node_base_classifier "https://github.com/kubot77/temp/blob/main/classifier_app/classifiers/base_classifier.py"
click node_linear_svc "https://github.com/kubot77/temp/blob/main/classifier_app/classifiers/linearSVC.py"
click node_svc_model "https://github.com/kubot77/temp/blob/main/classifier_app/classifiers/models/LinearSVC.joblib"
click node_base_db "https://github.com/kubot77/temp/blob/main/classifier_app/databases/base_db.py"
click node_sqlite_db "https://github.com/kubot77/temp/blob/main/classifier_app/databases/sqlite_db.py"
click node_resources_db "https://github.com/kubot77/temp/blob/main/classifier_app/databases/data/resources.db"

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_main toneBlue
class node_home_ctrl,node_class_ctrl,node_db_ctrl toneAmber
class node_base_query,node_base_db_queries,node_base_preproc toneMint
class node_base_classifier,node_linear_svc,node_svc_model toneRose
class node_base_db,node_sqlite_db,node_resources_db toneIndigo
```

## Components

### Runtime

Application entrypoint and request orchestration

- [main.py](https://github.com/kubot77/temp/blob/main/classifier_app/main.py): entrypoint · Top-level runtime entrypoint that wires the application together · `classifier_app/main.py`

### Controllers

Orchestration layer split by concern

- [Home Ctrl](https://github.com/kubot77/temp/blob/main/classifier_app/controllers/home_controllers.py): controller · General application and landing behavior · `classifier_app/controllers/home_controllers.py`
- [Classify Ctrl](https://github.com/kubot77/temp/blob/main/classifier_app/controllers/classifier_controllers.py): controller · Classification-related orchestration · `classifier_app/controllers/classifier_controllers.py`
- [DB Ctrl](https://github.com/kubot77/temp/blob/main/classifier_app/controllers/database_controllers.py): controller · Data lookup and persistence orchestration · `classifier_app/controllers/database_controllers.py`

### Domain

Shared business contracts and preprocessing

- [Base Query](https://github.com/kubot77/temp/blob/main/classifier_app/domain/base_query.py): domain contract · Shared query shape used by controllers and adapters · `classifier_app/domain/base_query.py`
- [DB Queries](https://github.com/kubot77/temp/blob/main/classifier_app/domain/base_db_queries.py): domain contract · Database query abstractions and reusable query definitions · `classifier_app/domain/base_db_queries.py`
- [Preprocessor](https://github.com/kubot77/temp/blob/main/classifier_app/domain/base_preprocessor.py): domain service · Shared preprocessing logic before classification or lookup · `classifier_app/domain/base_preprocessor.py`

### Classifier

Inference abstraction, implementation, and packaged model

- [Classifier API](https://github.com/kubot77/temp/blob/main/classifier_app/classifiers/base_classifier.py): classifier contract · Interface for classifier implementations · `classifier_app/classifiers/base_classifier.py`
- [LinearSVC](https://github.com/kubot77/temp/blob/main/classifier_app/classifiers/linearSVC.py): classifier impl · Concrete classifier implementation backed by a trained model · `classifier_app/classifiers/linearSVC.py`
- [Model](https://github.com/kubot77/temp/blob/main/classifier_app/classifiers/models/LinearSVC.joblib): serialized model · Packaged trained LinearSVC artifact loaded at runtime · `classifier_app/classifiers/models/LinearSVC.joblib`

### Database

Storage abstraction, implementation, and bundled database

- [DB API](https://github.com/kubot77/temp/blob/main/classifier_app/databases/base_db.py): storage contract · Interface for database implementations · `classifier_app/databases/base_db.py`
- [SQLite DB](https://github.com/kubot77/temp/blob/main/classifier_app/databases/sqlite_db.py): storage impl · Concrete file-backed SQLite adapter · `classifier_app/databases/sqlite_db.py`
- [Data DB](https://github.com/kubot77/temp/blob/main/classifier_app/databases/data/resources.db): database file · Bundled SQLite database file · `classifier_app/databases/data/resources.db`

## Connections

- main.py → Home Ctrl: dispatches · Entrypoint hands execution to controllers
- main.py → Classify Ctrl: dispatches · Entrypoint routes classification flows
- main.py → DB Ctrl: dispatches · Entrypoint routes database-related flows
- Home Ctrl → Base Query: uses · Controller builds or consumes shared query shapes
- Classify Ctrl → Preprocessor: uses · Classification flow relies on preprocessing
- Classify Ctrl → Classifier API: depends on · Controller targets the classifier abstraction
- Classify Ctrl → LinearSVC: invokes · Concrete classifier implementation performs inference
- LinearSVC → Model: loads · Model implementation loads the packaged artifact
- DB Ctrl → DB Queries: uses · Database controller works through query abstractions
- DB Ctrl → DB API: depends on · Controller targets the storage abstraction
- DB Ctrl → SQLite DB: invokes · Concrete storage adapter handles SQLite operations
- SQLite DB → Data DB: reads/writes · SQLite adapter operates on the bundled database file
- Classifier API → LinearSVC: implemented by · Concrete classifier fulfills the classifier contract
- DB API → SQLite DB: implemented by · SQLite adapter fulfills the storage contract
- Base Query → DB Queries: supports · Query primitives underpin database query definitions
