# qadeer572/ai_project_b architecture

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

- Interactive diagram: https://gitdiagram.com/qadeer572/ai_project_b
- Repository: https://github.com/qadeer572/ai_project_b

## Overview

This is a Streamlit hospital-surgery scheduling dashboard. A user configures operating rooms and hours, enters elective surgeries, then submits an emergency case; the system searches for a valid low-disruption reschedule and presents the updated plan and search trace. The dashboard also estimates emergency probability, while a separate training script creates the model artifact. A second Python file contains standalone A*, simulated annealing, and genetic-algorithm implementations. Some dashboard wiring is unsampled, so only documented connections are shown.

Main entry points: [`app.py`](https://github.com/qadeer572/ai_project_b/blob/main/app.py) (Streamlit Dashboard), [`emergency_model.pkl`](https://github.com/qadeer572/ai_project_b/blob/main/emergency_model.pkl) (Trained Model), [`train_model.py`](https://github.com/qadeer572/ai_project_b/blob/main/train_model.py) (Model Training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Scheduling Dashboard"]
  node_dashboard_ui["Streamlit Dashboard<br/>[app.py]"]
  node_hospital_setup["Hospital Setup<br/>[app.py]"]
  node_surgery_entry["Surgery Entry<br/>[app.py]"]
  node_emergency_input["Emergency Input<br/>[app.py]"]
  node_schedule_results["Schedule Results<br/>[app.py]"]
end

subgraph group_planning["Rescheduling"]
  node_schedule_validation["Schedule Validation<br/>[app.py]"]
  node_astar["A* Rescheduler<br/>[app.py]"]
end

subgraph group_prediction["Emergency Prediction"]
  node_probability_estimate["Emergency Probability<br/>[app.py]"]
  node_model_training["Model Training<br/>[train_model.py]"]
  node_model_artifact["Trained Model"]
end

subgraph group_experiments["Alternative Algorithms"]
  node_other_algorithms["Search Alternatives"]
  node_standalone_astar["Standalone A*"]
end

node_user(("Hospital User"))

node_user -->|"uses"| node_dashboard_ui
node_dashboard_ui -->|"configures"| node_hospital_setup
node_dashboard_ui -->|"enters surgeries"| node_surgery_entry
node_dashboard_ui -->|"enters emergency"| node_emergency_input
node_surgery_entry -->|"checks constraints"| node_schedule_validation
node_dashboard_ui -->|"estimates probability"| node_probability_estimate
node_model_training -->|"saves model"| node_model_artifact
node_model_artifact -->|"provides predictions"| node_probability_estimate
node_dashboard_ui -->|"runs rescheduling"| node_astar
node_astar -->|"checks candidate"| node_schedule_validation
node_astar -->|"uses probability"| node_probability_estimate
node_astar -->|"returns plan and trace"| node_schedule_results
node_dashboard_ui -->|"displays results"| node_schedule_results

click node_dashboard_ui "https://github.com/qadeer572/ai_project_b/blob/main/app.py"
click node_hospital_setup "https://github.com/qadeer572/ai_project_b/blob/main/app.py"
click node_surgery_entry "https://github.com/qadeer572/ai_project_b/blob/main/app.py"
click node_schedule_validation "https://github.com/qadeer572/ai_project_b/blob/main/app.py"
click node_emergency_input "https://github.com/qadeer572/ai_project_b/blob/main/app.py"
click node_probability_estimate "https://github.com/qadeer572/ai_project_b/blob/main/app.py"
click node_astar "https://github.com/qadeer572/ai_project_b/blob/main/app.py"
click node_schedule_results "https://github.com/qadeer572/ai_project_b/blob/main/app.py"
click node_model_training "https://github.com/qadeer572/ai_project_b/blob/main/train_model.py"
click node_model_artifact "https://github.com/qadeer572/ai_project_b/blob/main/emergency_model.pkl"
click node_other_algorithms "https://github.com/qadeer572/ai_project_b/blob/main/i233059_i233011_i233020_A02.py"
click node_standalone_astar "https://github.com/qadeer572/ai_project_b/blob/main/search_Algorithm.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_dashboard_ui,node_hospital_setup,node_surgery_entry,node_emergency_input,node_schedule_results,node_user toneBlue
class node_schedule_validation,node_astar toneAmber
class node_probability_estimate,node_model_training,node_model_artifact toneMint
class node_other_algorithms,node_standalone_astar toneRose
```

## Components

### Scheduling Dashboard

- [Streamlit Dashboard](https://github.com/qadeer572/ai_project_b/blob/main/app.py): `app.py`
- [Hospital Setup](https://github.com/qadeer572/ai_project_b/blob/main/app.py): `app.py`
- [Surgery Entry](https://github.com/qadeer572/ai_project_b/blob/main/app.py): `app.py`
- [Emergency Input](https://github.com/qadeer572/ai_project_b/blob/main/app.py): `app.py`
- [Schedule Results](https://github.com/qadeer572/ai_project_b/blob/main/app.py): `app.py`

### Rescheduling

- [Schedule Validation](https://github.com/qadeer572/ai_project_b/blob/main/app.py): `app.py`
- [A* Rescheduler](https://github.com/qadeer572/ai_project_b/blob/main/app.py): `app.py`

### Emergency Prediction

- [Emergency Probability](https://github.com/qadeer572/ai_project_b/blob/main/app.py): `app.py`
- [Model Training](https://github.com/qadeer572/ai_project_b/blob/main/train_model.py): `train_model.py`
- [Trained Model](https://github.com/qadeer572/ai_project_b/blob/main/emergency_model.pkl): `emergency_model.pkl`

### Alternative Algorithms

- [Search Alternatives](https://github.com/qadeer572/ai_project_b/blob/main/i233059_i233011_i233020_A02.py): `i233059_i233011_i233020_A02.py`
- [Standalone A*](https://github.com/qadeer572/ai_project_b/blob/main/search_Algorithm.py): `search_Algorithm.py`

### Other components

- **Hospital User**

## Connections

- Hospital User → Streamlit Dashboard: uses (evidence: `README.md`)
- Streamlit Dashboard → Hospital Setup: configures (evidence: `README.md`)
- Streamlit Dashboard → Surgery Entry: enters surgeries (evidence: `README.md`)
- Streamlit Dashboard → Emergency Input: enters emergency (evidence: `README.md`)
- Surgery Entry → Schedule Validation: checks constraints (evidence: `app.py`)
- Streamlit Dashboard → Emergency Probability: estimates probability (evidence: `app.py`)
- Model Training → Trained Model: saves model (evidence: `train_model.py`)
- Trained Model → Emergency Probability: provides predictions (evidence: `README.md`)
- Streamlit Dashboard → A* Rescheduler: runs rescheduling (evidence: `README.md`)
- A* Rescheduler → Schedule Validation: checks candidate (evidence: `app.py`)
- A* Rescheduler → Emergency Probability: uses probability (evidence: `README.md`)
- A* Rescheduler → Schedule Results: returns plan and trace (evidence: `README.md`)
- Streamlit Dashboard → Schedule Results: displays results (evidence: `README.md`)
