Skip to main content

Emotional Map Results

Get statistics and analysis of emotional map results.

Get Statistics

Generate comprehensive statistics and analysis of the user's emotional journey. This endpoint provides detailed insights including the predominant emotions, emotional trends over time, and visualizations through various charts. It also includes personalized course recommendations based on the emotional patterns identified.

Endpoint

  • Method: GET
  • URL: /api/emotional-map/{id}/result

URL Parameters

ParameterTypeRequiredDescription
idintegerYesThe subscription ID

Request Headers

HeaderValueRequired
Acceptapplication/jsonYes
AuthorizationBearer YOUR_API_TOKENYes

Success Response

{
"success": true,
"message": "تم جلب البيانات بنجاح",
"data": {
"general_emotion": "Happy",
"top_three_emotions": ["Joyful", "Excited", "Content"],
"logged_days": 30,
"main_emotions_pie_chart": [
{
"emotion": "Happy",
"percentage": 75,
"color": "#FFD700"
},
{
"emotion": "Sad",
"percentage": 15,
"color": "#4169E1"
}
],
"sub_emotions_pie_chart": [
{
"emotion": "Joyful",
"percentage": 40,
"color": "#FFA07A"
},
{
"emotion": "Excited",
"percentage": 35,
"color": "#98FB98"
}
],
"detailed_chart_data": [
{
"emotion": "Happy",
"color": "#FFD700",
"sub_emotions": [
{
"sub_emotion": "Joyful",
"percentage": 40,
"color": "#FFA07A"
},
{
"sub_emotion": "Excited",
"percentage": 35,
"color": "#98FB98"
}
]
}
],
"analysis_text": "Based on your emotional journey...",
"course_recommendation_text": "We recommend exploring...",
"course_url": "https://example.com/course/123"
},
"status_code": 200
}

Error Responses

Not Found (404)

{
"success": false,
"message": "لم يتم العثور على الاشتراك",
"data": null,
"status_code": 404
}

Incomplete Data (400)

{
"success": true,
"message": "لم يتم تحقيق الحد الأدنى من المتطلبات",
"data": {
"subscription_status": "failed"
},
"status_code": 400
}

Implementation Flow

  1. Subscription Verification:

    • Check if subscription exists and is completed
    • Verify subscription is active
    • Validate user has required permissions
  2. Data Analysis:

    • Calculate emotion percentages
    • Identify top emotions and trends
    • Generate chart data
    • Prepare course recommendations
  3. Response Formatting:

    • Format statistics and charts
    • Include analysis text
    • Handle threshold requirements