Skip to content

Commit 1df23ec

Browse files
Fixing linter issues pass 2
1 parent 0ab24ac commit 1df23ec

File tree

1 file changed

+55
-22
lines changed

1 file changed

+55
-22
lines changed

docs/user-guide/using-intel-scenescape/working-with-spatial-analytics-data.md

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ Authorization: Token <your_api_token>
114114
```
115115

116116
**Getting Your API Token:**
117+
117118
- Access the SceneScape Admin panel: `https://<your-host>/admin`
118119
- Navigate to **Tokens** section
119120
- Use tokens from `admin` or `scenectrl` user accounts
120121

121122
### MQTT Authentication Options
122123

123124
#### Quick Testing & Development
125+
124126
For rapid testing and development, use admin credentials with WebSocket MQTT:
125127

126128
```python
@@ -133,6 +135,7 @@ client.username_pw_set("admin", os.environ['SUPASS']) # Web login password
133135
**Cons**: Uses admin credentials, WebSocket overhead
134136

135137
#### Production Python Applications
138+
136139
For external applications, use dedicated MQTT accounts with direct protocol:
137140

138141
```python
@@ -141,14 +144,17 @@ client = mqtt.Client()
141144
client.username_pw_set(mqtt_user, mqtt_password)
142145
client.tls_set_context(ssl_context)
143146
client.connect(host, 1883, 60)
147+
144148
```
145149

146150
**Setup Requirements:**
151+
147152
- Expose MQTT port 1883 in deployment configuration
148153
- Create dedicated MQTT user accounts (not admin)
149154
- Use MQTT-specific credentials from secrets management
150155

151156
#### Web Applications
157+
152158
For browser-based applications, additional security considerations apply:
153159

154160
```javascript
@@ -160,6 +166,7 @@ const client = mqtt.connect(`wss://${host}/mqtt`, {
160166
```
161167

162168
**Security Considerations:**
169+
163170
- **Never expose admin credentials to client-side code**
164171
- Use limited-privilege MQTT accounts for web clients
165172
- Consider authentication proxies or token-based MQTT access
@@ -168,13 +175,15 @@ const client = mqtt.connect(`wss://${host}/mqtt`, {
168175
### Environment Setup
169176

170177
**For Development/Testing:**
178+
171179
```bash
172180
export SCENESCAPE_HOST="scenescape-hostname-or-ip-address"
173181
export SCENESCAPE_TOKEN="your-api-token" # For REST API calls
174182
export SUPASS="your-web-login-password" # For quick MQTT testing
175183
```
176184

177185
**For Production:**
186+
178187
```bash
179188
export SCENESCAPE_HOST="scenescape-hostname-or-ip-address"
180189
export SCENESCAPE_TOKEN="your-api-token"
@@ -193,12 +202,14 @@ Before subscribing to events, discover what ROIs and Tripwires exist in your sce
193202
### API Endpoints
194203

195204
#### List All Regions
205+
196206
```bash
197207
curl -k -H "Authorization: Token $SCENESCAPE_TOKEN" \
198208
https://$SCENESCAPE_HOST/api/v1/regions
199209
```
200210

201211
**Response Example:**
212+
202213
```json
203214
{
204215
"count": 1,
@@ -221,16 +232,17 @@ curl -k -H "Authorization: Token $SCENESCAPE_TOKEN" \
221232
}
222233
]
223234
}
224-
225235
```
226236

227237
#### List All Tripwires
238+
228239
```bash
229240
curl -k -H "Authorization: Token $SCENESCAPE_TOKEN" \
230241
https://$SCENESCAPE_HOST/api/v1/tripwires
231242
```
232243

233244
**Response Example:**
245+
234246
```json
235247
{
236248
"count": 1,
@@ -252,12 +264,14 @@ curl -k -H "Authorization: Token $SCENESCAPE_TOKEN" \
252264
```
253265

254266
#### Get Specific Region
267+
255268
```bash
256269
curl -k -H "Authorization: Token $SCENESCAPE_TOKEN" \
257270
https://$SCENESCAPE_HOST/api/v1/region/{region_id}
258271
```
259272

260273
#### Get Specific Tripwire
274+
261275
```bash
262276
curl -k -H "Authorization: Token $SCENESCAPE_TOKEN" \
263277
https://$SCENESCAPE_HOST/api/v1/tripwire/{tripwire_id}
@@ -280,26 +294,31 @@ This dynamic classification applies to all MQTT topics, event data, and API resp
280294
### Event Topics
281295

282296
#### Region Events
297+
283298
```
284299
scenescape/event/region/{scene_id}/{region_id}/{event_type}
285300
```
286301

287302
**Event Types:**
303+
288304
- `count` - Object count changes within the region (contains entered/exited arrays)
289305
- `objects` - Object changes within the region (entry/exit events with full object details)
290306

291307
**Purpose**: Both event types fire when objects enter or exit regions. The main difference is data format:
308+
292309
- **`count` events**: Focus on count changes with summary entry/exit information
293310
- **`objects` events**: Provide complete object details for entry/exit events
294311

295312
**Note**: Both event types typically fire together for the same entry/exit events. Choose based on whether you need full object details (`objects`) or just count summaries (`count`). For continuous positional updates of objects within regions, subscribe to streaming data topics instead—see [Streaming Data Topics](#streaming-data-topics).
296313

297314
#### Tripwire Events
315+
298316
```
299317
scenescape/event/tripwire/{scene_id}/{tripwire_id}/{event_type}
300318
```
301319

302320
**Event Types:**
321+
303322
- `objects` - Objects crossing the tripwire
304323

305324
### Example MQTT Subscriptions
@@ -414,6 +433,7 @@ Each event includes object metadata and spatial context.
414433
```
415434

416435
**Key Properties in Entry Events:**
436+
417437
- **`counts`**: Current object counts by type after the entry occurred
418438
- **`entered` array**: Contains summary information about objects that just entered
419439
- **`objects` array**: Full object details for all objects currently in the region, including the newly entered object with its `regions.{region_id}.entered` timestamp
@@ -488,6 +508,7 @@ Each event includes object metadata and spatial context.
488508
```
489509

490510
**Key Properties in Exit Events:**
511+
491512
- **`counts`**: Current object counts by type after the exit occurred
492513
- **`exited` array**: Contains critical `dwell` time data - how long each object spent in the region (essential for situational awareness applications like queue monitoring, loitering detection, and process timing analysis)
493514
- **`objects` array**: Full details for objects still remaining in the region after the exit
@@ -541,33 +562,34 @@ Each event includes object metadata and spatial context.
541562
```
542563

543564
**Key Properties in Tripwire Events:**
565+
544566
- **`direction` field**: Critical directional indicator (+1 or -1) showing which way each individual object crossed the tripwire relative to the configured directional flag - essential for counting applications, access control, and flow analysis. Each object in the `objects` array has its own direction field (always +1 or -1)
545567
- **`objects` array**: Contains full object details at the moment of crossing, including position, velocity, and confidence
546568
- **`counts`**: Number of objects crossing in this event - almost always 1 (single object crossing), except in rare cases where multiple objects cross simultaneously
547569

548570
### Event Field Descriptions
549571

550-
| Field | Type | Description |
551-
|-------|------|-------------|
552-
| `timestamp` | string | ISO 8601 timestamp of the original data frame or sensor input when the object interaction occurred (not when the event was detected or processed) |
553-
| `scene_id` | string | UUID of the scene containing the region/tripwire |
554-
| `scene_name` | string | Human-readable scene name |
555-
| `region_id` / `tripwire_id` | string | UUID of the region or tripwire |
556-
| `region_name` / `tripwire_name` | string | Human-readable region or tripwire name |
557-
| `counts` | object | Current object counts by category |
558-
| `objects` | array | Objects currently in region or crossing tripwire |
559-
| `entered` | array | Objects that entered the region (ROI events only) |
560-
| `exited` | array | Objects that exited the region (ROI events only); includes `object` details and `dwell` time in seconds |
561-
| `metadata` | object | Region/tripwire configuration data |
562-
| `dwell` | number | Time in seconds that an object spent in the region (only in exited events) |
563-
| `id` | string | Object identifier (within object data) |
564-
| `category` / `type` | string | Object classification (person, vehicle, etc.) |
565-
| `confidence` | number | Detection confidence (0.0 - 1.0) |
566-
| `translation` | array | 3D world coordinates [x, y, z] in meters |
567-
| `velocity` | array | Velocity vector [vx, vy, vz] in meters per second |
568-
| `visibility` | array | List of sensors that can detect this object |
569-
| `regions` | object | Region membership and entry times |
570-
| `direction` | number | Crossing direction for tripwire events (-1 or 1) |
572+
| Field | Type | Description |
573+
| ------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
574+
| `timestamp` | string | ISO 8601 timestamp of the original data frame or sensor input when the object interaction occurred (not when the event was detected or processed) |
575+
| `scene_id` | string | UUID of the scene containing the region/tripwire |
576+
| `scene_name` | string | Human-readable scene name |
577+
| `region_id` / `tripwire_id` | string | UUID of the region or tripwire |
578+
| `region_name` / `tripwire_name` | string | Human-readable region or tripwire name |
579+
| `counts` | object | Current object counts by category |
580+
| `objects` | array | Objects currently in region or crossing tripwire |
581+
| `entered` | array | Objects that entered the region (ROI events only) |
582+
| `exited` | array | Objects that exited the region (ROI events only); includes `object` details and `dwell` time in seconds |
583+
| `metadata` | object | Region/tripwire configuration data |
584+
| `dwell` | number | Time in seconds that an object spent in the region (only in exited events) |
585+
| `id` | string | Object identifier (within object data) |
586+
| `category` / `type` | string | Object classification (person, vehicle, etc.) |
587+
| `confidence` | number | Detection confidence (0.0 - 1.0) |
588+
| `translation` | array | 3D world coordinates [x, y, z] in meters |
589+
| `velocity` | array | Velocity vector [vx, vy, vz] in meters per second |
590+
| `visibility` | array | List of sensors that can detect this object |
591+
| `regions` | object | Region membership and entry times |
592+
| `direction` | number | Crossing direction for tripwire events (-1 or 1) |
571593

572594
---
573595

@@ -598,11 +620,13 @@ scenescape/data/region/{scene_id}/{region_id}/{object_type}
598620
### Prerequisites
599621

600622
**Ubuntu Setup:**
623+
601624
```bash
602625
sudo apt update && sudo apt install python3-requests python3-paho-mqtt
603626
```
604627

605628
**Alternative (using virtual environment):**
629+
606630
```bash
607631
sudo apt update && sudo apt install python3-full
608632
python3 -m venv scenescape-env
@@ -611,6 +635,7 @@ pip install requests paho-mqtt
611635
```
612636

613637
**Environment Variables:**
638+
614639
```bash
615640
export SCENESCAPE_HOST="scenescape-hostname-or-ip-address"
616641
export SCENESCAPE_TOKEN="your-api-token" # Found in SceneScape Admin panel > Tokens (admin or scenectrl user)
@@ -785,6 +810,7 @@ client.loop_forever()
785810
**Run:** `python3 -m http.server 8000` then open http://&lt;your-server-ip&gt;:8000 in your browser
786811
787812
**Important:** Replace `YOUR_SCENESCAPE_HOST` and `YOUR_SUPASS` with your actual values:
813+
788814
- **Host**: Use `localhost` only if your browser and SceneScape are running on the same system, otherwise use the actual hostname or IP address of your SceneScape deployment
789815
- **Password**: Use your SceneScape web interface login password (same as the `SUPASS` environment variable)
790816
@@ -796,6 +822,7 @@ For applications that need direct MQTT access instead of WebSockets, additional
796822
797823
**Docker Compose Setup:**
798824
In `docker-compose.yml`, uncomment the broker ports section:
825+
799826
```yaml
800827
broker:
801828
image: eclipse-mosquitto:2.0.22
@@ -806,6 +833,7 @@ broker:
806833
807834
**Kubernetes Setup:**
808835
Direct MQTT access is configured via NodePort service. Check `kubernetes/scenescape-chart/values.yaml`:
836+
809837
```yaml
810838
mqttService:
811839
nodePort:
@@ -815,13 +843,15 @@ mqttService:
815843
816844
**MQTT Credentials:**
817845
Use the generated MQTT credentials instead of web login credentials:
846+
818847
```bash
819848
# Read MQTT credentials from secrets file
820849
export MQTT_USER=$(jq -r '.user' manager/secrets/controller.auth)
821850
export MQTT_PASS=$(jq -r '.password' manager/secrets/controller.auth)
822851
```
823852
824853
**Python Example for Direct MQTT:**
854+
825855
```python
826856
import os, ssl
827857
import paho.mqtt.client as mqtt
@@ -861,6 +891,7 @@ client.loop_forever()
861891
```
862892
863893
**Environment Setup for Direct MQTT:**
894+
864895
```bash
865896
export SCENESCAPE_HOST="scenescape-hostname-or-ip" # No https:// prefix
866897
export MQTT_USER="dedicated-mqtt-user"
@@ -878,11 +909,13 @@ SceneScape's spatial analytics provide a powerful abstraction that separates mon
878909
This architecture means your spatial analytics logic—the regions you define, the business rules you implement, and the applications you build—remain completely unchanged even as your sensor infrastructure evolves. Whether you add new cameras, upgrade to different sensor technologies, or reconfigure your monitoring setup, your ROIs and tripwires continue working seamlessly.
879910
880911
**Key Benefits:**
912+
881913
- **Future-proof applications**: Analytics logic survives sensor changes and infrastructure upgrades
882914
- **Unified monitoring**: Single API and event stream regardless of underlying sensor types or count
883915
- **Simplified maintenance**: Manage spatial analytics once at the scene level, not per-sensor
884916
885917
**Getting Started:**
918+
886919
1. Run the tutorial examples (`discover.py`, `listen.py`, `index.html`)
887920
2. Define regions and tripwires that match your monitoring needs
888921
3. Build applications using the REST API and MQTT event streams

0 commit comments

Comments
 (0)