# pbbdydx/vehicle_research architecture

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

- Interactive diagram: https://gitdiagram.com/pbbdydx/vehicle_research
- Repository: https://github.com/pbbdydx/vehicle_research

## Overview

##### Project type and purpose
- This is an R-based data-science/ML research pipeline for predicting vehicle collision severity in Pennsylvania.
- It is not a typical client–server or web app but a linear analysis pipeline: raw data → cleaning → feature engineering → model training → stored models.

##### File structure
Top-level:
- code/
– analysis.R
– data_cleaning.R
– data_pipeline.R
– models.R
- models/ (serialized RDS model outputs)
- README.md, .gitignore, R session files
Observations:
– “code/” contains modular scripts for each stage.
– “models/” holds final artifacts (logistic, random forest, XGBoost, with and without ROSE).
– No dedicated “data/” folder, but data ingestion is implied in data_pipeline.R.
– No service or UI components—this is a one-off research batch job pipeline.

##### README for additional insights
- Single-year ML analysis, future multi-year extension.
- Data sourced from Pennsylvania ArcGIS endpoint.
- Methodological influences from a published paper.
- No mention of automated deployment or real-time service layers.

## Diagram (Mermaid)

```mermaid
flowchart TB
    ExternalDataSource["External Data Source<br/>(PA collision endpoint)"]:::rawdatastore
    LocalRawDataset[(Local Raw Dataset)]:::rawdatastore

    subgraph "Version Control & Environment"
        direction TB
        Gitignore[".gitignore"]:::environment
        RHistory_root[".Rhistory"]:::environment
        RData_root[".RData"]:::environment
        Code_RHistory["code/.Rhistory"]:::environment
        Code_RData["code/.RData"]:::environment
        data_cleaning["data_cleaning.R"]:::processing
        data_pipeline["data_pipeline.R"]:::processing
        models["models.R"]:::modeling
        analysis["analysis.R"]:::modeling
    end

    CleanedDataset[(Cleaned Dataset)]:::rawdatastore
    FeatureSet[(Feature Set)]:::rawdatastore
    ModelArtifacts[(models/)]:::rawdatastore
    ReportingOutput["Reporting & Analysis Output"]:::modeling

    ExternalDataSource --> LocalRawDataset
    LocalRawDataset --> data_cleaning
    data_cleaning --> CleanedDataset
    CleanedDataset --> data_pipeline
    data_pipeline --> FeatureSet
    FeatureSet --> models
    models --> ModelArtifacts
    models --> analysis
    analysis --> ReportingOutput

    click data_cleaning "https://github.com/pbbdydx/vehicle_research/blob/main/code/data_cleaning.R"
    click data_pipeline "https://github.com/pbbdydx/vehicle_research/blob/main/code/data_pipeline.R"
    click models "https://github.com/pbbdydx/vehicle_research/blob/main/code/models.R"
    click analysis "https://github.com/pbbdydx/vehicle_research/blob/main/code/analysis.R"
    click ModelArtifacts "https://github.com/pbbdydx/vehicle_research/tree/main/models/"
    click Gitignore "https://github.com/pbbdydx/vehicle_research/blob/main/.gitignore"
    click RHistory_root "https://github.com/pbbdydx/vehicle_research/blob/main/.Rhistory"
    click RData_root "https://github.com/pbbdydx/vehicle_research/blob/main/.RData"
    click Code_RHistory "https://github.com/pbbdydx/vehicle_research/blob/main/code/.Rhistory"
    click Code_RData "https://github.com/pbbdydx/vehicle_research/blob/main/code/.RData"

    classDef rawdatastore fill:#1f77b4,stroke:#000,color:#fff
    classDef processing fill:#2ca02c,stroke:#000,color:#fff
    classDef modeling fill:#ff7f0e,stroke:#000,color:#fff
    classDef environment fill:#d3d3d3,stroke:#000,color:#000
```
