File size: 10,094 Bytes
2fe573b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
---

title: TalimBot
emoji: πŸŽ“
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
license: mit
---


# TalimBot - AI-Powered Student Grouping System

An intelligent educational platform that uses advanced psychology principles and AI to create optimal learning groups for adolescent students (ages 15-16).

## Overview

TalimBot is a comprehensive web-based system designed to help teachers form balanced, effective study groups by analyzing student personalities, learning styles, academic motivation, and cooperative skills. The system uses OpenAI's GPT-4o to create groups that maximize learning potential through Zone of Proximal Development (ZPD) theory and complementary personality matching.

## Key Features

### For Teachers
- **AI-Powered Grouping**: Automated group formation using educational psychology principles
- **Multi-Factor Analysis**: Considers 7 key criteria with weighted priorities:
  - ZPD Optimization (30%) - Grade-based peer tutoring scaffolding
  - MBTI Complementarity (25%) - Personality type balance
  - VARK Diversity (20%) - Learning style variety
  - Academic Motivation (15%) - AMS score distribution
  - Cooperative Skills (10%) - Teamwork ability balance
  - Course-Specific Requirements
  - Student Preferences (5%)
- **Real-time Dashboard**: Monitor student profile completion and grouping status
- **Data Management**: Import/export student data via JSON, fill test data
- **Result Control**: Show/hide grouping results to students
- **Flexible Reset Options**: 
  - Reset grouping only (preserve student data)
  - Reset all data (complete system reset)

### For Students
- **Profile Management**: Complete personality and learning assessments
- **Integrated Tests**: 
  - MBTI personality test (16 types)
  - VARK learning style questionnaire (Visual, Aural, Read/Write, Kinesthetic)
  - AMS academic motivation scale (28 questions, 0-196 score)
  - Cooperative learning skills assessment (25 questions, 0-125 score)
- **Peer Preferences**: Select up to 4 preferred groupmates
- **Group View**: See assigned group members and AI reasoning (when visible)
- **Progress Tracking**: Monitor test completion status

## Technical Architecture

### Backend
- **Framework**: FastAPI (Python)
- **Database**: JSON file-based storage (students.json)
- **AI Integration**: OpenRouter API with GPT-4o model
- **Authentication**: Password-based teacher authentication, national code verification for students

### Frontend
- **UI Framework**: Tailwind CSS
- **Language Support**: Persian (RTL layout) with Vazirmatn font
- **Pages**:
  - Login page (student/teacher authentication)
  - Student dashboard (profile management, tests)
  - Teacher dashboard (grouping management, analytics)
  - Group view (display assigned groups)
  - AMS questionnaire (academic motivation assessment)
  - Cooperative questionnaire (teamwork skills assessment)

### Deployment
- **Platform**: Railway.app
- **Server**: Uvicorn ASGI server
- **Static Files**: Served via FastAPI StaticFiles
- **Environment Variables**: OPENROUTER_API_KEY

## Project Structure

```

talimbot/

β”œβ”€β”€ backend/

β”‚   β”œβ”€β”€ main.py                 # FastAPI application and API endpoints

β”‚   β”œβ”€β”€ grouping_logic.py       # AI grouping algorithm

β”‚   β”œβ”€β”€ data/

β”‚   β”‚   β”œβ”€β”€ students.json       # Student data (gitignored)

β”‚   β”‚   └── students.json.backup # Clean backup template

β”‚   └── static/

β”‚       β”œβ”€β”€ pages/              # HTML pages

β”‚       β”‚   β”œβ”€β”€ login.html

β”‚       β”‚   β”œβ”€β”€ student-dashboard.html

β”‚       β”‚   β”œβ”€β”€ teacher-dashboard.html

β”‚       β”‚   β”œβ”€β”€ group-view.html

β”‚       β”‚   β”œβ”€β”€ ams-questionnaire.html

β”‚       β”‚   β”œβ”€β”€ cooperative-questionnaire.html

β”‚       β”‚   └── student-data.html

β”‚       β”œβ”€β”€ assets/

β”‚       β”‚   β”œβ”€β”€ js/

β”‚       β”‚   β”‚   β”œβ”€β”€ data.js     # API client functions

β”‚       β”‚   β”‚   └── grouping.js # Grouping utilities

β”‚       β”‚   └── css/

β”‚       β”‚       └── styles.css  # Custom styles

β”‚       └── index.html          # Landing page

β”œβ”€β”€ resources_references/        # Documentation and reference files

β”‚   β”œβ”€β”€ RAILWAY_DEPLOYMENT.md   # Deployment guide

β”‚   β”œβ”€β”€ TEST_RESULTS_AND_SOLUTION.md

β”‚   β”œβ”€β”€ angizesh_tahsili.txt    # AMS questionnaire source

β”‚   β”œβ”€β”€ cooperative.txt         # Cooperative questionnaire source

β”‚   β”œβ”€β”€ students_class_notebook.txt # Original student data

β”‚   └── sample-student-data.json # JSON import example

β”œβ”€β”€ requirements.txt            # Python dependencies

β”œβ”€β”€ runtime.txt                 # Python version for Railway

β”œβ”€β”€ Procfile                    # Railway start command

└── .gitignore                  # Git ignore rules



```

## Installation and Setup

### Prerequisites
- Python 3.11+
- OpenRouter API key (get from https://openrouter.ai/keys)

### Local Development

1. Clone the repository:
```bash

git clone https://github.com/talimbot/talimbot.git

cd talimbot

```

2. Install dependencies:
```bash

pip install -r requirements.txt

```

3. Set environment variable:
```bash

# Windows PowerShell

$env:OPENROUTER_API_KEY="your-api-key-here"



# Linux/Mac

export OPENROUTER_API_KEY="your-api-key-here"

```

4. Run the server:
```bash

cd backend

uvicorn main:app --reload --host 0.0.0.0 --port 8000

```

5. Access the application:
```

http://localhost:8000

```

### Railway Deployment

1. Fork this repository to your GitHub account

2. Create a new project on Railway.app

3. Connect your GitHub repository

4. Add environment variable in Railway dashboard:
   - Key: `OPENROUTER_API_KEY`
   - Value: Your OpenRouter API key

5. Railway will auto-deploy using the Procfile

## Usage Guide

### Teacher Workflow

1. **Login**: Access teacher dashboard with password (default: teacher123)

2. **Monitor Students**: View student profile completion status

3. **Fill Test Data** (Optional): Use the test data generator to fill 10 sample students for testing

4. **Import Data** (Optional): Upload JSON file with student information

5. **Perform Grouping**:
   - Enter course name
   - Click "Start Grouping" button
   - Wait for AI processing (30-60 seconds)
   - Review generated groups with detailed reasoning

6. **Show Results**: Toggle result visibility to allow students to view their groups

7. **Reset Options**:
   - Reset Grouping: Clear groups, keep student data
   - Reset All Data: Complete system wipe

### Student Workflow

1. **Login**: Enter student number (S001-S030) and national code

2. **Complete Profile**:
   - Take MBTI personality test (external link)
   - Complete VARK learning style questionnaire
   - Fill AMS academic motivation scale (28 questions)
   - Complete cooperative skills assessment (25 questions)
   - Select up to 4 preferred groupmates (optional)

3. **Save Information**: Click "Save All Information" button

4. **View Group**: Access group view page to see assigned group (when teacher makes it visible)

## Grouping Algorithm

The AI grouping system follows a sophisticated 7-tier priority framework:

1. **ZPD Optimization (30%)**: Mixes high and medium performers for peer tutoring
2. **MBTI Complementarity (25%)**: Pairs complementary personality types (e.g., ENFP+INTJ)
3. **VARK Diversity (20%)**: Ensures multiple learning styles in each group
4. **Academic Motivation (15%)**: Distributes high-motivation students across groups
5. **Cooperative Skills (10%)**: Balances teamwork abilities
6. **Course-Specific Requirements**: Adapts to subject matter needs
7. **Student Preferences (5%)**: Honors preferences when they don't compromise other criteria

Groups are typically 5 students each, with some groups of 4 to avoid very small groups.

## Data Structure

### Student Object
```json

{

  "studentNumber": "S001",

  "name": "Student Name",

  "nationalCode": "1234567890",

  "mbti": "INTJ",

  "learningStyle": "Visual",

  "ams": "150",

  "cooperative": "95",

  "grade": 18.5,

  "preferredStudents": ["S002", "S003"],

  "group": 1

}

```

## API Endpoints

- `GET /api/students` - Get all students
- `GET /api/student/{student_number}` - Get specific student
- `PUT /api/student/{student_number}` - Update student data
- `POST /api/grouping/perform` - Execute AI grouping
- `GET /api/grouping/status` - Get grouping statistics
- `POST /api/grouping/reset` - Reset grouping only
- `POST /api/data/reset-all` - Reset all data
- `POST /api/grouping/toggle-visibility` - Show/hide results
- `POST /api/auth/teacher` - Verify teacher password
- `POST /api/auth/student` - Authenticate student
- `GET /api/student/{student_number}/group` - Get student's group

## Security Notes

- Student data stored in students.json (excluded from version control)
- Teacher password: "teacher123" (change in production)
- National codes used for student authentication
- API key required for AI grouping functionality

## Educational Foundation

This system is based on:
- **Vygotsky's Zone of Proximal Development (ZPD)**: Optimal learning occurs when students work slightly above their current level with peer support
- **MBTI Complementarity Research**: Diverse personality types enhance team creativity and problem-solving
- **VARK Learning Theory**: Multiple learning styles improve knowledge retention
- **Academic Motivation Scale (AMS)**: Measures intrinsic and extrinsic motivation factors
- **Cooperative Learning Principles**: Teamwork skills are essential for collaborative success

## License

This project is for educational purposes.

## Contributors

Developed for educational psychology research and classroom implementation.

## Support

For issues or questions, please refer to the documentation in the `resources_references/` folder.