# nikunj069/driver_fault_classification architecture

> Architecture diagram of the GitHub repository nikunj069/driver_fault_classification, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nikunj069/driver_fault_classification
- Repository: https://github.com/nikunj069/driver_fault_classification

## Overview

This is a Streamlit application for classifying driver responsibility in motor-vehicle crashes. Users enter one crash record or upload a batch; the app prepares features, runs the trained model, and presents fault classifications and confidence for download. The README documents these capabilities, while the sampled app.py excerpts show the UI, some feature preparation, and result rendering. Several implementation details are omitted from the excerpts, so documented but unsampled links cite the README.

Main entry points: [`app.py`](https://github.com/nikunj069/driver_fault_classification/blob/main/app.py) (Streamlit app), [`model/best_model.pkl`](https://github.com/nikunj069/driver_fault_classification/blob/main/model/best_model.pkl) (Trained model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_app["Streamlit app<br/>[app.py]"]
  node_single["Single-entry form<br/>[app.py]"]
  node_batch["Batch upload<br/>[app.py]"]
  node_template["CSV template<br/>[app.py]"]
end

subgraph group_prediction["Prediction"]
  node_features["Feature preparation<br/>[app.py]"]
  node_model["Trained model<br/>[best_model.pkl]"]
  node_inference["Fault prediction<br/>[app.py]"]
end

subgraph group_results["Results"]
  node_preview["Results preview<br/>[app.py]"]
  node_download["CSV export<br/>[app.py]"]
end

node_user(("Driver"))

node_user -->|"uses"| node_app
node_app -->|"offers"| node_single
node_app -->|"offers"| node_batch
node_batch -->|"downloads"| node_template
node_single -->|"prepares fields"| node_features
node_batch -->|"prepares records"| node_features
node_features -->|"provides features"| node_inference
node_inference -->|"uses"| node_model
node_inference -->|"returns predictions"| node_preview
node_preview -->|"exports results"| node_download

click node_app "https://github.com/nikunj069/driver_fault_classification/blob/main/app.py"
click node_single "https://github.com/nikunj069/driver_fault_classification/blob/main/app.py"
click node_batch "https://github.com/nikunj069/driver_fault_classification/blob/main/app.py"
click node_template "https://github.com/nikunj069/driver_fault_classification/blob/main/app.py"
click node_features "https://github.com/nikunj069/driver_fault_classification/blob/main/app.py"
click node_model "https://github.com/nikunj069/driver_fault_classification/blob/main/model/best_model.pkl"
click node_inference "https://github.com/nikunj069/driver_fault_classification/blob/main/app.py"
click node_preview "https://github.com/nikunj069/driver_fault_classification/blob/main/app.py"
click node_download "https://github.com/nikunj069/driver_fault_classification/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_app,node_single,node_batch,node_template toneBlue
class node_features,node_model,node_inference toneAmber
class node_preview,node_download toneMint
class node_user toneIndigo
```

## Components

### User Interface

- [Streamlit app](https://github.com/nikunj069/driver_fault_classification/blob/main/app.py): `app.py`
- [Single-entry form](https://github.com/nikunj069/driver_fault_classification/blob/main/app.py): `app.py`
- [Batch upload](https://github.com/nikunj069/driver_fault_classification/blob/main/app.py): `app.py`
- [CSV template](https://github.com/nikunj069/driver_fault_classification/blob/main/app.py): `app.py`

### Prediction

- [Feature preparation](https://github.com/nikunj069/driver_fault_classification/blob/main/app.py): `app.py`
- [Trained model](https://github.com/nikunj069/driver_fault_classification/blob/main/model/best_model.pkl): `model/best_model.pkl`
- [Fault prediction](https://github.com/nikunj069/driver_fault_classification/blob/main/app.py): `app.py`

### Results

- [Results preview](https://github.com/nikunj069/driver_fault_classification/blob/main/app.py): `app.py`
- [CSV export](https://github.com/nikunj069/driver_fault_classification/blob/main/app.py): `app.py`

### Other components

- **Driver**

## Connections

- Driver → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Single-entry form: offers (evidence: `README.md`)
- Streamlit app → Batch upload: offers (evidence: `README.md`)
- Batch upload → CSV template: downloads (evidence: `README.md`)
- Single-entry form → Feature preparation: prepares fields (evidence: `README.md`)
- Batch upload → Feature preparation: prepares records (evidence: `README.md`)
- Feature preparation → Fault prediction: provides features (evidence: `app.py`)
- Fault prediction → Trained model: uses (evidence: `README.md`)
- Fault prediction → Results preview: returns predictions (evidence: `README.md`)
- Results preview → CSV export: exports results (evidence: `README.md`)
