{ "_meta": { "name": "ENV and existing API", "updatedAt": "2025-12-13T00:30:00.000Z" }, "elements": [ { "id": "env_header", "type": "card", "title": "WellNuo API Documentation", "borderColor": "purple", "tags": [ "overview" ], "description": "Backend API for WellNuo Elderly Monitoring System\n\nBase URL: https://eluxnetworks.net/function/well-api/api\nMethod: POST\nContent-Type: application/x-www-form-urlencoded", "x": 140, "y": 77.5 }, { "id": "web_dashboard", "type": "card", "title": "Web Dashboard", "borderColor": "blue", "tags": [ "frontend", "verified" ], "description": "React Web Application\n\nURL: https://react.eluxnetworks.net/dashboard\nStack: React + TailwindCSS\nAuth: JWT tokens stored in localStorage (auth2)\n\nNote: For embedding in mobile app via WebView", "x": 140, "y": 192.5 }, { "id": "api_auth", "type": "card", "title": "Authentication API ✓", "borderColor": "green", "tags": [ "backend", "verified" ], "description": "function=credentials\n\nRequest:\n- user_name: string (e.g. \"anandk\")\n- ps: string (password, e.g. \"anandk_8\")\n- clientId: string (device ID, e.g. \"001\")\n- nonce: string (random, e.g. \"111\")\n\nResponse:\n{\n \"access_token\": \"eyJhbG...\",\n \"privileges\": \"21,38,29,41,42\",\n \"user_id\": 43,\n \"max_role\": 2,\n \"status\": \"200 OK\"\n}", "x": 513.6377563476562, "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", "type": "card", "title": "AI Chat API ✓", "borderColor": "green", "tags": [ "backend", "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 (keyword-based!)\n- deployment_id: string (patient ID)\n\nWORKING KEYWORDS:\n- \"how is dad\" / \"how is mom\" → full status\n- \"bathroom\" → restroom usage times\n- \"kitchen\" → cooking activity\n- \"sleep\" / \"night\" → sleep hours, wake ups\n- \"shower\" → shower history\n- \"temperature\" → room temp (REAL DATA!)\n- \"last seen\" → online status\n\nNOT WORKING (generic AI):\n- status, summary, location, daily report\n\nNote: Only specific keywords trigger real patient data context!", "x": 520, "y": 400 }, { "id": "api_location_map", "type": "card", "title": "Location Map API", "borderColor": "yellow", "tags": [ "backend", "pending" ], "description": "name=get_full_location_map\n\nGET request with query params\nReturns: Full location/room mapping\n\nStatus: Needs testing with valid session", "x": 900, "y": 77.5 }, { "id": "api_sensor_data", "type": "card", "title": "Sensor Data API", "borderColor": "yellow", "tags": [ "backend", "pending" ], "description": "name=get_sensor_bucketed_data_by_room_sensor\n\nGET request\nReturns: Bucketed sensor data by room\n\nUsed for: Activity graphs, charts\nStatus: Needs testing", "x": 900, "y": 192.5 }, { "id": "test_credentials", "type": "card", "title": "Test Account ✓", "borderColor": "green", "tags": [ "credentials", "verified" ], "description": "Test User Credentials:\n\nUsername: anandk\nPassword: anandk_8\nClientId: 001 (or any unique string)\nNonce: 111 (or any random string)\n\nUser ID: 43\nPrivileges: 21,38,29,41,42\nMax Role: 2\n\nFor development testing only!", "x": 667.1103515625, "y": -92.53355407714844 }, { "id": "jwt_token", "type": "card", "title": "JWT Token Structure", "borderColor": "teal", "tags": [ "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)\nMobile: expo-secure-store\n\nUsage: Include in all API requests as 'token' param\nRequired for: dashboard_single, voice_ask", "x": 520, "y": 550 }, { "id": "dashboard_features", "type": "card", "title": "Dashboard Features", "borderColor": "blue", "tags": [ "frontend" ], "description": "Observed in Web Dashboard:\n\n1. Users List (patients)\n2. Activity Status (Active/Inactive)\n3. Sensor List per user\n4. Alert History\n5. Activity Graphs (daily/weekly)\n6. Room-based monitoring", "x": 140, "y": 480 }, { "id": "api_endpoints_needed", "type": "card", "title": "API Endpoints (To Discover)", "borderColor": "orange", "tags": [ "backend", "pending" ], "description": "Endpoints to test/document:\n\n- get_users / list_users\n- get_sensors / list_sensors\n- get_alerts / list_alerts\n- get_activity_data\n- get_reports (daily/weekly/monthly)\n- update_user_settings\n- update_notification_prefs\n\nNote: Need to capture from web app network traffic", "x": 900, "y": 365 }, { "id": "server_info", "type": "card", "title": "Server Infrastructure", "borderColor": "gray", "tags": [ "external" ], "description": "API Server:\n- Domain: eluxnetworks.net\n- IP: 99.105.56.85 (via react subdomain)\n- SSL: Let's Encrypt\n\nReact Frontend:\n- Domain: react.eluxnetworks.net\n- Static hosting\n\nNote: Main domain DNS may be unstable", "x": 1280, "y": 77.5 }, { "id": "expo_config", "type": "card", "title": "Mobile App Config", "borderColor": "green", "tags": [ "frontend", "verified" ], "description": "Tech Stack:\n- Expo SDK 54\n- React Native 0.81.5\n- Expo Router 6.x\n\nFeatures:\n- WebView for dashboard embedding\n- Push notifications (FCM/APNs)\n- Biometric auth (future)", "x": 1436.259521484375, "y": 208.33245849609375 }, { "id": "gitea_repo", "type": "card", "title": "Git Repository ✓", "borderColor": "green", "tags": [ "external", "verified" ], "description": "Gitea Server:\nURL: https://gitea.wellnua.com\nRepo: sergei_t/WellNuo\nBranch: development\n\nCredentials:\n- Username: sergei_t\n- Password: Orelkosyak5!\n\nContains: Mobile app + Scheme files", "x": 1219.4237060546875, "y": 317.50262451171875 }, { "id": "deployment_ids", "type": "card", "title": "Deployment IDs (Patient IDs)", "borderColor": "teal", "tags": [ "backend", "verified" ], "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, "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", "type": "card", "title": "Mobile Integration Notes", "borderColor": "pink", "tags": [ "frontend" ], "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, "y": 480 }, { "id": "web_portal", "type": "card", "title": "Web Portal (Legacy)", "borderColor": "gray", "tags": [ "external" ], "description": "Original Web Portal:\nURL: https://eluxnetworks.net/function/well-api\n\nNote: Main portal before React app\nUsed for: Direct browser access\n\nDocs: https://wellnua.com/Helps/WebApp1/", "x": 1660, "y": 77.5 }, { "id": "android_apk", "type": "card", "title": "Android APK (Reference)", "borderColor": "gray", "tags": [ "external" ], "description": "Existing Android App:\n\nDownload: https://wellnua.com/FW/WellNuoAppV4.apk\n\nNote: Reference implementation\nCan install on Mac via .apk\n\nUseful for: Testing, API discovery", "x": 1660, "y": 192.5 }, { "id": "user_model", "type": "card", "title": "User Model (Credentials)", "borderColor": "teal", "tags": [ "backend" ], "description": "User Profile Fields:\n\n- First name, Last name\n- Email address\n- Username, Password\n- Listening language\n- Talking language\n\nNote: Both users and caretakers can update these", "x": 1660, "y": 307.5 }, { "id": "deployment_model", "type": "card", "title": "Deployment Model (Beneficiary)", "borderColor": "teal", "tags": [ "backend" ], "description": "Beneficiary (Elderly Person) Fields:\n\n- First name, Last name\n- Email, Username, Password\n- Address\n- Number of people\n- Number of pets\n- Year of birth\n- Gender, Race\n- Photo\n- Devices configuration\n\nDeployment ID: Issued by email to paying customers", "x": 1660, "y": 480 }, { "id": "app_settings", "type": "card", "title": "App Settings Structure", "borderColor": "blue", "tags": [ "frontend" ], "description": "Settings Sections:\n\n1. Credentials - User profile\n2. Other - Main Deployment ID, Simulated Alarm, Deployment selection\n3. Deployment - Beneficiary info, Devices\n\nExpand/collapse via arrow icons", "x": 140, "y": 595 } ], "connections": [ { "from": "env_header", "to": "api_auth" }, { "from": "env_header", "to": "web_dashboard" }, { "from": "api_auth", "to": "api_dashboard_single" }, { "from": "api_dashboard_single", "to": "api_voice_ask" }, { "from": "api_auth", "to": "jwt_token" }, { "from": "api_dashboard_single", "to": "deployment_ids" }, { "from": "api_auth", "to": "api_location_map" }, { "from": "api_location_map", "to": "api_sensor_data" }, { "from": "test_credentials", "to": "api_auth" }, { "from": "web_dashboard", "to": "dashboard_features" }, { "from": "api_sensor_data", "to": "api_endpoints_needed" }, { "from": "api_voice_ask", "to": "jwt_token" }, { "from": "api_endpoints_needed", "to": "server_info" }, { "from": "server_info", "to": "expo_config" }, { "from": "expo_config", "to": "gitea_repo" }, { "from": "expo_config", "to": "mobile_data_model" }, { "from": "mobile_data_model", "to": "integration_notes" }, { "from": "server_info", "to": "web_portal" }, { "from": "web_portal", "to": "android_apk" }, { "from": "android_apk", "to": "user_model" }, { "from": "user_model", "to": "deployment_model" }, { "from": "dashboard_features", "to": "app_settings" }, { "from": "deployment_ids", "to": "deployment_model" } ], "tagsDictionary": [ { "id": "tag-frontend", "name": "frontend", "color": "green" }, { "id": "tag-backend", "name": "backend", "color": "blue" }, { "id": "tag-external", "name": "external", "color": "orange" }, { "id": "tag-verified", "name": "verified", "color": "lime" }, { "id": "tag-pending", "name": "pending", "color": "yellow" }, { "id": "tag-credentials", "name": "credentials", "color": "red" }, { "id": "tag-overview", "name": "overview", "color": "purple" } ] }