The StudentActivityTrackingPage class provides a comprehensive dashboard for monitoring individual student progress, combining behavioral observations with academic performance tracking. It serves as a detailed profile view for educators to track learning activities, behavioral patterns, and academic achievements in a unified interface. The page integrates multiple data visualization components including line charts, donut charts, and pie charts to provide actionable insights into student development.
This specialized widget implements a dual-view architecture with a stacked widget system that toggles between behavioral observations and educational activities. It features real-time data processing, interactive charts, and inline editing capabilities for both behavioral notes and academic assignments, creating a complete student progress monitoring solution.
The StudentActivityTrackingPage is a PySide6 widget designed for comprehensive student progress monitoring. It combines student information display, behavioral observation tracking, and educational activity management in a single interface with advanced data visualization.
QGridLayout (5x6) containing student information, photo, and three chart visualizations. Shows cumulative score, average score, and activity status distribution.
StackedWidget with two pages: behavioral observations list and educational activities list. Uses navigation buttons to toggle between views.
Integrates with analysis module to generate line charts, donut charts, and pie charts from student performance data using Matplotlib/Plotly.
The page uses a dual-view system with smooth transitions:
Right-aligned action buttons provide quick access to key functions:
| Button | Icon | Tooltip | Function |
|---|---|---|---|
| Export Menu | 📋 | Export data | Dropdown with export options (currently disabled) |
| Add Note | ✏️ | Add new behaviour note | Opens dialog to add behavioral observation |
| New Edu-Item | 📐 | New Edu-Item | Opens educational resources view for assignment |
Purpose: Track score changes over time
Data: Reversed score progression list
Size: 283x170 pixels
Tooltip: "Changes in scores obtained so far."
Purpose: Show overall performance (20-point scale)
Calculation: earned_score/total_score × 20
Size: 140x140 pixels
Tooltip: "Cumulative score: The sum of all scores..."
Purpose: Visualize activity completion status
Categories: Replied, Waiting, Delayed, Lost
Size: 145x140 pixels
Tooltip: From app_context.ToolTips['Activity status']
The system classifies educational activities into four status categories:
| Status | Condition | Score Impact | Color Coding |
|---|---|---|---|
| Replied | Answer submitted before deadline | Full/partial score counted | Green (success) |
| Waiting | Not replied, deadline not passed | Not yet evaluated | Blue (pending) |
| Delayed | Answer submitted after deadline | Score counted (may be penalized) | Orange (warning) |
| Lost | Not replied, deadline passed | Zero score assigned | Red (failure) |
Behavioral observations are stored with the following structure:
Each observation is displayed in a custom widget with editing capabilities:
add_behaviour_note()Opens a dialog for adding new observations with separate fields for behavior description and teacher analysis.
edit_behaviour_note()Allows inline editing of existing observations through context menu action.
delete_behaviour_note()Includes confirmation dialog before removal to prevent accidental deletion.
[WORKFLOW DIAGRAM: Showing observation lifecycle:
1. Teacher observes behavior → 2. Opens add dialog → 3. Enters observation + analysis
4. Saves to database → 5. Appears in list → 6. Can edit/update later → 7. Optional deletion
With real-time updates and user notifications at each step]
Educational activities (quests) are linked to educational resources:
Each activity is displayed using a specialized widget with rich functionality:
The system implements sophisticated status determination logic:
The system extracts HTML body content for display in widgets:
| Method | Purpose | Complexity | Key Operations |
|---|---|---|---|
__init__(student) |
Constructor, stores student data | O(1) | Student data assignment, UI initialization |
initUI() |
Main UI construction | O(1) | Layout creation, widget assembly, signal connections |
init_StudentInfoUI() |
Student header creation | O(1) | Grid layout, photo display, info labels |
| Method | Data Source | Performance | Output |
|---|---|---|---|
load_behav_data() |
observed_behaviours table | O(n) + widget creation | Populated QListWidget with observation widgets |
load_quests_data() |
quests + educational_resources JOIN | O(n) + complex calculations | Populated QListWidget, returns scores and status counts |
___create_observed_note_widget() |
Individual observation record | O(1) per widget | Custom widget for display and editing |
create_charts() - Visualization AssemblyIntegrates multiple chart types into the header layout:
assign_edu_to_student() - Navigation IntegrationConnects to the main application window to open educational resource assignment:
| Table | Primary Key | Fields Used | Relationship Type |
|---|---|---|---|
observed_behaviours |
Id | 4 fields (Id, date_time_, observed_behaviour_, analysis_) | One-to-many with personal_info |
quests |
id | 9 fields including scores, dates, and content | Many-to-one with educational_resources |
educational_resources |
id | content_description_ (via JOIN) | Parent of quests (qb_id foreign key) |
personal_info |
Id | Student[0-12] tuple fields | Parent of observed_behaviours and quests |
Simple SELECT with filtering and ordering:
Complex LEFT JOIN with proper parameterization:
The class implements proper error handling for database operations:
Issue: Each observation creates 5+ widgets (QLabels, QPlainTextEdit, QPushButton)
Impact: Linear memory growth with observation count
Solution: Implement pagination or virtual scrolling
Issue: EduItemStudentWidget is complex with HTML content
Impact: High per-item memory consumption
Solution: Lazy loading of HTML content
Issue: Three chart images stored as QPixmap in memory
Impact: Fixed ~500KB memory usage
Solution: Already optimized with fixed sizes
| Operation | Method | Complexity | Bottleneck | Optimization Potential |
|---|---|---|---|---|
| Initial data load | load_quests_data() |
O(n) + O(n × w) | Widget creation for each activity | High - Virtual scrolling |
| Status calculation | Loop in load_quests_data() |
O(n) | Date comparisons and conditionals | Low - Already efficient |
| Chart generation | create_charts() |
O(1) + image processing | External chart library overhead | Medium - Cache charts |
| Observation loading | load_behav_data() |
O(n) + O(n × w) | Widget creation per observation | High - Deferred rendering |
[PERFORMANCE CHART: Showing execution time vs data volume for:
• Initial Page Load • Chart Generation • Observation Loading • Activity Loading
Highlighting memory usage patterns and CPU utilization peaks]
| Method | Parameters | Return | Description | Thread Safety |
|---|---|---|---|---|
__init__(student) |
student: tuple | None | Constructor with student data | UI thread only |
add_behaviour_note(data) |
data: tuple or None | None | Opens dialog to add behavioral observation | UI thread only |
edit_behaviour_note() |
record_id, behaviour_widget, analysis_widget | None | Updates existing observation | UI thread only |
delete_behaviour_note() |
record_Id, record_index | None | Deletes observation after confirmation | UI thread only |
assign_edu_to_student(stu) |
stu: dict | None | Navigates to educational resource assignment | UI thread only |
load_behav_data() |
None | None | Loads behavioral observations from database | UI thread only |
load_quests_data() |
None | tuple: (scaled_score, scores, items_status) | Loads educational activities and calculates metrics | UI thread only |
| Signal Source | Signal | Slot/Method | Purpose |
|---|---|---|---|
| Left navigation button | clicked | stacked_widget.go_back | Shows behavioral observations page |
| Right navigation button | clicked | stacked_widget.go_next | Shows educational activities page |
| Add note button | clicked | add_behaviour_note | Opens behavior note dialog |
| New Edu-Item button | clicked | assign_edu_to_student | Opens educational resources view |
| EduItemStudentWidget | data_updated | PopupNotifier.Notify | Shows update notifications |
| EduItemStudentWidget | delete_executed | Item removal + notification | Handles activity deletion |
bytea_to_pixmap() for photo conversionlocal_culture_digits() for number formatting[DEPENDENCY GRAPH: Visual representation showing:
Core Qt Dependencies → Custom UI Framework → Data Processing Modules →
Database Layer → Visualization Engine → External Widget Libraries
With arrows indicating import relationships and usage frequency]