# phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml architecture

> Architecture diagram of the GitHub repository phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml
- Repository: https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml

## Overview

This repository builds a used-laptop pricing platform: listings are crawled into raw storage, transformed through Bronze/Silver/Gold data stages, then used to train and evaluate a pricing model and save artifacts for prediction. The README documents MongoDB, S3, and scheduled ingestion; source excerpts and the index show the ETL and ML call structure. Some cloud wiring and crawler details are documented but not sampled, so those edges cite the README; future serving/UI capabilities are omitted because they are explicitly roadmap items.

Main entry points: [`src/data_pipeline/silver_layer.py`](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/silver_layer.py) (Silver Enrichment), [`src/data_pipeline/main_etl.py`](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/main_etl.py) (ETL Orchestrator), [`src/ml/trainer.py`](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/trainer.py) (Training Pipeline), [`src/data_pipeline/bronze_layer.py`](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/bronze_layer.py) (Bronze Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Listing Ingestion"]
  node_spider["Listing Spider"]
  node_item["Listing Item<br/>[items.py]"]
  node_mongo[("MongoDB Atlas")]
end

subgraph group_lakehouse["Medallion Lakehouse"]
  node_orchestrator["ETL Orchestrator<br/>[main_etl.py]"]
  node_bronze["Bronze Ingestion<br/>[bronze_layer.py]"]
  node_bronze_data[("Bronze Parquet")]
  node_silver["Silver Enrichment<br/>[silver_layer.py]"]
  node_patterns["Extraction Patterns<br/>[silver_patterns.py]"]
  node_taxonomy["Taxonomy Resolver"]
  node_taxonomy_dict["Taxonomy Dictionary"]
  node_silver_data[("Silver Parquet")]
  node_gold["Gold Feature Engineering<br/>[gold_layer.py]"]
  node_gold_data[("Gold Feature Dataset")]
  node_s3[("AWS S3 Lake")]
end

subgraph group_ml["Pricing ML"]
  node_trainer["Training Pipeline<br/>[trainer.py]"]
  node_dataset["Dataset Loader<br/>[dataset.py]"]
  node_tuner["Bayesian Tuner<br/>[tuner.py]"]
  node_metrics["Model Metrics<br/>[metrics.py]"]
  node_artifacts["Model Artifacts<br/>[artifacts.py]"]
  node_predictor["Price Predictor<br/>[predictor.py]"]
  node_config["ML Configuration<br/>[config.py]"]
end

subgraph group_shared["Shared Runtime"]
  node_spark_utils["Spark Session Utility<br/>[spark_utils.py]"]
  node_logger["Logging Utility<br/>[logger.py]"]
end

node_gateway(("Chợ Tốt API"))

node_gateway -->|"serves listings"| node_spider
node_spider -->|"populates"| node_item
node_spider -->|"upserts listings"| node_mongo
node_mongo -->|"ingests raw"| node_bronze
node_orchestrator -->|"runs"| node_bronze
node_orchestrator -->|"runs"| node_silver
node_orchestrator -->|"runs"| node_gold
node_bronze -->|"writes Parquet"| node_bronze_data
node_bronze_data -->|"reads raw"| node_silver
node_silver -->|"uses patterns"| node_patterns
node_silver -->|"resolves taxonomy"| node_taxonomy
node_taxonomy -->|"loads dictionary"| node_taxonomy_dict
node_silver -->|"writes enriched"| node_silver_data
node_silver_data -->|"reads features"| node_gold
node_gold -->|"writes features"| node_gold_data
node_gold_data -.->|"syncs data"| node_s3
node_trainer -->|"loads and splits"| node_dataset
node_trainer -->|"tunes model"| node_tuner
node_trainer -->|"evaluates predictions"| node_metrics
node_trainer -->|"saves model"| node_artifacts
node_predictor -->|"loads model"| node_artifacts
node_predictor -->|"uses metrics"| node_metrics
node_trainer -->|"uses configuration"| node_config
node_dataset -->|"uses configuration"| node_config
node_tuner -->|"uses search settings"| node_config
node_orchestrator -->|"creates Spark session"| node_spark_utils
node_bronze -->|"creates Spark session"| node_spark_utils
node_silver -->|"creates Spark session"| node_spark_utils
node_gold -->|"creates Spark session"| node_spark_utils
node_orchestrator -->|"logs progress"| node_logger
node_bronze -->|"logs progress"| node_logger
node_silver -->|"logs progress"| node_logger
node_gold -->|"logs progress"| node_logger

click node_spider "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/crawler/spiders/master_detail_spider.py"
click node_item "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/crawler/items.py"
click node_orchestrator "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/main_etl.py"
click node_bronze "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/bronze_layer.py"
click node_silver "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/silver_layer.py"
click node_patterns "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/silver_patterns.py"
click node_taxonomy "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/taxonomy_resolver.py"
click node_taxonomy_dict "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/docs/taxonomy_dictionary.json"
click node_gold "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/gold_layer.py"
click node_trainer "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/trainer.py"
click node_dataset "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/dataset.py"
click node_tuner "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/tuner.py"
click node_metrics "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/metrics.py"
click node_artifacts "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/artifacts.py"
click node_predictor "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/predictor.py"
click node_config "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/config.py"
click node_spark_utils "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/utils/spark_utils.py"
click node_logger "https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/utils/logger.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_spider,node_item,node_mongo toneBlue
class node_orchestrator,node_bronze,node_bronze_data,node_silver,node_patterns,node_taxonomy,node_taxonomy_dict,node_silver_data,node_gold,node_gold_data,node_s3 toneAmber
class node_trainer,node_dataset,node_tuner,node_metrics,node_artifacts,node_predictor,node_config,node_gateway toneMint
class node_spark_utils,node_logger toneRose
```

## Components

### Listing Ingestion

- [Listing Spider](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/crawler/spiders/master_detail_spider.py): `crawler/spiders/master_detail_spider.py`
- [Listing Item](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/crawler/items.py): `crawler/items.py`
- **MongoDB Atlas**

### Medallion Lakehouse

- [ETL Orchestrator](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/main_etl.py): `src/data_pipeline/main_etl.py`
- [Bronze Ingestion](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/bronze_layer.py): `src/data_pipeline/bronze_layer.py`
- **Bronze Parquet**
- [Silver Enrichment](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/silver_layer.py): `src/data_pipeline/silver_layer.py`
- [Extraction Patterns](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/silver_patterns.py): `src/data_pipeline/silver_patterns.py`
- [Taxonomy Resolver](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/taxonomy_resolver.py): `src/data_pipeline/taxonomy_resolver.py`
- [Taxonomy Dictionary](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/docs/taxonomy_dictionary.json): `docs/taxonomy_dictionary.json`
- **Silver Parquet**
- [Gold Feature Engineering](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/data_pipeline/gold_layer.py): `src/data_pipeline/gold_layer.py`
- **Gold Feature Dataset**
- **AWS S3 Lake**

### Pricing ML

- [Training Pipeline](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/trainer.py): `src/ml/trainer.py`
- [Dataset Loader](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/dataset.py): `src/ml/dataset.py`
- [Bayesian Tuner](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/tuner.py): `src/ml/tuner.py`
- [Model Metrics](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/metrics.py): `src/ml/metrics.py`
- [Model Artifacts](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/artifacts.py): `src/ml/artifacts.py`
- [Price Predictor](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/predictor.py): `src/ml/predictor.py`
- [ML Configuration](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/ml/config.py): `src/ml/config.py`

### Shared Runtime

- [Spark Session Utility](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/utils/spark_utils.py): `src/utils/spark_utils.py`
- [Logging Utility](https://github.com/phongtrinhdinh/mi3390-research-and-development-of-a-pricing-system-for-used-laptops-based-on-nlp-and-ml/blob/main/src/utils/logger.py): `src/utils/logger.py`

### Other components

- **Chợ Tốt API**

## Connections

- Chợ Tốt API → Listing Spider: serves listings (evidence: `README.md`)
- Listing Spider → Listing Item: populates (evidence: `crawler/spiders/master_detail_spider.py`)
- Listing Spider → MongoDB Atlas: upserts listings (evidence: `README.md`)
- MongoDB Atlas → Bronze Ingestion: ingests raw (evidence: `README.md`)
- ETL Orchestrator → Bronze Ingestion: runs (evidence: `src/data_pipeline/main_etl.py`)
- ETL Orchestrator → Silver Enrichment: runs (evidence: `src/data_pipeline/main_etl.py`)
- ETL Orchestrator → Gold Feature Engineering: runs (evidence: `src/data_pipeline/main_etl.py`)
- Bronze Ingestion → Bronze Parquet: writes Parquet (evidence: `README.md`)
- Bronze Parquet → Silver Enrichment: reads raw (evidence: `README.md`)
- Silver Enrichment → Extraction Patterns: uses patterns (evidence: `src/data_pipeline/silver_layer.py`)
- Silver Enrichment → Taxonomy Resolver: resolves taxonomy (evidence: `src/data_pipeline/silver_layer.py`)
- Taxonomy Resolver → Taxonomy Dictionary: loads dictionary (evidence: `src/data_pipeline/taxonomy_resolver.py`)
- Silver Enrichment → Silver Parquet: writes enriched (evidence: `src/data_pipeline/silver_layer.py`)
- Silver Parquet → Gold Feature Engineering: reads features (evidence: `README.md`)
- Gold Feature Engineering → Gold Feature Dataset: writes features (evidence: `src/data_pipeline/gold_layer.py`)
- Gold Feature Dataset → AWS S3 Lake: syncs data (evidence: `README.md`)
- Training Pipeline → Dataset Loader: loads and splits (evidence: `src/ml/trainer.py`)
- Training Pipeline → Bayesian Tuner: tunes model (evidence: `src/ml/trainer.py`)
- Training Pipeline → Model Metrics: evaluates predictions (evidence: `src/ml/trainer.py`)
- Training Pipeline → Model Artifacts: saves model (evidence: `src/ml/trainer.py`)
- Price Predictor → Model Artifacts: loads model (evidence: `src/ml/predictor.py`)
- Price Predictor → Model Metrics: uses metrics (evidence: `src/ml/predictor.py`)
- Training Pipeline → ML Configuration: uses configuration (evidence: `src/ml/trainer.py`)
- Dataset Loader → ML Configuration: uses configuration (evidence: `src/ml/dataset.py`)
- Bayesian Tuner → ML Configuration: uses search settings (evidence: `src/ml/tuner.py`)
- ETL Orchestrator → Spark Session Utility: creates Spark session (evidence: `src/data_pipeline/main_etl.py`)
- Bronze Ingestion → Spark Session Utility: creates Spark session (evidence: `src/data_pipeline/bronze_layer.py`)
- Silver Enrichment → Spark Session Utility: creates Spark session (evidence: `src/data_pipeline/silver_layer.py`)
- Gold Feature Engineering → Spark Session Utility: creates Spark session (evidence: `src/data_pipeline/gold_layer.py`)
- ETL Orchestrator → Logging Utility: logs progress (evidence: `src/data_pipeline/main_etl.py`)
- Bronze Ingestion → Logging Utility: logs progress (evidence: `src/data_pipeline/bronze_layer.py`)
- Silver Enrichment → Logging Utility: logs progress (evidence: `src/data_pipeline/silver_layer.py`)
- Gold Feature Engineering → Logging Utility: logs progress (evidence: `src/data_pipeline/gold_layer.py`)
