Skip to content

mubarakmarafa/student-response-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Student Response Simulator

A modern web application that generates realistic student responses to educational questions and provides AI-powered analysis to help educators understand learning patterns and misconceptions.

Features

πŸš€ Instant Demo Experience

  • Try Live Demo: One-click access to pre-made realistic student responses
  • Example Questions: 8 ready-to-use educational questions with demo responses
  • Professional Analysis Prompts: 10 research-based analysis templates organized by category

πŸ€– AI & Response Generation

  • Scalable Response Generation: Generate 1-50 student responses with multiple control options
  • Flexible Controls: Slider, quick-select buttons (3, 5, 8, 10, 15, 20), and manual input
  • Real AI Integration: Connect your OpenAI API key for genuine GPT-powered responses
  • Secure API Key Management: Browser-only storage with security warnings and best practices
  • Intelligent Fallback: Automatic fallback to sophisticated mock data if API calls fail
  • Smart Demo Enhancement: Automatically supplements demo responses with mock data for larger classes
  • Educational Focus: Specialized prompts designed for realistic student-like responses

πŸ“Š Analysis & Insights

  • Professional Analysis Framework: Research-based prompts for educational assessment
  • Visual Response Display: Color-coded responses with quality indicators and summary statistics
  • Comprehensive Analysis Categories:
    • πŸ” Insight & Summary (understanding assessment, misconception identification)
    • 🎯 Feedback & Grading (rubric scoring, personalized feedback, exemplar identification)
    • πŸš€ Extension & Strategy (follow-up questions, meta-cognitive analysis)
    • 🧰 Technical Analysis (language patterns, model comparison)

πŸ’» User Experience

  • Modern UI: Clean, responsive design built with Tailwind CSS
  • Scalable Controls: Multiple ways to select response count with visual feedback
  • Performance Indicators: Real-time estimates of generation speed
  • No Setup Required: Works immediately with sophisticated demo data
  • Smart Scaling: Demo responses automatically supplement with mock data for larger requests
  • Example Integration: Built-in example questions and responses for instant testing

Tech Stack

  • Frontend: Next.js 14 with React 18
  • Styling: Tailwind CSS
  • Language: TypeScript
  • Future Integration: OpenAI GPT API (ready for integration)

Getting Started

Prerequisites

  • Node.js 18+ installed
  • npm or yarn package manager

Installation

  1. Clone or download the project files

  2. Install dependencies:

    npm install
  3. Run the development server:

    npm run dev
  4. Open http://localhost:3000 in your browser

Usage

Basic Workflow

πŸš€ Quick Start - Try Instantly

  1. Click "Try Live Demo": Instantly see the app in action with pre-made student responses
  2. Explore Analysis Tools: Try the comprehensive educational analysis prompts
  3. No setup required: Works immediately without any API keys

πŸ“š Full Workflow

  1. Optional: Connect OpenAI API:
    • Add your OpenAI API key for real AI responses
    • Or skip this step to use sophisticated mock data
  2. Enter a Question: Type any educational question or use example questions
  3. Scale Response Count: Choose 1-50 responses using:
    • Visual Slider: Smooth control with live preview
    • Quick Buttons: Common class sizes (3, 5, 8, 10, 15, 20)
    • Manual Input: Type exact number (up to 50 students)
  4. Generate Responses: Click "Generate Student Responses" to create varied responses
  5. Review Responses: View the generated responses, color-coded by quality level:
    • 🟒 Strong responses (well-structured, comprehensive)
    • 🟑 Average responses (basic understanding, some gaps)
    • πŸ”΄ Weak responses (misconceptions, limited understanding)
  6. Analyze Responses: Use professional educational analysis prompts:
    • πŸ” Insight & Summary: Gauge overall comprehension and identify patterns
    • 🎯 Feedback & Grading: Generate rubric scores and personalized feedback
    • πŸš€ Extension & Strategy: Create follow-up questions and understand thinking patterns
    • 🧰 Technical Analysis: Analyze language patterns and compare to model answers

API Key Setup (Optional)

  1. Get an OpenAI API Key:

    • Visit OpenAI Platform
    • Sign up or log in to your account
    • Navigate to API Keys and create a new secret key
    • Copy the key (you won't see it again)
  2. Add to App:

    • Paste your API key in the secure input field at the top
    • The app will validate the key format and store it securely
    • Your key is only stored in your browser session

Pre-loaded Demo Content

Ready-to-use Questions:

  • "What is photosynthesis and why is it important for life on Earth?" (includes pre-made responses)
  • "Explain the water cycle in your own words"
  • "What causes the seasons on Earth?"
  • "How does gravity work and why don't we float away?"
  • "What is the difference between weather and climate?"
  • "Explain how plants get their energy to grow"
  • "Why do we have day and night?"
  • "What happens to water when it evaporates?"

Professional Analysis Prompts:

  • Insight & Summary: "Summarize the overall understanding students demonstrated"
  • Misconception Analysis: "What are the most common misconceptions or errors?"
  • Understanding Levels: "Cluster responses by correct, partial, and incorrect understanding"
  • Rubric Scoring: "Assign rubric scores (0-3) and explain reasoning"
  • Individual Feedback: "Generate personalized feedback for each student"
  • Exemplar Identification: "Which responses best exemplify strong answers?"
  • Follow-up Questions: "Suggest extension tasks to deepen thinking"
  • Meta-cognitive Analysis: "What do responses suggest about thinking strategies?"
  • Language Analysis: "What do frequently used words suggest about understanding?"
  • Model Comparison: "Compare responses to the model answer"

Project Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ globals.css          # Global styles with Tailwind
β”‚   β”œβ”€β”€ layout.tsx           # Root layout component
β”‚   └── page.tsx             # Main page component
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ QuestionInput.tsx    # Question input and response count selector
β”‚   β”œβ”€β”€ StudentResponsesList.tsx  # Display generated responses
β”‚   β”œβ”€β”€ AnalysisPanel.tsx    # Follow-up analysis interface
β”‚   └── ApiKeyInput.tsx      # Secure API key input component
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ types.ts             # TypeScript type definitions
β”‚   β”œβ”€β”€ mockData.ts          # Mock data generation functions
β”‚   └── openaiApi.ts         # OpenAI API integration and security utilities
└── README.md

Component Architecture

ApiKeyInput

  • Secure API key input with validation
  • Visual security warnings and best practices
  • Session-based storage management
  • Show/hide key toggle for security
  • Help documentation for getting API keys

QuestionInput

  • Handles question text input
  • Range slider for response count selection
  • Form validation and submission
  • Loading states with spinner

StudentResponsesList

  • Displays generated responses with quality indicators
  • Color-coded responses based on quality level
  • Response summary with counts by quality
  • Responsive layout

AnalysisPanel

  • Follow-up question input
  • Suggested question buttons for quick access
  • Analysis results display
  • Loading states for analysis

Dual Response System

Real OpenAI API Integration

When an API key is provided:

  • Single API Call Efficiency: Generates all student responses in one optimized call
  • Custom Educational Prompt: Uses specialized prompt designed for authentic student variety
  • Smart Quality Assessment: AI-generated responses automatically classified by quality
  • Real AI Analysis: GPT-powered analysis of student response patterns
  • Automatic Fallback: Falls back to mock data if API calls fail
  • Cost Optimized: Efficient token usage with dynamic response limits

Sophisticated Mock Data System

When no API key is provided:

  • Generates responses with realistic variation in quality
  • Distributes quality levels (30% strong, 40% average, 30% weak)
  • Customizes responses based on question content
  • Provides realistic analysis based on common educational patterns
  • Simulates API delays for realistic UX

Security & Privacy

API Key Security

Following industry best practices from Codefinity and Medium security guides:

  • Session Storage Only: API keys stored in browser sessionStorage (cleared when browser closes)
  • No Server Transmission: Keys never sent to our servers - all processing happens in your browser
  • Format Validation: Validates OpenAI API key format before acceptance
  • Security Warnings: Clear notifications about key handling best practices
  • Easy Key Management: Simple buttons to change or clear stored keys

Privacy Protection

  • No data collection or analytics
  • No server-side storage of questions or responses
  • All processing happens locally in your browser
  • API calls go directly from your browser to OpenAI

Future Enhancements

Planned Features

  • User authentication and saved sessions
  • Export functionality for responses and analysis
  • Advanced filtering and sorting options
  • Custom response templates
  • Batch question processing
  • Integration with learning management systems
  • Support for other AI providers (Anthropic, Google AI)
  • Cost tracking and usage analytics
  • Offline mode with enhanced mock data

Current Capabilities

βœ… Complete OpenAI Integration: Full GPT-3.5-turbo integration with secure key management
βœ… Scalable Response Generation: 1-50 student responses with multiple control options
βœ… Optimized API Usage: Single-call generation for speed and cost efficiency
βœ… Instant Demo Experience: Pre-loaded questions and responses for immediate testing
βœ… Professional Analysis Framework: 10 research-based educational analysis prompts
βœ… Smart Demo Enhancement: Automatically supplements demo data for larger classes
βœ… Intelligent Fallbacks: Automatic fallback to mock data if API fails
βœ… Security Best Practices: Industry-standard API key security implementation
βœ… Educational Focus: Custom prompts designed for authentic student variety
βœ… Smart Quality Classification: Automatic assessment of response quality levels
βœ… Error Handling: Comprehensive error handling and user feedback

Customization

Styling

  • Modify tailwind.config.js for custom design tokens
  • Update component classes for different color schemes
  • Customize responsive breakpoints

Mock Data

  • Edit lib/mockData.ts to adjust response templates
  • Modify quality distribution ratios
  • Add domain-specific response patterns

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

This project is for educational and demonstration purposes.


Note: This is currently a demo application using mock data. For production use, integrate with actual LLM APIs and implement proper authentication and data management systems.

About

AI-powered student response simulator for educators

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages