# madhurasharan/autism-spectrum-disorder-detection architecture

> Architecture diagram of the GitHub repository madhurasharan/autism-spectrum-disorder-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/madhurasharan/autism-spectrum-disorder-detection
- Repository: https://github.com/madhurasharan/autism-spectrum-disorder-detection

## Overview

This is an ASD screening web application, with a separate model-development workflow. In the Flask path, a visitor opens the questionnaire, submits behavioral and demographic answers, and receives a prediction with probabilities and a downloadable PDF. The repository also documents a stacking ensemble and includes model-development and evaluation scripts. The Flask request, prediction, chart, and PDF steps are visible in app.py; training details are only partly sampled, so the connection from model development to the saved model is unverified. The README also mentions Streamlit, but its file describes that UI as an alternative stub.

Main entry points: [`app.py`](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py) (Prediction handler), [`stacking_model.pkl`](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/stacking_model.pkl) (Stacking model), [`ASD.py`](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/ASD.py) (Model development), [`check_accuracy.py`](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/check_accuracy.py) (Accuracy evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Screening web app"]
  node_flask["Flask routes<br/>[app.py]"]
  node_screening_pages["Screening pages"]
  node_questionnaire["Questionnaire<br/>[questionnaire.html]"]
  node_streamlit_stub["Streamlit alternative<br/>[streamlit_app.py]"]
end

subgraph group_inference["Prediction and reporting"]
  node_prediction_handler["Prediction handler<br/>[app.py]"]
  node_feature_encoding["Feature encoding<br/>[app.py]"]
  node_stacking_model["Stacking model<br/>[stacking_model.pkl]"]
  node_probability_chart["Probability chart<br/>[app.py]"]
  node_result_page["Result page<br/>[result.html]"]
  node_pdf_report["PDF report<br/>[app.py]"]
  node_pdf_download["PDF download<br/>[app.py]"]
end

subgraph group_model["Model development"]
  node_training_workflow["Model development<br/>[ASD.py]"]
end

subgraph group_evaluation["Model evaluation"]
  node_validation_workflow["Accuracy evaluation<br/>[check_accuracy.py]"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens pages"| node_flask
node_flask -->|"renders pages"| node_screening_pages
node_flask -->|"renders form"| node_questionnaire
node_visitor -->|"submits answers"| node_prediction_handler
node_prediction_handler -->|"encodes inputs"| node_feature_encoding
node_prediction_handler -->|"predicts probabilities"| node_stacking_model
node_prediction_handler -->|"generates chart"| node_probability_chart
node_prediction_handler -->|"generates report"| node_pdf_report
node_prediction_handler -->|"renders result"| node_result_page
node_flask -->|"serves download"| node_pdf_download
node_pdf_download -->|"sends PDF"| node_visitor
node_training_workflow -.->|"produces model"| node_stacking_model
node_validation_workflow -->|"evaluates model"| node_stacking_model

click node_flask "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py"
click node_screening_pages "https://github.com/madhurasharan/autism-spectrum-disorder-detection/tree/main/templates"
click node_questionnaire "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/templates/questionnaire.html"
click node_prediction_handler "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py"
click node_feature_encoding "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py"
click node_stacking_model "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/stacking_model.pkl"
click node_probability_chart "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py"
click node_result_page "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/templates/result.html"
click node_pdf_report "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py"
click node_pdf_download "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py"
click node_training_workflow "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/ASD.py"
click node_validation_workflow "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/check_accuracy.py"
click node_streamlit_stub "https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/streamlit_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_flask,node_screening_pages,node_questionnaire,node_streamlit_stub toneBlue
class node_prediction_handler,node_feature_encoding,node_stacking_model,node_probability_chart,node_result_page,node_pdf_report,node_pdf_download toneAmber
class node_training_workflow toneMint
class node_validation_workflow toneRose
class node_visitor toneIndigo
```

## Components

### Screening web app

- [Flask routes](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py): `app.py`
- [Screening pages](https://github.com/madhurasharan/autism-spectrum-disorder-detection/tree/main/templates): `templates`
- [Questionnaire](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/templates/questionnaire.html): `templates/questionnaire.html`
- [Streamlit alternative](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/streamlit_app.py): `streamlit_app.py`

### Prediction and reporting

- [Prediction handler](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py): `app.py`
- [Feature encoding](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py): `app.py`
- [Stacking model](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/stacking_model.pkl): `stacking_model.pkl`
- [Probability chart](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py): `app.py`
- [Result page](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/templates/result.html): `templates/result.html`
- [PDF report](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py): `app.py`
- [PDF download](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/app.py): `app.py`

### Model development

- [Model development](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/ASD.py): `ASD.py`

### Model evaluation

- [Accuracy evaluation](https://github.com/madhurasharan/autism-spectrum-disorder-detection/blob/main/check_accuracy.py): `check_accuracy.py`

### Other components

- **Visitor**

## Connections

- Visitor → Flask routes: opens pages (evidence: `app.py`)
- Flask routes → Screening pages: renders pages (evidence: `app.py`)
- Flask routes → Questionnaire: renders form (evidence: `app.py`)
- Visitor → Prediction handler: submits answers (evidence: `app.py`)
- Prediction handler → Feature encoding: encodes inputs (evidence: `app.py`)
- Prediction handler → Stacking model: predicts probabilities (evidence: `app.py`)
- Prediction handler → Probability chart: generates chart (evidence: `app.py`)
- Prediction handler → PDF report: generates report (evidence: `app.py`)
- Prediction handler → Result page: renders result (evidence: `app.py`)
- Flask routes → PDF download: serves download (evidence: `app.py`)
- PDF download → Visitor: sends PDF (evidence: `app.py`)
- Model development → Stacking model: produces model
- Accuracy evaluation → Stacking model: evaluates model (evidence: `check_accuracy.py`)
