Skip to main content

Cognitive Assessment API

Overview

API endpoints for managing cognitive assessment results, specifically for HK-MoCA (Hong Kong Montreal Cognitive Assessment) screening tool results.

Endpoints

MethodEndpointDescription
GET/api/cognitive-assessment-resultsGet all cognitive assessment results for a client/user
GET/api/cognitive-assessment-results/[cognitiveAssessmentResultId]Get a specific cognitive assessment result by ID
GET/api/client/[clientId]/analytics/player/[uid]/cognitive-assessment-historyGet cognitive assessment history for a specific player

GET /api/cognitive-assessment-results

Get all cognitive assessment results for a specific user or client.

Query Parameters

ParameterTypeRequiredDescription
clientIdstringOptionalFilter by client ID
userIdstringOptionalFilter by user ID

Headers

  • Authorization: Bearer <JWT>

Response

  • 200 OK:
{
"data": [
{
"id": "string",
"clientId": "string",
"userId": "string",
"createdAt": "2025-01-15T10:30:00Z",
"assessmentType": "HK-MoCA",
"rawScore": 28,
"educationAdjustment": 0,
"totalScore": 28,
"percentile": 75,
"interpretation": "Normal",
"riskLevel": "LOW",
"domainScores": [
{
"domain": "Immediate Memory",
"score": 5,
"maxScore": 5,
"percentage": 100
},
{
"domain": "Language Fluency",
"score": 8,
"maxScore": 9,
"percentage": 89
},
{
"domain": "Orientation",
"score": 6,
"maxScore": 6,
"percentage": 100
},
{
"domain": "Delayed Recall",
"score": 9,
"maxScore": 10,
"percentage": 90
}
],
"patientInfo": {
"age": 38,
"gender": "FEMALE",
"educationYears": 12
},
"notes": "Patient performed well across all domains"
}
],
"count": 1
}
  • 401 Unauthorized: { error: string }
  • 500 Internal Server Error: { error: string }

GET /api/cognitive-assessment-results/[cognitiveAssessmentResultId]

Get a specific cognitive assessment result by ID.

Path Parameters

ParameterTypeRequiredDescription
cognitiveAssessmentResultIdstringYesThe unique assessment result ID

Headers

  • Authorization: Bearer <JWT>

Response

  • 200 OK:
{
"data": {
"id": "string",
"clientId": "string",
"userId": "string",
"createdAt": "2025-01-15T10:30:00Z",
"assessmentType": "HK-MoCA",
"rawScore": 28,
"educationAdjustment": 0,
"totalScore": 28,
"percentile": 75,
"interpretation": "Normal",
"riskLevel": "LOW",
"domainScores": [
{
"domain": "Immediate Memory",
"score": 5,
"maxScore": 5,
"percentage": 100
}
],
"patientInfo": {
"age": 38,
"gender": "FEMALE",
"educationYears": 12
}
}
}
  • 401 Unauthorized: { error: string }
  • 404 Not Found: { error: string }
  • 500 Internal Server Error: { error: string }

GET /api/client/[clientId]/analytics/player/[uid]/cognitive-assessment-history

Get cognitive assessment history for a specific player.

Path Parameters

ParameterTypeRequiredDescription
clientIdstringYesThe client ID
uidstringYesThe player's UID

Headers

  • ClientToken: <client_token> OR
  • Authorization: Bearer <firebase_id_token>

Response

  • 200 OK:
{
"success": true,
"assessmentHistory": [
{
"id": "string",
"createdAt": "2025-01-15T10:30:00Z",
"assessmentType": "HK-MoCA",
"rawScore": 28,
"educationAdjustment": 0,
"totalScore": 28,
"percentile": 75,
"interpretation": "Normal",
"interpretationText": "正常",
"riskLevel": "LOW",
"riskLevelText": "低風險",
"domainScores": [
{
"domain": "Immediate Memory",
"score": 5,
"maxScore": 5,
"percentage": 100
}
],
"fullAssessmentDetails": {}
}
],
"total": 1
}
  • 401 Unauthorized: { error: string }
  • 404 Not Found: { error: string }
  • 500 Internal Server Error: { error: string }

Data Models

CognitiveAssessmentResult

FieldTypeDescription
idstringUnique identifier
clientIdstringClient ID
userIdstringUser ID
createdAtstring (ISO date)Assessment date
assessmentTypestringType of assessment (default: "HK-MoCA")
rawScorenumberRaw score (0-30)
educationAdjustmentnumberEducation adjustment points
totalScorenumberTotal score after adjustment
percentilenumber (optional)Percentile ranking
interpretationstring"Normal" | "Mild" | "Moderate" | "Severe"
riskLevelstring (optional)"LOW" | "INTERMEDIATE" | "HIGH"
domainScoresDomainScore[]Array of domain-specific scores
patientInfoPatientInfo (optional)Patient information
notesstring (optional)Additional notes
metadataobject (optional)Assessment metadata

CognitiveAssessmentDomainScore

FieldTypeDescription
domainstringDomain name (e.g., "Immediate Memory")
scorenumberScore achieved
maxScorenumberMaximum possible score
percentagenumberPercentage score (0-100)

PatientInfo

FieldTypeDescription
agenumberPatient's age
genderstring"MALE" | "FEMALE" | "OTHER" | "UNSPECIFIED"
educationYearsnumberYears of education

Risk Level Interpretation

Risk LevelDescription
LOWNormal cognitive function
INTERMEDIATEMild cognitive impairment, monitoring recommended
HIGHSignificant cognitive impairment, further evaluation needed

Authentication

All endpoints require Firebase authentication via Bearer token in the Authorization header or ClientToken for admin operations.


Error Responses

Status CodeDescription
401Unauthorized
404Not found
500Internal server error