# cjdearaujo/kharviml architecture

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

- Interactive diagram: https://gitdiagram.com/cjdearaujo/kharviml
- Repository: https://github.com/cjdearaujo/kharviml

## Overview

KharviML is a fish price and catch-volume prediction product for Turkish coastal fisheries. Users submit fish, area, time, and environmental measurements in the frontend; the API shapes them into model features and returns price or catch predictions for display. The repository also includes raw-data preprocessing and drift-reporting capabilities. Training and orchestration are documented by the presence of DVC configuration and stored MLflow artifacts, but their implementation sources were not provided, so those flows are not detailed here.

Main entry points: [`src/api/main.py`](https://github.com/cjdearaujo/kharviml/blob/main/src/api/main.py) (Prediction API), [`mlartifacts`](https://github.com/cjdearaujo/kharviml/tree/main/mlartifacts) (Stored models), [`frontend/app.js`](https://github.com/cjdearaujo/kharviml/blob/main/frontend/app.js) (Prediction form), [`src/data/preprocess.py`](https://github.com/cjdearaujo/kharviml/blob/main/src/data/preprocess.py) (Data preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_user["Prediction experience"]
  node_prediction_ui["Prediction form<br/>[app.js]"]
end

subgraph group_serving["Prediction serving"]
  node_prediction_api["Prediction API<br/>[main.py]"]
  node_feature_builder["Feature builder<br/>[main.py]"]
  node_price_model["Price model<br/>[main.py]"]
  node_catch_model["Catch model<br/>[main.py]"]
  node_model_artifacts["Stored models"]
end

subgraph group_data["Data preparation"]
  node_raw_fish_data["Raw fish data"]
  node_preprocessing["Data preprocessing<br/>[preprocess.py]"]
  node_processed_data["Processed dataset"]
end

subgraph group_observability["Model monitoring"]
  node_drift_report["Drift reporting<br/>[drift_report.py]"]
  node_drift_reports["Drift reports"]
end

node_fisheries_user(("Prediction user"))

node_fisheries_user -->|"enters inputs"| node_prediction_ui
node_prediction_ui -->|"requests predictions"| node_prediction_api
node_prediction_api -->|"builds features"| node_feature_builder
node_prediction_api -->|"predicts price"| node_price_model
node_prediction_api -->|"predicts catch"| node_catch_model
node_model_artifacts -.->|"loads price model"| node_price_model
node_model_artifacts -.->|"loads catch model"| node_catch_model
node_raw_fish_data -.->|"reads data"| node_preprocessing
node_preprocessing -->|"writes dataset"| node_processed_data
node_processed_data -->|"reads dataset"| node_drift_report
node_drift_report -->|"saves reports"| node_drift_reports

click node_prediction_ui "https://github.com/cjdearaujo/kharviml/blob/main/frontend/app.js"
click node_prediction_api "https://github.com/cjdearaujo/kharviml/blob/main/src/api/main.py"
click node_feature_builder "https://github.com/cjdearaujo/kharviml/blob/main/src/api/main.py"
click node_price_model "https://github.com/cjdearaujo/kharviml/blob/main/src/api/main.py"
click node_catch_model "https://github.com/cjdearaujo/kharviml/blob/main/src/api/main.py"
click node_model_artifacts "https://github.com/cjdearaujo/kharviml/tree/main/mlartifacts"
click node_raw_fish_data "https://github.com/cjdearaujo/kharviml/blob/main/data/raw/fish_catch_data_turkey.csv"
click node_preprocessing "https://github.com/cjdearaujo/kharviml/blob/main/src/data/preprocess.py"
click node_drift_report "https://github.com/cjdearaujo/kharviml/blob/main/monitoring/drift_report.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_prediction_ui,node_fisheries_user toneBlue
class node_prediction_api,node_feature_builder,node_price_model,node_catch_model,node_model_artifacts toneAmber
class node_raw_fish_data,node_preprocessing,node_processed_data toneMint
class node_drift_report,node_drift_reports toneRose
```

## Components

### Prediction experience

- [Prediction form](https://github.com/cjdearaujo/kharviml/blob/main/frontend/app.js): `frontend/app.js`

### Prediction serving

- [Prediction API](https://github.com/cjdearaujo/kharviml/blob/main/src/api/main.py): `src/api/main.py`
- [Feature builder](https://github.com/cjdearaujo/kharviml/blob/main/src/api/main.py): `src/api/main.py`
- [Price model](https://github.com/cjdearaujo/kharviml/blob/main/src/api/main.py): `src/api/main.py`
- [Catch model](https://github.com/cjdearaujo/kharviml/blob/main/src/api/main.py): `src/api/main.py`
- [Stored models](https://github.com/cjdearaujo/kharviml/tree/main/mlartifacts): `mlartifacts`

### Data preparation

- [Raw fish data](https://github.com/cjdearaujo/kharviml/blob/main/data/raw/fish_catch_data_turkey.csv): `data/raw/fish_catch_data_turkey.csv`
- [Data preprocessing](https://github.com/cjdearaujo/kharviml/blob/main/src/data/preprocess.py): `src/data/preprocess.py`
- **Processed dataset**

### Model monitoring

- [Drift reporting](https://github.com/cjdearaujo/kharviml/blob/main/monitoring/drift_report.py): `monitoring/drift_report.py`
- **Drift reports**

### Other components

- **Prediction user**

## Connections

- Prediction user → Prediction form: enters inputs (evidence: `frontend/app.js`)
- Prediction form → Prediction API: requests predictions (evidence: `frontend/app.js`)
- Prediction API → Feature builder: builds features (evidence: `src/api/main.py`)
- Prediction API → Price model: predicts price (evidence: `src/api/main.py`)
- Prediction API → Catch model: predicts catch (evidence: `src/api/main.py`)
- Stored models → Price model: loads price model
- Stored models → Catch model: loads catch model
- Raw fish data → Data preprocessing: reads data
- Data preprocessing → Processed dataset: writes dataset (evidence: `src/data/preprocess.py`)
- Processed dataset → Drift reporting: reads dataset (evidence: `monitoring/drift_report.py`)
- Drift reporting → Drift reports: saves reports (evidence: `monitoring/drift_report.py`)
