# owoeye-babatunde/homesmart architecture

> Architecture diagram of the GitHub repository owoeye-babatunde/homesmart, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/owoeye-babatunde/homesmart
- Repository: https://github.com/owoeye-babatunde/homesmart

## Overview

##### Main Components
- Data Processing & Feature Engineering: Files like src/data.rs and src/model.rs indicate that raw data parsing and transformation occur here. The README also describes an efficient CSV parser and Polars-based DataFrame operations.
- Model Training: The binary in src/bin/train.rs suggests a dedicated executable for training the machine learning model, including cross-validation, metrics, and model serialization.
- API Serving: The binary in src/bin/api.rs implements the RESTful API that clients can interact with for predictions. Emphasize concurrent request handling and low-latency predictions.
- AWS Integration: The src/aws.rs module is responsible for integrating with AWS S3 for model storage and versioning.
- Containerization / Deployment Tools: The existence of a Dockerfile, Makefile, and Cargo configuration files suggests that containerized deployment and automated build scripts are in place.
- Support Libraries & Utilities: The src/lib.rs file as the central library, and the overall Cargo setup, help manage application-wide functionality.

##### Relationships and Data Flow
- Data is first loaded and processed in the data handling/feature engineering stage.
- The processed data passes into the model training component where the model is built, validated, and serialized.
- Once trained, the model is deployed: the AWS integration module handles uploading to S3, and the API serves the model for predictions by loading it from persistent storage.
- The RESTful API accepts input requests, performs any required pre-processing, hands data over to the prediction engine, and then sends the result back.
- The system shows clear modular separation: training and API serving are implemented as separate binaries to allow independent execution.

##### Architectural Patterns and Technologies
- Modular Architecture: Separation of concerns is evident (data, model, API, AWS) which aligns with best practices.
- Containerization: Use of Dockerfile facilitates environment consistency, which can be represented as an outer layer (deployment container) wrapping the components.
- Rust’s Concurrency and Safety: Emphasize how Rust’s language features provide memory safety and zero-cost abstractions across components.
- Integration with External Services: AWS S3 is used for model storage and versioning, so show a connection from the training/deployment layer to an external AWS S3 service.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% ML Pipeline Subgraph
    subgraph "ML Pipeline"
        CSV["CSV Input"]:::ml
        DP["Data Processing & Feature Engineering"]:::ml
        TRAIN["Training Binary"]:::ml
        SERIAL["Serialized Model"]:::ml
        AWS["AWS Integration (S3)"]:::external
        API["RESTful API Server"]:::ml
    end

    %% Support Libraries Subgraph
    subgraph "Support Libraries & Utilities"
        LIB["lib.rs"]:::support
        CARGO["Cargo.toml"]:::support
        LOCK["Cargo.lock"]:::support
    end

    %% Container/Deployment Tools Subgraph
    subgraph "Container/Deployment Tools"
        DOCKER["Dockerfile"]:::container
        MAKE["Makefile"]:::container
    end

    %% Main ML Pipeline Data Flow
    CSV -->|"ingests"| DP
    DP -->|"processes"| TRAIN
    TRAIN -->|"serializes"| SERIAL
    SERIAL -->|"uploads to"| AWS
    AWS -->|"serves model to"| API

    %% Dependencies from Support Libraries (dotted lines)
    LIB ---|"provides APIs"| DP
    LIB ---|"provides APIs"| TRAIN
    LIB ---|"provides APIs"| API

    CARGO ---|"build config"| DP
    CARGO ---|"build config"| TRAIN
    CARGO ---|"build config"| API

    LOCK ---|"version lock"| DP
    LOCK ---|"version lock"| TRAIN
    LOCK ---|"version lock"| API

    %% Container/Deployment Tools dependencies (dashed lines)
    DOCKER -.->|"containerizes"| TRAIN
    DOCKER -.->|"containerizes"| API
    MAKE -.->|"automates build"| TRAIN
    MAKE -.->|"automates build"| API

    %% Click Events for Component Mapping
    click DP "https://github.com/owoeye-babatunde/homesmart/blob/main/house-price-predictor/src/data.rs"
    click DP "https://github.com/owoeye-babatunde/homesmart/blob/main/house-price-predictor/src/model.rs"
    click TRAIN "https://github.com/owoeye-babatunde/homesmart/blob/main/house-price-predictor/src/bin/train.rs"
    click API "https://github.com/owoeye-babatunde/homesmart/blob/main/house-price-predictor/src/bin/api.rs"
    click AWS "https://github.com/owoeye-babatunde/homesmart/blob/main/house-price-predictor/src/aws.rs"
    click DOCKER "https://github.com/owoeye-babatunde/homesmart/tree/main/house-price-predictor/Dockerfile"
    click MAKE "https://github.com/owoeye-babatunde/homesmart/tree/main/house-price-predictor/Makefile"
    click LIB "https://github.com/owoeye-babatunde/homesmart/blob/main/house-price-predictor/src/lib.rs"
    click CARGO "https://github.com/owoeye-babatunde/homesmart/blob/main/house-price-predictor/Cargo.toml"
    click LOCK "https://github.com/owoeye-babatunde/homesmart/blob/main/house-price-predictor/Cargo.lock"

    %% Styles Definitions
    classDef ml fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef external fill:#FFCC99,stroke:#333,stroke-width:2px;
    classDef support fill:#FFFACD,stroke:#333,stroke-width:2px;
    classDef container fill:#D3D3D3,stroke:#333,stroke-width:2px;
```
