Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -349,92 +349,7 @@ def create_pdf_report(student_name, subject, time_period, metrics, strengths, im
|
|
349 |
doc.build(story)
|
350 |
|
351 |
return pdf_path
|
352 |
-
"""Main function to generate the complete student report"""
|
353 |
-
|
354 |
-
try:
|
355 |
-
# Parse input scores
|
356 |
-
quiz_scores = [float(x.strip()) for x in quiz_scores_str.split(',') if x.strip()]
|
357 |
-
assignment_scores = [float(x.strip()) for x in assignment_scores_str.split(',') if x.strip()]
|
358 |
-
|
359 |
-
# Validate scores
|
360 |
-
all_scores = quiz_scores + assignment_scores + [participation_score]
|
361 |
-
if any(score < 0 or score > 100 for score in all_scores):
|
362 |
-
return "Error: All scores must be between 0 and 100.", None
|
363 |
-
|
364 |
-
# Calculate metrics
|
365 |
-
metrics = calculate_metrics(quiz_scores, assignment_scores, participation_score)
|
366 |
-
metrics['participation'] = participation_score
|
367 |
-
|
368 |
-
# Analyze performance
|
369 |
-
strengths, improvements = analyze_performance(metrics, quiz_scores, assignment_scores)
|
370 |
-
|
371 |
-
# Generate AI insights
|
372 |
-
insights = generate_ai_insights(student_name, subject, metrics, strengths, improvements)
|
373 |
-
|
374 |
-
# Create visualization
|
375 |
-
chart = create_performance_chart(metrics)
|
376 |
-
|
377 |
-
# Generate report text
|
378 |
-
report = f"""
|
379 |
-
# π Student Performance Report
|
380 |
-
|
381 |
-
**Student Name:** {student_name}
|
382 |
-
**Subject:** {subject}
|
383 |
-
**Reporting Period:** {time_period}
|
384 |
-
**Generated Date:** {datetime.now().strftime('%B %d, %Y')}
|
385 |
-
|
386 |
-
---
|
387 |
-
|
388 |
-
## π Performance Summary
|
389 |
-
- **Overall Grade:** {metrics['grade']} ({metrics['overall_avg']}%)
|
390 |
-
- **Quiz Average:** {metrics['quiz_avg']}%
|
391 |
-
- **Assignment Average:** {metrics['assignment_avg']}%
|
392 |
-
- **Participation Score:** {participation_score}%
|
393 |
-
|
394 |
-
---
|
395 |
-
|
396 |
-
## β
Identified Strengths
|
397 |
-
"""
|
398 |
-
|
399 |
-
for i, strength in enumerate(strengths, 1):
|
400 |
-
report += f"{i}. **{strength.title()}**: Demonstrates consistent performance and understanding in this area.\n"
|
401 |
-
|
402 |
-
report += "\n## β οΈ Areas for Improvement\n"
|
403 |
-
|
404 |
-
for i, improvement in enumerate(improvements, 1):
|
405 |
-
report += f"{i}. **{improvement.title()}**: Focus area for enhanced learning outcomes.\n"
|
406 |
-
|
407 |
-
report += f"""
|
408 |
-
---
|
409 |
|
410 |
-
## π― Recommendations
|
411 |
-
|
412 |
-
"""
|
413 |
-
for i, rec in enumerate(insights['recommendations'], 1):
|
414 |
-
report += f"{i}. {rec}\n"
|
415 |
-
|
416 |
-
if additional_notes:
|
417 |
-
report += f"""
|
418 |
-
---
|
419 |
-
|
420 |
-
## π Additional Notes
|
421 |
-
{additional_notes}
|
422 |
-
"""
|
423 |
-
|
424 |
-
report += """
|
425 |
-
---
|
426 |
-
|
427 |
-
## π
Next Steps
|
428 |
-
- Review this report with student and parent/guardian
|
429 |
-
- Monitor progress on recommended improvement areas
|
430 |
-
- Schedule follow-up assessment in 2-3 weeks
|
431 |
-
- Continue building on identified strengths
|
432 |
-
|
433 |
-
---
|
434 |
-
|
435 |
-
*Report generated by Scoreazy AI Agent | Educational Technology Solutions*
|
436 |
-
"""
|
437 |
-
|
438 |
def generate_report(student_name, subject, quiz_scores_str, assignment_scores_str,
|
439 |
participation_score, time_period, additional_notes=""):
|
440 |
"""Main function to generate the complete student report"""
|
|
|
349 |
doc.build(story)
|
350 |
|
351 |
return pdf_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
def generate_report(student_name, subject, quiz_scores_str, assignment_scores_str,
|
354 |
participation_score, time_period, additional_notes=""):
|
355 |
"""Main function to generate the complete student report"""
|