# nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot architecture

> Architecture diagram of the GitHub repository nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot
- Repository: https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot

## Overview

This is a Streamlit app for estimating used-phone prices from product, listing, and seller details. The documented workflow runs those inputs through preprocessing and several prediction models, combines their estimates, then shows a suggested price range and model-specific results. The README also describes regional, seller, and timing factors, plus model-performance information. The implementation is concentrated in app.py; the README documents the prediction stages, but the supplied excerpts do not show their full call structure.

Main entry points: [`app.py`](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py) (Input Preparation), [`models/preprocessor.pkl`](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/preprocessor.pkl) (Feature Preprocessor), [`models/webapp_config.json`](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/webapp_config.json) (Model Config), [`models/best_lgbm_optuna.pkl`](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/best_lgbm_optuna.pkl) (LightGBM Estimate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["User Inputs"]
  node_phone["Phone Details<br/>[app.py]"]
  node_listing["Listing Details<br/>[app.py]"]
  node_seller["Seller Details<br/>[app.py]"]
end

subgraph group_prediction["Price Prediction"]
  node_prepare["Input Preparation<br/>[app.py]"]
  node_preprocessor["Feature Preprocessor<br/>[preprocessor.pkl]"]
  node_lgbm["LightGBM Estimate"]
  node_xgboost["XGBoost Estimate"]
  node_catboost["CatBoost Estimate"]
  node_ensemble["Hybrid Ensemble<br/>[app.py]"]
end

subgraph group_results["Results"]
  node_price["Price and Range<br/>[app.py]"]
  node_comparison["Model Comparison<br/>[app.py]"]
  node_performance["Performance Metrics<br/>[app.py]"]
end

subgraph group_assets["Model Assets"]
  node_brand_encoder["Brand Encoder<br/>[brand_encoder.pkl]"]
  node_config["Model Config<br/>[webapp_config.json]"]
end

node_user(("Buyer or Seller"))

node_user -->|"enters details"| node_phone
node_user -->|"enters details"| node_listing
node_user -->|"enters details"| node_seller
node_phone -->|"supplies features"| node_prepare
node_listing -->|"supplies features"| node_prepare
node_seller -->|"supplies features"| node_prepare
node_prepare -->|"encodes categories"| node_brand_encoder
node_prepare -->|"normalizes features"| node_preprocessor
node_preprocessor -->|"provides features"| node_lgbm
node_preprocessor -->|"provides features"| node_xgboost
node_preprocessor -->|"provides features"| node_catboost
node_lgbm -->|"provides estimate"| node_ensemble
node_xgboost -->|"provides estimate"| node_ensemble
node_catboost -->|"provides estimate"| node_ensemble
node_ensemble -->|"produces price"| node_price
node_config -->|"sets range metrics"| node_price
node_price -->|"shows estimate"| node_user
node_ensemble -->|"shows model outputs"| node_comparison
node_config -->|"provides metrics"| node_performance
node_comparison -->|"shows comparison"| node_user
node_performance -->|"shows metrics"| node_user

click node_phone "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py"
click node_listing "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py"
click node_seller "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py"
click node_prepare "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py"
click node_preprocessor "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/preprocessor.pkl"
click node_lgbm "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/best_lgbm_optuna.pkl"
click node_xgboost "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/hybrid_xgb_model.pkl"
click node_catboost "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/hybrid_cat_model.pkl"
click node_ensemble "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py"
click node_brand_encoder "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/brand_encoder.pkl"
click node_config "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/webapp_config.json"
click node_price "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py"
click node_comparison "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py"
click node_performance "https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.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_phone,node_listing,node_seller toneBlue
class node_prepare,node_preprocessor,node_lgbm,node_xgboost,node_catboost,node_ensemble toneAmber
class node_price,node_comparison,node_performance toneMint
class node_brand_encoder,node_config toneRose
class node_user toneIndigo
```

## Components

### User Inputs

- [Phone Details](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py): `app.py`
- [Listing Details](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py): `app.py`
- [Seller Details](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py): `app.py`

### Price Prediction

- [Input Preparation](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py): `app.py`
- [Feature Preprocessor](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/preprocessor.pkl): `models/preprocessor.pkl`
- [LightGBM Estimate](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/best_lgbm_optuna.pkl): `models/best_lgbm_optuna.pkl`
- [XGBoost Estimate](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/hybrid_xgb_model.pkl): `models/hybrid_xgb_model.pkl`
- [CatBoost Estimate](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/hybrid_cat_model.pkl): `models/hybrid_cat_model.pkl`
- [Hybrid Ensemble](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py): `app.py`

### Results

- [Price and Range](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py): `app.py`
- [Model Comparison](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py): `app.py`
- [Performance Metrics](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/app.py): `app.py`

### Model Assets

- [Brand Encoder](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/brand_encoder.pkl): `models/brand_encoder.pkl`
- [Model Config](https://github.com/nhannguyenhcm95/phan-tich-gia-dien-thoai-tren-web-chotot/blob/main/models/webapp_config.json): `models/webapp_config.json`

### Other components

- **Buyer or Seller**

## Connections

- Buyer or Seller → Phone Details: enters details (evidence: `README.md`)
- Buyer or Seller → Listing Details: enters details (evidence: `README.md`)
- Buyer or Seller → Seller Details: enters details (evidence: `README.md`)
- Phone Details → Input Preparation: supplies features (evidence: `README.md`)
- Listing Details → Input Preparation: supplies features (evidence: `README.md`)
- Seller Details → Input Preparation: supplies features (evidence: `README.md`)
- Input Preparation → Brand Encoder: encodes categories (evidence: `README.md`)
- Input Preparation → Feature Preprocessor: normalizes features (evidence: `README.md`)
- Feature Preprocessor → LightGBM Estimate: provides features (evidence: `README.md`)
- Feature Preprocessor → XGBoost Estimate: provides features (evidence: `README.md`)
- Feature Preprocessor → CatBoost Estimate: provides features (evidence: `README.md`)
- LightGBM Estimate → Hybrid Ensemble: provides estimate (evidence: `README.md`)
- XGBoost Estimate → Hybrid Ensemble: provides estimate (evidence: `README.md`)
- CatBoost Estimate → Hybrid Ensemble: provides estimate (evidence: `README.md`)
- Hybrid Ensemble → Price and Range: produces price (evidence: `README.md`)
- Model Config → Price and Range: sets range metrics (evidence: `README.md`)
- Price and Range → Buyer or Seller: shows estimate (evidence: `README.md`)
- Hybrid Ensemble → Model Comparison: shows model outputs (evidence: `app.py`)
- Model Config → Performance Metrics: provides metrics (evidence: `app.py`)
- Model Comparison → Buyer or Seller: shows comparison (evidence: `app.py`)
- Performance Metrics → Buyer or Seller: shows metrics (evidence: `app.py`)
