Overview

The Data Analyst component is an AI-powered chatbot designed specifically for educators. It provides intelligent insights into student engagement, performance metrics, and learning patterns. Educators can ask natural language questions about their students’ study habits, identify areas where students may need additional support, and receive personalized recommendations to improve learning outcomes.

Creating a Data Analyst Component

import StudyfetchSDK from '@studyfetch/sdk';

const client = new StudyfetchSDK({
  apiKey: 'your-api-key',
  baseURL: 'https://studyfetchapi.com',
});

const dataAnalystComponent = await client.v1.components.create({
  name: 'Student Performance Analyst',
  type: 'data-analyst',
  config: {
    materials: ['mat-123', 'mat-456'], // Course materials with student activity data
    folders: ['folder-789'],
    model: 'gpt-4o-mini-2024-07-18',
    systemPrompt: 'You are an AI assistant for educators. Help analyze student usage patterns, performance metrics, and provide actionable recommendations to improve learning outcomes. Focus on identifying struggling students, engagement trends, and suggesting personalized interventions.',
    temperature: 0.3, // Lower temperature for more precise analysis
    maxTokens: 4096
  }
});

console.log('Data Analyst component created:', dataAnalystComponent._id);

Configuration Parameters

name
string
required
Name of the data analyst component
type
string
required
Must be "data-analyst"
config
object
required
Data analyst configuration object

Response

{
  "_id": "comp_abc123",
  "name": "Student Performance Analyst",
  "type": "data_analyst",
  "status": "active",
  "config": {
    "materials": ["mat-123", "mat-456"],
    "folders": ["folder-789"],
    "model": "gpt-4o-mini-2024-07-18",
    "systemPrompt": "You are an AI assistant for educators. Help analyze student usage patterns, performance metrics, and provide actionable recommendations to improve learning outcomes. Focus on identifying struggling students, engagement trends, and suggesting personalized interventions.",
    "temperature": 0.3,
    "maxTokens": 4096
  },
  "createdAt": "2024-01-15T10:00:00Z",
  "updatedAt": "2024-01-15T10:00:00Z",
  "organizationId": "org_456def",
  "statistics": {
    "totalSessions": 0,
    "totalAnalyses": 0,
    "averageSessionDuration": null
  }
}

Embedding This Component

Once you’ve created a Data Analyst component, you can embed it on your website using the embedding API.

Generate Embed URL

const embedResponse = await client.v1.components.generateEmbed(dataAnalystComponent._id, {
  // User tracking
  userId: 'user-456',
  groupIds: ['class-101', 'class-102'],
  sessionId: 'session-789',
  
  // Dimensions
  width: '100%',
  height: '700px',
  
  // Token expiry
  expiryHours: 24
});

Embed in Your HTML

<iframe 
  src="https://embed.studyfetch.com/component/comp_abc123?token=..."
  width="100%"
  height="700px"
  frameborder="0"
  allow="clipboard-write"
  style="border: 1px solid #e5e5e5; border-radius: 8px;">
</iframe>