Update API documentation with dashboard_single endpoint

Added from code analysis (services/api.ts, types/index.ts):
- NEW: dashboard_single API with full request/response structure
- Updated voice_ask with complete ChatResponse (Command, body, language)
- Updated deployment_ids with clearer explanation
- Added mobile_data_model card with Beneficiary interface
- Updated integration_notes with native API flow
- Added new connections between API endpoints

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Sergei 2025-12-12 16:06:49 -08:00
parent 24babce3c8
commit b5117943bf

View File

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"name": "ENV and existing API", "name": "ENV and existing API",
"updatedAt": "2025-12-12T21:35:27.543Z" "updatedAt": "2025-12-13T00:30:00.000Z"
}, },
"elements": [ "elements": [
{ {
@ -42,6 +42,19 @@
"x": 513.6377563476562, "x": 513.6377563476562,
"y": 98.70745849609375 "y": 98.70745849609375
}, },
{
"id": "api_dashboard_single",
"type": "card",
"title": "Patient Dashboard API ✓",
"borderColor": "green",
"tags": [
"backend",
"verified"
],
"description": "function=dashboard_single\n\nRequest:\n- user_name: string\n- token: string (JWT from auth)\n- deployment_id: string (patient ID from privileges)\n- date: string (YYYY-MM-DD format)\n- nonce: string (random)\n\nResponse:\n{\n \"result_list\": [{\n \"user_id\": number,\n \"name\": string,\n \"address\": string,\n \"time_zone\": string,\n \"picture\": string (URL),\n \"deployment_id\": string,\n \"wellness_score_percent\": number (0-100),\n \"wellness_descriptor\": string,\n \"wellness_descriptor_color\": string,\n \"last_location\": string (room name),\n \"last_detected_time\": string (ISO date),\n \"before_last_location\": string,\n \"temperature\": number,\n \"bedroom_temperature\": number,\n \"sleep_hours\": number,\n \"units\": string,\n \"location_list\": string[]\n }],\n \"status\": \"200 OK\"\n}\n\nUsed for: Main patient monitoring dashboard",
"x": 520,
"y": 250
},
{ {
"id": "api_voice_ask", "id": "api_voice_ask",
"type": "card", "type": "card",
@ -51,9 +64,9 @@
"backend", "backend",
"verified" "verified"
], ],
"description": "function=voice_ask\n\nRequest:\n- clientId: string (e.g. \"MA_001\")\n- user_name: string\n- token: string (JWT from auth)\n- question: string (e.g. \"how is dad doing\")\n- deployment_id: number (e.g. 21)\n\nResponse:\n{\n \"ok\": true,\n \"response\": { \"body\": \"AI response text\" }\n}", "description": "function=voice_ask\n\nRequest:\n- clientId: string (e.g. \"MA_001\")\n- user_name: string\n- token: string (JWT from auth)\n- question: string (e.g. \"how is dad doing\")\n- deployment_id: string (patient ID)\n\nResponse:\n{\n \"ok\": true,\n \"response\": {\n \"Command\": string,\n \"body\": string (AI response text),\n \"language\": string\n },\n \"status\": \"200 OK\"\n}\n\nUsed for: AI assistant chat about patient status",
"x": 520, "x": 520,
"y": 250 "y": 400
}, },
{ {
"id": "api_location_map", "id": "api_location_map",
@ -102,9 +115,9 @@
"tags": [ "tags": [
"backend" "backend"
], ],
"description": "Token Format: JWT (HS256)\n\nPayload:\n{\n \"username\": \"anandk\",\n \"exp\": 1765661023 (Unix timestamp)\n}\n\nExpiration: ~7 days\nStorage: localStorage.auth2 (web)\n\nUsage: Include in all API requests as 'token' param", "description": "Token Format: JWT (HS256)\n\nPayload:\n{\n \"username\": \"anandk\",\n \"exp\": 1765661023 (Unix timestamp)\n}\n\nExpiration: ~7 days\nStorage: localStorage.auth2 (web)\nMobile: expo-secure-store\n\nUsage: Include in all API requests as 'token' param\nRequired for: dashboard_single, voice_ask",
"x": 520, "x": 520,
"y": 422.5 "y": 550
}, },
{ {
"id": "dashboard_features", "id": "dashboard_features",
@ -172,15 +185,29 @@
{ {
"id": "deployment_ids", "id": "deployment_ids",
"type": "card", "type": "card",
"title": "Deployment IDs", "title": "Deployment IDs (Patient IDs)",
"borderColor": "teal", "borderColor": "teal",
"tags": [ "tags": [
"backend" "backend",
"verified"
], ],
"description": "Known deployment_id values:\n\n- 21: AI Assistant deployment\n\nUsed in: voice_ask function\nPurpose: Routes to specific AI model/config\n\nPrivileges contain: 21,38,29,41,42\n(21 appears to match deployment)", "description": "What are Deployment IDs?\n\nDeployment ID = Patient ID = Beneficiary ID\nEach elderly person being monitored has unique ID.\n\nHow they work:\n- User logs in → gets 'privileges' string\n- Privileges = comma-separated deployment_ids\n- Example: \"21,38,29,41,42\" = 5 patients\n\nUsage:\n- dashboard_single: Get patient's wellness data\n- voice_ask: Ask AI about specific patient\n\nIn mobile app:\n- Loop through privileges.split(',')\n- Call dashboard_single for each ID\n- Display patient cards with wellness info",
"x": 900, "x": 900,
"y": 480 "y": 480
}, },
{
"id": "mobile_data_model",
"type": "card",
"title": "Mobile App Data Model",
"borderColor": "green",
"tags": [
"frontend",
"verified"
],
"description": "Beneficiary Interface (TypeScript):\n\nid: number (deployment_id)\nname: string\navatar?: string (picture URL)\nstatus: 'online' | 'offline'\naddress?: string\ntimezone?: string\nwellness_score?: number (0-100)\nwellness_descriptor?: string\nlast_location?: string\ntemperature?: number\nlast_activity?: string (e.g. '2 min ago')\n\nStatus Logic:\n- online: last_detected < 30 min ago\n- offline: last_detected >= 30 min ago\n\nFile: types/index.ts",
"x": 1280,
"y": 320
},
{ {
"id": "integration_notes", "id": "integration_notes",
"type": "card", "type": "card",
@ -189,7 +216,7 @@
"tags": [ "tags": [
"frontend" "frontend"
], ],
"description": "WebView Integration:\n\n1. Load https://react.eluxnetworks.net/login\n2. Inject credentials via JS\n3. Store token in app storage\n4. Use token for native API calls\n5. Handle push notifications natively\n\nAlternative: Pure native with direct API calls", "description": "Native API Integration:\n\n1. Login via credentials API\n2. Store token in expo-secure-store\n3. Parse privileges → deployment_ids\n4. Call dashboard_single for each patient\n5. Transform to Beneficiary model\n6. Display patient cards with wellness\n\nFile: services/api.ts\nMethod: getAllPatients()",
"x": 1280, "x": 1280,
"y": 480 "y": 480
}, },
@ -265,12 +292,20 @@
}, },
{ {
"from": "api_auth", "from": "api_auth",
"to": "api_dashboard_single"
},
{
"from": "api_dashboard_single",
"to": "api_voice_ask" "to": "api_voice_ask"
}, },
{ {
"from": "api_auth", "from": "api_auth",
"to": "jwt_token" "to": "jwt_token"
}, },
{
"from": "api_dashboard_single",
"to": "deployment_ids"
},
{ {
"from": "api_auth", "from": "api_auth",
"to": "api_location_map" "to": "api_location_map"
@ -293,7 +328,7 @@
}, },
{ {
"from": "api_voice_ask", "from": "api_voice_ask",
"to": "deployment_ids" "to": "jwt_token"
}, },
{ {
"from": "api_endpoints_needed", "from": "api_endpoints_needed",
@ -309,6 +344,10 @@
}, },
{ {
"from": "expo_config", "from": "expo_config",
"to": "mobile_data_model"
},
{
"from": "mobile_data_model",
"to": "integration_notes" "to": "integration_notes"
}, },
{ {