How I'm Tracking Student Performance in My AIcademy
Posted on April 21, 2025 · Tags: AI, EdTech, Data Analytics
In my AI-powered tutor project, I'm building a system to detect correct answers, track how many attempts a student takes, and assign XP accordingly. This lays the groundwork for future student performance analytics — helping teachers and guardians better understand how students are learning over time.
Below is a code snippet showing how I log each answer attempt with event listeners, and assign XP based on correctness and number of attempts:
useEffect(() => {
const handleAnswerAttempt = (e: Event) => {
const customEvent = e as CustomEvent<{
subject: Subject
correct: boolean
attempts: number
}>
const { subject, correct, attempts } = customEvent.detail
let xpEarned = 2
if (correct && attempts === 1) xpEarned = 10
else if (correct && attempts <= 2) xpEarned = 7
else if (correct) xpEarned = 5
else xpEarned = 1
setXpPoints((prev) => {
const newXp = prev + xpEarned
updateXpInDatabase(newXp)
return newXp
})
console.log(`Answer attempt:`, { subject, correct, attempts, xpEarned })
}
window.addEventListener("answer-attempt", handleAnswerAttempt)
return () => window.removeEventListener("answer-attempt", handleAnswerAttempt)
}, [activeSubject])This is just the beginning. Eventually, this data will feed into personalized charts showing student growth, question difficulty trends, and subject-specific strengths. I'm also planning a teacher dashboard to surface this data in a meaningful, digestible way.