# josue-rdgzcb/airbnb-price-prediction-mexico-city architecture

> Architecture diagram of the GitHub repository josue-rdgzcb/airbnb-price-prediction-mexico-city, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/josue-rdgzcb/airbnb-price-prediction-mexico-city
- Repository: https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city

## Overview

This project estimates Mexico City Airbnb nightly prices and contextualizes each estimate against nearby comparable listings. Users choose a location on the map, enter property and host details, and submit them through the Streamlit app to FastAPI; the API prepares features, applies the saved preprocessing pipeline and model, then generates market insights and returns a combined result. The graph also includes the documented training/analysis capabilities, though their internal connections are not established by the sampled runtime excerpts. Those excerpts support the API inference path; unsampled domain-module relationships are omitted rather than inferred.

Main entry points: [`app/services/inference.py`](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/inference.py) (Prediction inference), [`src/preprocess/preprocess_features.py`](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/preprocess_features.py) (Preprocessing pipeline), [`src/settings/preprocess_settings.py`](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/settings/preprocess_settings.py) (Preprocess settings), [`app/frontend/streamlit_app.py`](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/frontend/streamlit_app.py) (Pricing interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_streamlit["Pricing interface<br/>[streamlit_app.py]"]
  node_location_map["Location map<br/>[map.py]"]
  node_geolocation["Neighborhood lookup<br/>[geolocation.py]"]
end

subgraph group_serving["Prediction Service"]
  node_fastapi["FastAPI app<br/>[main.py]"]
  node_routes["Prediction endpoint<br/>[routes.py]"]
  node_schemas["Request and response<br/>[schemas.py]"]
  node_inference["Prediction inference<br/>[inference.py]"]
  node_features["Feature preparation<br/>[features.py]"]
  node_cleaning["Input cleaning<br/>[cleaning_utils.py]"]
  node_preprocessing["Preprocessing pipeline"]
  node_imputation["Missing-value imputation<br/>[imputation.py]"]
  node_encoding["Categorical encoding<br/>[encoding.py]"]
  node_numeric_transform["Numeric transforms"]
  node_scaling["Feature scaling<br/>[scaling.py]"]
  node_preprocess_settings["Preprocess settings"]
  node_artifacts[("Model artifacts<br/>[artifacts.py]")]
  node_model_settings["Model settings<br/>[model_settings.py]"]
  node_xgboost["Trained price model"]
end

subgraph group_market["Market Context"]
  node_market_insights["Comparable-market insights<br/>[insights.py]"]
  node_reference_data[("Reference listings")]
end

subgraph group_ml["ML Development"]
  node_data_prep["Data preparation"]
  node_eda["Exploratory analysis"]
  node_feature_analysis["Feature diagnostics"]
  node_modeling["Model training and evaluation"]
end

node_guest(("Listing user"))

node_guest -->|"enters listing"| node_streamlit
node_streamlit -->|"offers location selection"| node_location_map
node_location_map -->|"looks up neighborhood"| node_geolocation
node_streamlit -->|"submits listing"| node_fastapi
node_fastapi -->|"registers routes"| node_routes
node_routes -->|"validates and returns"| node_schemas
node_routes -->|"requests prediction"| node_inference
node_routes -->|"requests insights"| node_market_insights
node_inference -->|"prepares features"| node_features
node_inference -->|"transforms features"| node_preprocessing
node_inference -->|"uses loaded model and preprocessor"| node_artifacts
node_inference -->|"predicts price"| node_xgboost
node_features -->|"uses cleaning utilities"| node_cleaning
node_cleaning -->|"reads cleaning settings"| node_preprocess_settings
node_preprocessing -->|"applies imputation"| node_imputation
node_preprocessing -->|"applies encoding"| node_encoding
node_preprocessing -->|"applies numeric transforms"| node_numeric_transform
node_preprocessing -->|"applies scaling"| node_scaling
node_encoding -->|"reads encoding settings"| node_preprocess_settings
node_imputation -->|"reads imputation settings"| node_preprocess_settings
node_numeric_transform -->|"reads transform settings"| node_preprocess_settings
node_scaling -->|"reads scaling settings"| node_preprocess_settings
node_market_insights -->|"uses reference listings"| node_artifacts
node_market_insights -->|"searches comparables"| node_reference_data
node_streamlit -.->|"renders returned insights"| node_schemas
node_artifacts -.->|"loads trained model"| node_xgboost
node_data_prep -.->|"analyzes prepared data"| node_eda
node_eda -.->|"informs feature analysis"| node_feature_analysis
node_feature_analysis -.->|"supports model development"| node_modeling
node_modeling -.->|"produces deployed model"| node_xgboost

click node_streamlit "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/frontend/streamlit_app.py"
click node_location_map "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/frontend/map.py"
click node_geolocation "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/geolocation.py"
click node_fastapi "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/main.py"
click node_routes "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/api/routes.py"
click node_schemas "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/api/schemas.py"
click node_inference "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/inference.py"
click node_features "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/features.py"
click node_cleaning "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/cleaning/cleaning_utils.py"
click node_preprocessing "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/preprocess_features.py"
click node_imputation "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/imputation.py"
click node_encoding "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/encoding.py"
click node_numeric_transform "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/numeric_transformation.py"
click node_scaling "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/scaling.py"
click node_preprocess_settings "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/settings/preprocess_settings.py"
click node_artifacts "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/artifacts.py"
click node_model_settings "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/settings/model_settings.py"
click node_market_insights "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/insights.py"
click node_data_prep "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/tree/main/src/data"
click node_eda "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/tree/main/src/eda"
click node_feature_analysis "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/tree/main/src/features/analysis"
click node_modeling "https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/tree/main/src/modeling"

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_streamlit,node_location_map,node_geolocation,node_guest toneBlue
class node_fastapi,node_routes,node_schemas,node_inference,node_features,node_cleaning,node_preprocessing,node_imputation,node_encoding,node_numeric_transform,node_scaling,node_preprocess_settings,node_artifacts,node_model_settings,node_xgboost toneAmber
class node_market_insights,node_reference_data toneMint
class node_data_prep,node_eda,node_feature_analysis,node_modeling toneRose
```

## Components

### User Experience

- [Pricing interface](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/frontend/streamlit_app.py): `app/frontend/streamlit_app.py`
- [Location map](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/frontend/map.py): `app/frontend/map.py`
- [Neighborhood lookup](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/geolocation.py): `app/services/geolocation.py`

### Prediction Service

- [FastAPI app](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/main.py): `app/main.py`
- [Prediction endpoint](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/api/routes.py): `app/api/routes.py`
- [Request and response](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/api/schemas.py): `app/api/schemas.py`
- [Prediction inference](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/inference.py): `app/services/inference.py`
- [Feature preparation](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/features.py): `app/services/features.py`
- [Input cleaning](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/cleaning/cleaning_utils.py): `src/cleaning/cleaning_utils.py`
- [Preprocessing pipeline](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/preprocess_features.py): `src/preprocess/preprocess_features.py`
- [Missing-value imputation](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/imputation.py): `src/preprocess/imputation.py`
- [Categorical encoding](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/encoding.py): `src/preprocess/encoding.py`
- [Numeric transforms](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/numeric_transformation.py): `src/preprocess/numeric_transformation.py`
- [Feature scaling](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/preprocess/scaling.py): `src/preprocess/scaling.py`
- [Preprocess settings](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/settings/preprocess_settings.py): `src/settings/preprocess_settings.py`
- [Model artifacts](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/artifacts.py): `app/services/artifacts.py`
- [Model settings](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/src/settings/model_settings.py): `src/settings/model_settings.py`
- **Trained price model**

### Market Context

- [Comparable-market insights](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/blob/main/app/services/insights.py): `app/services/insights.py`
- **Reference listings**

### ML Development

- [Data preparation](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/tree/main/src/data): `src/data`
- [Exploratory analysis](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/tree/main/src/eda): `src/eda`
- [Feature diagnostics](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/tree/main/src/features/analysis): `src/features/analysis`
- [Model training and evaluation](https://github.com/josue-rdgzcb/airbnb-price-prediction-mexico-city/tree/main/src/modeling): `src/modeling`

### Other components

- **Listing user**

## Connections

- Listing user → Pricing interface: enters listing (evidence: `README.md`)
- Pricing interface → Location map: offers location selection (evidence: `app/frontend/streamlit_app.py`)
- Location map → Neighborhood lookup: looks up neighborhood (evidence: `app/frontend/map.py`)
- Pricing interface → FastAPI app: submits listing (evidence: `app/frontend/streamlit_app.py`)
- FastAPI app → Prediction endpoint: registers routes (evidence: `app/main.py`)
- Prediction endpoint → Request and response: validates and returns (evidence: `app/api/routes.py`)
- Prediction endpoint → Prediction inference: requests prediction (evidence: `app/api/routes.py`)
- Prediction endpoint → Comparable-market insights: requests insights (evidence: `app/api/routes.py`)
- Prediction inference → Feature preparation: prepares features (evidence: `app/services/inference.py`)
- Prediction inference → Preprocessing pipeline: transforms features (evidence: `app/services/inference.py`)
- Prediction inference → Model artifacts: uses loaded model and preprocessor (evidence: `app/services/inference.py`)
- Prediction inference → Trained price model: predicts price (evidence: `app/services/inference.py`)
- Feature preparation → Input cleaning: uses cleaning utilities (evidence: `app/services/features.py`)
- Input cleaning → Preprocess settings: reads cleaning settings (evidence: `src/cleaning/cleaning_utils.py`)
- Preprocessing pipeline → Missing-value imputation: applies imputation (evidence: `src/preprocess/preprocess_features.py`)
- Preprocessing pipeline → Categorical encoding: applies encoding (evidence: `src/preprocess/preprocess_features.py`)
- Preprocessing pipeline → Numeric transforms: applies numeric transforms (evidence: `src/preprocess/preprocess_features.py`)
- Preprocessing pipeline → Feature scaling: applies scaling (evidence: `src/preprocess/preprocess_features.py`)
- Categorical encoding → Preprocess settings: reads encoding settings (evidence: `src/preprocess/encoding.py`)
- Missing-value imputation → Preprocess settings: reads imputation settings (evidence: `src/preprocess/imputation.py`)
- Numeric transforms → Preprocess settings: reads transform settings (evidence: `src/preprocess/numeric_transformation.py`)
- Feature scaling → Preprocess settings: reads scaling settings (evidence: `src/preprocess/scaling.py`)
- Comparable-market insights → Model artifacts: uses reference listings (evidence: `app/services/insights.py`)
- Comparable-market insights → Reference listings: searches comparables (evidence: `app/services/insights.py`)
- Pricing interface → Request and response: renders returned insights
- Model artifacts → Trained price model: loads trained model
- Data preparation → Exploratory analysis: analyzes prepared data
- Exploratory analysis → Feature diagnostics: informs feature analysis
- Feature diagnostics → Model training and evaluation: supports model development
- Model training and evaluation → Trained price model: produces deployed model
