Spaces:
Sleeping
Sleeping
findEthics commited on
Commit Β·
9813232
1
Parent(s): 1d4dc07
π Add comprehensive analytics endpoints documentation
Browse files- Added detailed documentation for all analytics endpoints
- Included exact URLs for deployed Atlas app (findethics-atlas.hf.space)
- Added API usage examples with cURL and JavaScript
- Documented dashboard features and data export capabilities
- Added parameter descriptions and response format examples
- DEPLOYMENT.md +97 -7
DEPLOYMENT.md
CHANGED
|
@@ -115,27 +115,87 @@ Once deployed, test these endpoints:
|
|
| 115 |
- **Chat API**: `https://your-space-name.hf.space/chat` (POST request)
|
| 116 |
- **Search API**: `https://your-space-name.hf.space/search` (POST request)
|
| 117 |
|
| 118 |
-
**Analytics
|
| 119 |
- **Interactive Dashboard**: `https://your-space-name.hf.space/analytics/dashboard`
|
| 120 |
-
- **Stats API**: `https://your-space-name.hf.space/analytics/stats`
|
| 121 |
- **Data Export (JSON)**: `https://your-space-name.hf.space/analytics/export?format=json&days=7`
|
| 122 |
- **Data Export (CSV)**: `https://your-space-name.hf.space/analytics/export?format=csv&days=7`
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
**Testing Commands:**
|
| 125 |
```bash
|
| 126 |
# Test health endpoint
|
| 127 |
-
curl https://
|
| 128 |
|
| 129 |
# Test chat functionality
|
| 130 |
-
curl -X POST https://
|
| 131 |
-H "Content-Type: application/json" \
|
| 132 |
-d '{"prompt": "Hello, how are you?", "use_search": true}'
|
| 133 |
|
| 134 |
-
# Test analytics
|
| 135 |
-
curl https://
|
|
|
|
| 136 |
```
|
| 137 |
|
| 138 |
-
## π Analytics
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
### π― Dashboard Features
|
| 141 |
- **Real-time Statistics**: Total messages, sessions, active users
|
|
@@ -159,6 +219,36 @@ curl https://your-space-name.hf.space/analytics/stats
|
|
| 159 |
- **Performance Data**: Response times, error rates, search engine performance
|
| 160 |
- **Search Analytics**: Query terms, result counts, engine fallback usage
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
## π οΈ Troubleshooting
|
| 163 |
|
| 164 |
### Common Issues:
|
|
|
|
| 115 |
- **Chat API**: `https://your-space-name.hf.space/chat` (POST request)
|
| 116 |
- **Search API**: `https://your-space-name.hf.space/search` (POST request)
|
| 117 |
|
| 118 |
+
**Analytics Endpoints:**
|
| 119 |
- **Interactive Dashboard**: `https://your-space-name.hf.space/analytics/dashboard`
|
| 120 |
+
- **Basic Stats API**: `https://your-space-name.hf.space/analytics/stats`
|
| 121 |
- **Data Export (JSON)**: `https://your-space-name.hf.space/analytics/export?format=json&days=7`
|
| 122 |
- **Data Export (CSV)**: `https://your-space-name.hf.space/analytics/export?format=csv&days=7`
|
| 123 |
|
| 124 |
+
**For your deployed Atlas app, the actual URLs are:**
|
| 125 |
+
- **Interactive Dashboard**: `https://findethics-atlas.hf.space/analytics/dashboard`
|
| 126 |
+
- **Basic Stats API**: `https://findethics-atlas.hf.space/analytics/stats`
|
| 127 |
+
- **Data Export (JSON)**: `https://findethics-atlas.hf.space/analytics/export?format=json&days=7`
|
| 128 |
+
- **Data Export (CSV)**: `https://findethics-atlas.hf.space/analytics/export?format=csv&days=7`
|
| 129 |
+
|
| 130 |
**Testing Commands:**
|
| 131 |
```bash
|
| 132 |
# Test health endpoint
|
| 133 |
+
curl https://findethics-atlas.hf.space/
|
| 134 |
|
| 135 |
# Test chat functionality
|
| 136 |
+
curl -X POST https://findethics-atlas.hf.space/chat \
|
| 137 |
-H "Content-Type: application/json" \
|
| 138 |
-d '{"prompt": "Hello, how are you?", "use_search": true}'
|
| 139 |
|
| 140 |
+
# Test analytics endpoints
|
| 141 |
+
curl https://findethics-atlas.hf.space/analytics/stats
|
| 142 |
+
curl https://findethics-atlas.hf.space/analytics/export?format=json&days=1
|
| 143 |
```
|
| 144 |
|
| 145 |
+
## π Analytics System Overview
|
| 146 |
+
|
| 147 |
+
Your Atlas application includes a comprehensive analytics system with multiple endpoints and features:
|
| 148 |
+
|
| 149 |
+
### π Analytics Endpoints
|
| 150 |
+
|
| 151 |
+
#### 1. Interactive Dashboard
|
| 152 |
+
- **URL**: (Analytics Dashbaord)[https://findethics-atlas.hf.space/analytics/dashboard]
|
| 153 |
+
- **Method**: GET
|
| 154 |
+
- **Description**: Full HTML dashboard with interactive charts and real-time metrics
|
| 155 |
+
- **Features**:
|
| 156 |
+
- Real-time statistics cards (total messages, sessions, active users)
|
| 157 |
+
- Hourly message activity charts (last 24 hours)
|
| 158 |
+
- Performance metrics visualization (P50, P90, P95 response times)
|
| 159 |
+
- Search usage analytics
|
| 160 |
+
- Auto-refresh functionality
|
| 161 |
+
- Responsive design for mobile/desktop
|
| 162 |
+
|
| 163 |
+
#### 2. Basic Statistics API
|
| 164 |
+
- **URL**: `https://findethics-atlas.hf.space/analytics/stats`
|
| 165 |
+
- **Method**: GET
|
| 166 |
+
- **Response**: JSON
|
| 167 |
+
- **Description**: Core analytics metrics in JSON format
|
| 168 |
+
- **Data Includes**:
|
| 169 |
+
```json
|
| 170 |
+
{
|
| 171 |
+
"total_sessions": 150,
|
| 172 |
+
"total_messages": 1250,
|
| 173 |
+
"messages_today": 45,
|
| 174 |
+
"messages_week": 320,
|
| 175 |
+
"active_sessions": 12,
|
| 176 |
+
"search_usage_percentage": 78.5,
|
| 177 |
+
"average_response_time_ms": 1250,
|
| 178 |
+
"last_updated": "2024-01-15T10:30:00Z"
|
| 179 |
+
}
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
#### 3. Data Export (JSON Format)
|
| 183 |
+
- **URL**: `https://findethics-atlas.hf.space/analytics/export?format=json&days=7`
|
| 184 |
+
- **Method**: GET
|
| 185 |
+
- **Parameters**:
|
| 186 |
+
- `format`: "json" (required)
|
| 187 |
+
- `days`: Number of days to export (default: 7)
|
| 188 |
+
- **Description**: Export raw analytics data in JSON format
|
| 189 |
+
- **Use Cases**: Data analysis, backup, integration with external tools
|
| 190 |
+
|
| 191 |
+
#### 4. Data Export (CSV Format)
|
| 192 |
+
- **URL**: `https://findethics-atlas.hf.space/analytics/export?format=csv&days=7`
|
| 193 |
+
- **Method**: GET
|
| 194 |
+
- **Parameters**:
|
| 195 |
+
- `format`: "csv" (required)
|
| 196 |
+
- `days`: Number of days to export (default: 7)
|
| 197 |
+
- **Description**: Export analytics data in CSV format for spreadsheet analysis
|
| 198 |
+
- **Use Cases**: Excel analysis, reporting, data visualization tools
|
| 199 |
|
| 200 |
### π― Dashboard Features
|
| 201 |
- **Real-time Statistics**: Total messages, sessions, active users
|
|
|
|
| 219 |
- **Performance Data**: Response times, error rates, search engine performance
|
| 220 |
- **Search Analytics**: Query terms, result counts, engine fallback usage
|
| 221 |
|
| 222 |
+
### π οΈ API Usage Examples
|
| 223 |
+
|
| 224 |
+
#### Testing Basic Stats
|
| 225 |
+
```bash
|
| 226 |
+
curl https://findethics-atlas.hf.space/analytics/stats
|
| 227 |
+
```
|
| 228 |
+
|
| 229 |
+
#### Exporting Last 30 Days (JSON)
|
| 230 |
+
```bash
|
| 231 |
+
curl "https://findethics-atlas.hf.space/analytics/export?format=json&days=30" > analytics_data.json
|
| 232 |
+
```
|
| 233 |
+
|
| 234 |
+
#### Exporting Last Week (CSV)
|
| 235 |
+
```bash
|
| 236 |
+
curl "https://findethics-atlas.hf.space/analytics/export?format=csv&days=7" > analytics_data.csv
|
| 237 |
+
```
|
| 238 |
+
|
| 239 |
+
#### JavaScript Integration
|
| 240 |
+
```javascript
|
| 241 |
+
// Fetch basic stats
|
| 242 |
+
fetch('https://findethics-atlas.hf.space/analytics/stats')
|
| 243 |
+
.then(response => response.json())
|
| 244 |
+
.then(data => console.log('Analytics:', data));
|
| 245 |
+
|
| 246 |
+
// Export data
|
| 247 |
+
fetch('https://findethics-atlas.hf.space/analytics/export?format=json&days=7')
|
| 248 |
+
.then(response => response.json())
|
| 249 |
+
.then(data => console.log('Export data:', data));
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
## π οΈ Troubleshooting
|
| 253 |
|
| 254 |
### Common Issues:
|