Analytics & Reports

Generate detailed insights and reports with our analytics and data visualization APIs. Track performance trends, compare cohorts, and export data in multiple formats.

Generating a Report

javascript
// Generate a comprehensive school report
const report = await client.analytics.report({
  school_id: 'sch_abc123',
  type: 'comprehensive',
  period: 'term',
  compare_to: 'previous_term',
  sections: [
    'enrollment',
    'performance',
    'attendance',
    'engagement',
    'subject_breakdown'
  ],
  format: 'json'
});

console.log(report.highlights);
// [
//   "Overall performance improved by 4.3%",
//   "Attendance rate at 94% (target: 95%)",
//   "Mathematics saw the highest improvement (+8.2%)"
// ]

Endpoints

GET /v1/analytics/overview

High-level dashboard metrics for a school — enrollment, performance averages, attendance rates, and engagement scores.

Query Parameters

  • school_id string required
  • period string - Time period (week, month, term, year)
GET /v1/analytics/performance

Detailed performance analytics with breakdowns by subject, grade, class, or teacher.

Query Parameters

  • school_id string required
  • group_by string - Grouping dimension (subject, grade, class, teacher)
  • sort_by string - Sort metric (score, improvement, students)
  • period string - Time period
response
{
  "school_id": "sch_abc123",
  "period": "term",
  "group_by": "subject",
  "data": [
    {
      "subject": "mathematics",
      "avg_score": 82.1,
      "median_score": 84,
      "pass_rate": 0.91,
      "total_students": 320,
      "improvement": "+8.2%",
      "score_distribution": {
        "A": 45, "B": 112, "C": 98, "D": 42, "F": 23
      }
    },
    {
      "subject": "english",
      "avg_score": 77.8,
      "median_score": 79,
      "pass_rate": 0.87,
      "total_students": 318,
      "improvement": "+2.1%",
      "score_distribution": {
        "A": 32, "B": 95, "C": 118, "D": 51, "F": 22
      }
    }
  ]
}
POST /v1/analytics/report

Generate a custom report with selected sections and export format.

Request Body

  • school_id string required
  • type string - Report type (performance, attendance, engagement, comprehensive)
  • period string - Time period
  • compare_to string - Comparison period
  • sections string[] - Sections to include
  • format string - Output format (json, csv, pdf)
GET /v1/analytics/trends

Time-series data for charting performance, attendance, or engagement trends over time.

Query Parameters

  • school_id string required
  • metric string - Metric to track (avg_score, attendance, engagement, enrollment)
  • granularity string - Data point frequency (daily, weekly, monthly)
  • date_from string - Start date (ISO 8601)
  • date_to string - End date (ISO 8601)
GET /v1/analytics/cohort

Compare performance across student cohorts — by grade, enrollment year, or custom groups.

Export Formats

json Structured data for programmatic consumption and dashboards
csv Spreadsheet-compatible format for Excel, Google Sheets, etc.
pdf Formatted report with charts and tables, ready to print or share