@modelhealth/modelhealth 0.1.41 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +185 -262
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +193 -274
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +244 -72
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -3
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/wasm/model_health_wasm.d.ts +21 -21
- package/wasm/model_health_wasm.js +61 -61
- package/wasm/model_health_wasm_bg.wasm +0 -0
- package/wasm/model_health_wasm_bg.wasm.d.ts +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* const sessions = await client.sessionList();
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
import type { CheckerboardDetails, Session, Subject, SubjectParameters, Activity, ActivitySort, ActivityTag, VideoVersion,
|
|
19
|
+
import type { CheckerboardDetails, Session, Subject, SubjectParameters, Activity, ActivitySort, ActivityTag, VideoVersion, MotionDataType, MotionData, AnalysisDataType, AnalysisData, AnalysisType, Analysis, AnalysisStatus, ActivityStatus, CalibrationStatus } from "./types.js";
|
|
20
20
|
/**
|
|
21
21
|
* Configuration options for the Model Health client.
|
|
22
22
|
*/
|
|
@@ -117,81 +117,62 @@ export declare class ModelHealthService {
|
|
|
117
117
|
*/
|
|
118
118
|
private ensureInitialized;
|
|
119
119
|
/**
|
|
120
|
-
* Retrieves all sessions for the account
|
|
120
|
+
* Retrieves all sessions for the account associated with the API key.
|
|
121
121
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* or server errors.
|
|
122
|
+
* Use this to list existing sessions before creating a new one, or to resume a previous
|
|
123
|
+
* capture workflow.
|
|
125
124
|
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* const sessions = await client.sessionList();
|
|
130
|
-
* console.log(`Found ${sessions.length} sessions`);
|
|
131
|
-
* for (const session of sessions) {
|
|
132
|
-
* console.log(`Session: ${session.id}`);
|
|
133
|
-
* }
|
|
134
|
-
* } catch (error) {
|
|
135
|
-
* console.log(`Failed to fetch sessions: ${error}`);
|
|
136
|
-
* }
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
sessionList(): Promise<Session[]>;
|
|
140
|
-
/**
|
|
141
|
-
* Retrieve a specific session by ID with all activities populated.
|
|
125
|
+
* To connect a device to a specific session, use the session `qrcode` URL to download
|
|
126
|
+
* the QR code image data, then display it in your app to be captured by the ModelHealth
|
|
127
|
+
* mobile app.
|
|
142
128
|
*
|
|
143
|
-
* @
|
|
144
|
-
* @
|
|
145
|
-
* @throws If the session doesn't exist, user lacks access, or request fails
|
|
129
|
+
* @returns An array of `Session` objects, or an empty array if none exist.
|
|
130
|
+
* @throws If the request fails due to network or authentication issues.
|
|
146
131
|
*
|
|
147
132
|
* @example
|
|
148
133
|
* ```typescript
|
|
149
|
-
* const
|
|
150
|
-
* console.log(`
|
|
134
|
+
* const sessions = await client.sessionList();
|
|
135
|
+
* console.log(`Found ${sessions.length} sessions`);
|
|
136
|
+
*
|
|
137
|
+
* const firstSession = sessions[0];
|
|
138
|
+
* if (firstSession?.qrcode) {
|
|
139
|
+
* const response = await fetch(firstSession.qrcode);
|
|
140
|
+
* const qrCodeImageData = new Uint8Array(await response.arrayBuffer());
|
|
141
|
+
* // Display qrCodeImageData in your app so the mobile app can scan it
|
|
142
|
+
* }
|
|
151
143
|
* ```
|
|
152
144
|
*/
|
|
153
|
-
|
|
145
|
+
sessionList(): Promise<Session[]>;
|
|
154
146
|
/**
|
|
155
|
-
* Creates a
|
|
147
|
+
* Creates a session.
|
|
156
148
|
*
|
|
157
|
-
* A session is
|
|
158
|
-
*
|
|
149
|
+
* A session is the parent container for a movement capture workflow. It links
|
|
150
|
+
* related entities such as activities and subjects, and provides the context
|
|
151
|
+
* used by subsequent operations.
|
|
159
152
|
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* @returns A `Session` object with a unique identifier
|
|
163
|
-
* @throws If session creation fails
|
|
153
|
+
* @returns A new `Session` with a unique identifier.
|
|
154
|
+
* @throws If session creation fails.
|
|
164
155
|
*
|
|
165
156
|
* @example
|
|
166
157
|
* ```typescript
|
|
167
|
-
* // Create session
|
|
168
158
|
* const session = await client.createSession();
|
|
169
|
-
*
|
|
170
|
-
* // Proceed with calibration
|
|
171
|
-
* const details: CheckerboardDetails = {
|
|
172
|
-
* rows: 4,
|
|
173
|
-
* columns: 5,
|
|
174
|
-
* squareSize: 35,
|
|
175
|
-
* placement: "perpendicular"
|
|
176
|
-
* };
|
|
177
|
-
* // await client.calibrateCamera(session, details, (status) => { ... });
|
|
178
159
|
* ```
|
|
179
160
|
*/
|
|
180
161
|
createSession(): Promise<Session>;
|
|
181
162
|
/**
|
|
182
|
-
* Calibrates
|
|
163
|
+
* Calibrates cameras using a checkerboard pattern.
|
|
183
164
|
*
|
|
184
|
-
*
|
|
185
|
-
* -
|
|
186
|
-
*
|
|
187
|
-
* - Multiple views of the checkerboard from different angles
|
|
165
|
+
* Determines each camera's position and orientation in 3D space (extrinsics), enabling
|
|
166
|
+
* reconstruction of real-world movement from multiple 2D video feeds. Required once per
|
|
167
|
+
* session setup — recalibrate only if cameras are moved.
|
|
188
168
|
*
|
|
189
|
-
*
|
|
169
|
+
* > Note: `rows` and `columns` refer to internal corners, not squares. A 5×6 board has
|
|
170
|
+
* > 4 internal corner rows and 5 internal corner columns.
|
|
190
171
|
*
|
|
191
|
-
* @param session The session
|
|
192
|
-
* @param checkerboardDetails
|
|
193
|
-
* @param statusCallback Callback
|
|
194
|
-
* @throws If calibration fails (
|
|
172
|
+
* @param session The session context in which calibration is performed.
|
|
173
|
+
* @param checkerboardDetails The checkerboard dimensions and placement used for calibration.
|
|
174
|
+
* @param statusCallback Callback called with progress updates during calibration.
|
|
175
|
+
* @throws If calibration fails (for example, checkerboard pattern not detected).
|
|
195
176
|
*
|
|
196
177
|
* @example
|
|
197
178
|
* ```typescript
|
|
@@ -205,47 +186,41 @@ export declare class ModelHealthService {
|
|
|
205
186
|
* };
|
|
206
187
|
*
|
|
207
188
|
* await client.calibrateCamera(session, details, (status) => {
|
|
208
|
-
* console.log(
|
|
189
|
+
* console.log(status);
|
|
209
190
|
* });
|
|
210
|
-
* // Calibration complete, proceed to neutral pose
|
|
211
191
|
* ```
|
|
212
192
|
*/
|
|
213
193
|
calibrateCamera(session: Session, checkerboardDetails: CheckerboardDetails, statusCallback: (status: CalibrationStatus) => void): Promise<void>;
|
|
214
194
|
/**
|
|
215
|
-
*
|
|
195
|
+
* Calibrates a subject by recording a neutral standing pose.
|
|
216
196
|
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* used to scale the biomechanical model to match the subject's dimensions.
|
|
197
|
+
* Scales the 3D biomechanical model to the subject's body size. Must be run after
|
|
198
|
+
* camera calibration and requires the subject profile to include height and weight.
|
|
220
199
|
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* - Face forward with arms spread slightly at sides
|
|
224
|
-
* - Remain still for a few seconds
|
|
200
|
+
* > Important: The subject must stand upright, feet pointing forward, completely still,
|
|
201
|
+
* > and fully visible to all cameras for the duration of the recording.
|
|
225
202
|
*
|
|
226
|
-
* @param subject The subject to calibrate
|
|
227
|
-
* @param session The session
|
|
228
|
-
* @param statusCallback Callback
|
|
229
|
-
* @throws If pose capture fails (subject not detected
|
|
203
|
+
* @param subject The subject to calibrate.
|
|
204
|
+
* @param session The session context in which calibration is performed.
|
|
205
|
+
* @param statusCallback Callback called with calibration status updates.
|
|
206
|
+
* @throws If pose capture fails (for example, subject not detected or insufficient visibility).
|
|
230
207
|
*
|
|
231
208
|
* @example
|
|
232
209
|
* ```typescript
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
* console.log("Neutral pose status:", status);
|
|
210
|
+
* await client.calibrateSubject(subject, session, (status) => {
|
|
211
|
+
* console.log(status);
|
|
236
212
|
* });
|
|
237
|
-
* // Model now scaled, ready to record movement activities
|
|
238
213
|
* ```
|
|
239
214
|
*/
|
|
240
|
-
|
|
215
|
+
calibrateSubject(subject: Subject, session: Session, statusCallback: (status: CalibrationStatus) => void): Promise<void>;
|
|
241
216
|
/**
|
|
242
|
-
* Retrieves all subjects associated with the
|
|
217
|
+
* Retrieves all subjects associated with the API key.
|
|
243
218
|
*
|
|
244
|
-
* Subjects represent individuals being monitored or assessed. Each subject
|
|
245
|
-
*
|
|
219
|
+
* Subjects represent individuals being monitored or assessed. Each subject may
|
|
220
|
+
* contain demographic information, physical measurements, and categorization tags.
|
|
246
221
|
*
|
|
247
|
-
* @returns An array of `Subject` objects
|
|
248
|
-
* @throws If the request fails or authentication
|
|
222
|
+
* @returns An array of `Subject` objects, or an empty array if none exist.
|
|
223
|
+
* @throws If the request fails due to network or authentication issues.
|
|
249
224
|
*
|
|
250
225
|
* @example
|
|
251
226
|
* ```typescript
|
|
@@ -253,71 +228,62 @@ export declare class ModelHealthService {
|
|
|
253
228
|
* for (const subject of subjects) {
|
|
254
229
|
* console.log(`${subject.name}: ${subject.height ?? 0}cm, ${subject.weight ?? 0}kg`);
|
|
255
230
|
* }
|
|
256
|
-
*
|
|
257
|
-
* // Filter by tags
|
|
258
|
-
* const athletes = subjects.filter(s => s.subjectTags.includes("athlete"));
|
|
259
231
|
* ```
|
|
260
232
|
*/
|
|
261
233
|
subjectList(): Promise<Subject[]>;
|
|
262
234
|
/**
|
|
263
|
-
* Creates a
|
|
235
|
+
* Creates a subject profile.
|
|
264
236
|
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* and movement activities.
|
|
237
|
+
* Height and weight are required for biomechanical analysis. Once created, the subject
|
|
238
|
+
* can be calibrated using `calibrateSubject`.
|
|
268
239
|
*
|
|
269
|
-
* @param parameters
|
|
270
|
-
* @returns The newly created `Subject` with its assigned ID
|
|
271
|
-
* @throws If creation fails (
|
|
240
|
+
* @param parameters The subject profile details including name and anthropometrics.
|
|
241
|
+
* @returns The newly created `Subject` with its assigned ID.
|
|
242
|
+
* @throws If creation fails (for example, validation error or duplicate name).
|
|
272
243
|
*
|
|
273
244
|
* @example
|
|
274
245
|
* ```typescript
|
|
275
246
|
* const params: SubjectParameters = {
|
|
276
|
-
* name: "John
|
|
247
|
+
* name: "John Smith",
|
|
277
248
|
* weight: 75.0, // kilograms
|
|
278
249
|
* height: 180.0, // centimeters
|
|
279
250
|
* birthYear: 1990,
|
|
280
|
-
* gender: "man",
|
|
281
|
-
* sexAtBirth: "man",
|
|
282
|
-
* characteristics: "Regular training schedule",
|
|
283
|
-
* subjectTags: ["athlete"],
|
|
284
|
-
* terms: true
|
|
285
251
|
* };
|
|
286
252
|
*
|
|
287
253
|
* const subject = await client.createSubject(params);
|
|
288
254
|
* console.log(`Created subject with ID: ${subject.id}`);
|
|
289
255
|
*
|
|
290
256
|
* // Use the subject for calibration
|
|
291
|
-
*
|
|
257
|
+
* await client.calibrateSubject(subject, session, (status) => {
|
|
258
|
+
* console.log(status);
|
|
259
|
+
* });
|
|
292
260
|
* ```
|
|
293
261
|
*/
|
|
294
262
|
createSubject(parameters: SubjectParameters): Promise<Subject>;
|
|
295
263
|
/**
|
|
296
264
|
* Retrieves activities for a specific subject with pagination and sorting.
|
|
297
265
|
*
|
|
298
|
-
*
|
|
299
|
-
* with control over pagination and sort order. This is useful for displaying
|
|
300
|
-
* activity history or implementing infinite scroll interfaces.
|
|
266
|
+
* Use this to display a subject's activity history or implement paginated list interfaces.
|
|
301
267
|
*
|
|
302
|
-
* @param subjectId The ID of the subject whose activities to retrieve
|
|
303
|
-
* @param startIndex Zero-based index to start from
|
|
304
|
-
* @param count Number of activities to retrieve per request
|
|
305
|
-
* @param sort Sort order for the results (
|
|
306
|
-
* @returns An array of
|
|
307
|
-
* @throws If the request fails or authentication
|
|
268
|
+
* @param subjectId The ID of the subject whose activities to retrieve.
|
|
269
|
+
* @param startIndex Zero-based index to start from. Use `0` for the first page.
|
|
270
|
+
* @param count Number of activities to retrieve per request.
|
|
271
|
+
* @param sort Sort order for the results (for example, `"updated_at"` for most recent first).
|
|
272
|
+
* @returns An array of `Activity` objects, or an empty array if none exist.
|
|
273
|
+
* @throws If the request fails due to network or authentication issues.
|
|
308
274
|
*
|
|
309
275
|
* @example
|
|
310
276
|
* ```typescript
|
|
311
|
-
* //
|
|
312
|
-
* const
|
|
277
|
+
* // First page
|
|
278
|
+
* const page1 = await client.activitiesForSubject(
|
|
313
279
|
* "subject-123",
|
|
314
280
|
* 0,
|
|
315
281
|
* 20,
|
|
316
282
|
* "updated_at"
|
|
317
283
|
* );
|
|
318
284
|
*
|
|
319
|
-
* //
|
|
320
|
-
* const
|
|
285
|
+
* // Next page
|
|
286
|
+
* const page2 = await client.activitiesForSubject(
|
|
321
287
|
* "subject-123",
|
|
322
288
|
* 20,
|
|
323
289
|
* 20,
|
|
@@ -325,111 +291,95 @@ export declare class ModelHealthService {
|
|
|
325
291
|
* );
|
|
326
292
|
* ```
|
|
327
293
|
*/
|
|
328
|
-
|
|
294
|
+
activitiesForSubject(subjectId: string, startIndex: number, count: number, sort: ActivitySort): Promise<Activity[]>;
|
|
329
295
|
/**
|
|
330
|
-
* Retrieves
|
|
296
|
+
* Retrieves an activity by its ID.
|
|
331
297
|
*
|
|
332
|
-
* Use this
|
|
333
|
-
*
|
|
298
|
+
* Use this to fetch the latest state of an activity, including its videos, results,
|
|
299
|
+
* and current processing status.
|
|
334
300
|
*
|
|
335
|
-
* @param activityId The unique identifier of the activity
|
|
336
|
-
* @returns The
|
|
337
|
-
* @throws If the activity doesn't exist
|
|
301
|
+
* @param activityId The unique identifier of the activity.
|
|
302
|
+
* @returns The `Activity` with its current details.
|
|
303
|
+
* @throws If the activity doesn't exist or the request fails.
|
|
338
304
|
*
|
|
339
305
|
* @example
|
|
340
306
|
* ```typescript
|
|
341
|
-
* const activity = await client.
|
|
307
|
+
* const activity = await client.fetchActivity("abc123");
|
|
342
308
|
* console.log(`Activity: ${activity.name ?? "Unnamed"}`);
|
|
343
309
|
* console.log(`Status: ${activity.status}`);
|
|
344
|
-
* console.log(`Videos: ${activity.videos.length}`);
|
|
345
310
|
* ```
|
|
346
311
|
*/
|
|
347
|
-
|
|
312
|
+
fetchActivity(activityId: string): Promise<Activity>;
|
|
348
313
|
/**
|
|
349
|
-
* Updates an
|
|
314
|
+
* Updates an activity.
|
|
350
315
|
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
316
|
+
* Only mutable fields (such as `name`) are applied on the server. The server-side
|
|
317
|
+
* state is returned, so use the result rather than the input going forward.
|
|
353
318
|
*
|
|
354
|
-
* @param activity The activity to update
|
|
355
|
-
* @returns The updated
|
|
356
|
-
* @throws If the update fails or
|
|
319
|
+
* @param activity The activity to update, with modified properties.
|
|
320
|
+
* @returns The updated `Activity` as stored on the server.
|
|
321
|
+
* @throws If the update fails or the request fails.
|
|
357
322
|
*
|
|
358
323
|
* @example
|
|
359
324
|
* ```typescript
|
|
360
|
-
* let activity = await client.
|
|
361
|
-
* // Modify the activity name
|
|
325
|
+
* let activity = await client.fetchActivity("abc123");
|
|
362
326
|
* activity.name = "CMJ Baseline Test";
|
|
363
327
|
* const updated = await client.updateActivity(activity);
|
|
364
|
-
* console.log(`Updated: ${updated.name ?? ""}`);
|
|
328
|
+
* console.log(`Updated: ${updated.name ?? "Unnamed"}`);
|
|
365
329
|
* ```
|
|
366
|
-
*
|
|
367
|
-
* @note Not all activity properties can be modified. Only mutable fields
|
|
368
|
-
* (such as `name`) will be updated on the server.
|
|
369
330
|
*/
|
|
370
331
|
updateActivity(activity: Activity): Promise<Activity>;
|
|
371
332
|
/**
|
|
372
|
-
* Deletes an activity
|
|
333
|
+
* Deletes an activity.
|
|
373
334
|
*
|
|
374
|
-
*
|
|
375
|
-
* including videos and analysis results. This action cannot be undone.
|
|
335
|
+
* Permanently removes the activity and all associated videos, results, and metadata.
|
|
376
336
|
*
|
|
377
|
-
* @param activity The activity to delete
|
|
378
|
-
* @throws If the deletion fails or
|
|
337
|
+
* @param activity The activity to delete.
|
|
338
|
+
* @throws If the deletion fails or the request fails.
|
|
379
339
|
*
|
|
380
340
|
* @example
|
|
381
341
|
* ```typescript
|
|
382
|
-
* const activity = await client.
|
|
342
|
+
* const activity = await client.fetchActivity("abc123");
|
|
383
343
|
* await client.deleteActivity(activity);
|
|
384
|
-
* // Activity and all associated data are now permanently deleted
|
|
385
344
|
* ```
|
|
386
345
|
*
|
|
387
|
-
* @warning This operation is irreversible.
|
|
388
|
-
* and metadata associated with this activity will be permanently lost.
|
|
346
|
+
* @warning This operation is irreversible.
|
|
389
347
|
*/
|
|
390
348
|
deleteActivity(activity: Activity): Promise<void>;
|
|
391
349
|
/**
|
|
392
350
|
* Retrieves all available activity tags.
|
|
393
351
|
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
* used for filtering or organizing activities in your application.
|
|
352
|
+
* Use the returned tags to populate a tag picker or validate tag values before
|
|
353
|
+
* assigning them to activities.
|
|
397
354
|
*
|
|
398
|
-
* @returns An array of
|
|
399
|
-
* @throws If the request fails or authentication
|
|
355
|
+
* @returns An array of `ActivityTag` objects, or an empty array if none are configured.
|
|
356
|
+
* @throws If the request fails due to network or authentication issues.
|
|
400
357
|
*
|
|
401
358
|
* @example
|
|
402
359
|
* ```typescript
|
|
403
|
-
* const tags = await client.
|
|
360
|
+
* const tags = await client.activityTags();
|
|
404
361
|
* for (const tag of tags) {
|
|
405
362
|
* console.log(`${tag.label}: ${tag.value}`);
|
|
406
363
|
* }
|
|
407
|
-
*
|
|
408
|
-
* // Use tags for filtering or categorization
|
|
409
|
-
* const cmjTag = tags.find(t => t.value === "cmj");
|
|
410
364
|
* ```
|
|
411
365
|
*/
|
|
412
|
-
|
|
366
|
+
activityTags(): Promise<ActivityTag[]>;
|
|
413
367
|
/**
|
|
414
|
-
* Retrieves all movement activities associated with
|
|
368
|
+
* Retrieves all movement activities associated with a session.
|
|
415
369
|
*
|
|
416
|
-
* Activities represent individual recording
|
|
417
|
-
* captured videos and
|
|
418
|
-
* fetch
|
|
370
|
+
* Activities represent individual recording trials and contain references to
|
|
371
|
+
* captured videos and results. Use this to review past data or
|
|
372
|
+
* fetch results for completed activities.
|
|
419
373
|
*
|
|
420
|
-
* @param sessionId
|
|
421
|
-
* @returns An array of `Activity` objects
|
|
422
|
-
* @throws If the request fails or authentication
|
|
374
|
+
* @param sessionId The session ID to retrieve activities for.
|
|
375
|
+
* @returns An array of `Activity` objects, or an empty array if none exist.
|
|
376
|
+
* @throws If the request fails due to network or authentication issues.
|
|
423
377
|
*
|
|
424
378
|
* @example
|
|
425
379
|
* ```typescript
|
|
426
380
|
* const activities = await client.activityList(session.id);
|
|
427
381
|
*
|
|
428
|
-
*
|
|
429
|
-
* const completed = activities.filter(t => t.status === "completed");
|
|
430
|
-
*
|
|
431
|
-
* // Access videos and results
|
|
432
|
-
* for (const activity of completed) {
|
|
382
|
+
* for (const activity of activities) {
|
|
433
383
|
* console.log(`Activity: ${activity.name ?? activity.id}`);
|
|
434
384
|
* console.log(`Videos: ${activity.videos.length}`);
|
|
435
385
|
* console.log(`Results: ${activity.results.length}`);
|
|
@@ -438,49 +388,46 @@ export declare class ModelHealthService {
|
|
|
438
388
|
*/
|
|
439
389
|
activityList(sessionId: string): Promise<Activity[]>;
|
|
440
390
|
/**
|
|
441
|
-
*
|
|
391
|
+
* Downloads video data for a specific activity.
|
|
442
392
|
*
|
|
443
|
-
*
|
|
444
|
-
* Videos with invalid URLs or failed downloads are
|
|
393
|
+
* Fetches all videos associated with the activity that match the specified version.
|
|
394
|
+
* Downloads run concurrently. Videos with invalid URLs or failed downloads are
|
|
395
|
+
* silently excluded from the result.
|
|
445
396
|
*
|
|
446
|
-
* @param activity The activity whose videos should be downloaded
|
|
447
|
-
* @param version The version
|
|
448
|
-
* @returns An array of
|
|
449
|
-
*
|
|
397
|
+
* @param activity The activity whose videos should be downloaded.
|
|
398
|
+
* @param version The version of videos to download (for example, `"raw"` or `"synced"`).
|
|
399
|
+
* @returns An array of `Uint8Array` objects. May be empty if no videos are available
|
|
400
|
+
* or all downloads fail.
|
|
450
401
|
*
|
|
451
402
|
* @example
|
|
452
403
|
* ```typescript
|
|
453
|
-
* const activity = // ...
|
|
454
|
-
* const videoData = await client.
|
|
404
|
+
* const activity = // ... fetched activity
|
|
405
|
+
* const videoData = await client.videosForActivity(activity, "raw");
|
|
455
406
|
*
|
|
456
407
|
* for (const data of videoData) {
|
|
457
408
|
* // Process video data
|
|
458
409
|
* }
|
|
459
410
|
* ```
|
|
460
411
|
*
|
|
461
|
-
* @note
|
|
462
|
-
* failures do not affect other requests.
|
|
412
|
+
* @note Downloads run concurrently. Individual download failures do not affect other requests.
|
|
463
413
|
*/
|
|
464
|
-
|
|
414
|
+
videosForActivity(activity: Activity, version?: VideoVersion): Promise<Uint8Array[]>;
|
|
465
415
|
/**
|
|
466
|
-
* Downloads
|
|
467
|
-
*
|
|
468
|
-
* After an activity completes processing, various result files become available for download.
|
|
469
|
-
* Use this method to retrieve specific types of data (kinematic measurements, visualizations)
|
|
470
|
-
* in their native file formats (JSON, CSV).
|
|
416
|
+
* Downloads motion data from a processed activity.
|
|
471
417
|
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
418
|
+
* Use this after an activity reaches `ready` status to retrieve biomechanical result files
|
|
419
|
+
* such as kinematics, marker data, or an OpenSim model. Downloads run concurrently and
|
|
420
|
+
* failed downloads are silently excluded from results.
|
|
474
421
|
*
|
|
475
|
-
* @param
|
|
476
|
-
* @param
|
|
477
|
-
* @returns An array of
|
|
478
|
-
*
|
|
422
|
+
* @param dataTypes The motion data types to download (for example, `"kinematics_mot"`, `"markers"`, `"animation"`).
|
|
423
|
+
* @param activity The activity to download data from. Must have completed processing.
|
|
424
|
+
* @returns An array of `MotionData`, one entry per successfully downloaded type. May be empty
|
|
425
|
+
* if no results are available or all downloads fail.
|
|
479
426
|
*
|
|
480
427
|
* @example
|
|
481
428
|
* ```typescript
|
|
482
429
|
* // Download kinematics in MOT format
|
|
483
|
-
* const results = await client.
|
|
430
|
+
* const results = await client.motionDataForActivity(activity, ["kinematics_mot"]);
|
|
484
431
|
*
|
|
485
432
|
* for (const result of results) {
|
|
486
433
|
* switch (result.resultDataType) {
|
|
@@ -490,30 +437,24 @@ export declare class ModelHealthService {
|
|
|
490
437
|
* }
|
|
491
438
|
* }
|
|
492
439
|
*
|
|
493
|
-
* // Download multiple types in one call
|
|
494
|
-
* const allData = await client.downloadActivityResultData(
|
|
495
|
-
* activity,
|
|
496
|
-
* ["kinematics_mot", "animation"]
|
|
497
|
-
* );
|
|
498
|
-
* console.log(`Downloaded ${allData.length} result files`);
|
|
499
440
|
* ```
|
|
500
|
-
*
|
|
501
|
-
* @note This method performs concurrent downloads for optimal performance.
|
|
502
|
-
* Individual download failures do not affect other requests and failed downloads
|
|
503
|
-
* are silently excluded from results.
|
|
504
441
|
*/
|
|
505
|
-
|
|
442
|
+
motionDataForActivity(activity: Activity, dataTypes: MotionDataType[]): Promise<MotionData[]>;
|
|
506
443
|
/**
|
|
507
|
-
* Downloads
|
|
444
|
+
* Downloads result data for an activity with a completed analysis.
|
|
508
445
|
*
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
446
|
+
* Use this after `analysisStatus` returns `completed` to retrieve metrics,
|
|
447
|
+
* a report, or raw data. Downloads run concurrently and failed downloads are silently
|
|
448
|
+
* excluded from results.
|
|
449
|
+
*
|
|
450
|
+
* @param dataTypes The analysis result data types to download (for example, `"metrics"`, `"report"`, `"data"`).
|
|
451
|
+
* @param activity The activity to download analysis results from. Must have a completed analysis.
|
|
452
|
+
* @returns An array of `AnalysisData`, one entry per successfully downloaded type.
|
|
453
|
+
* May be empty if no results are available or all downloads fail.
|
|
513
454
|
*
|
|
514
455
|
* @example
|
|
515
456
|
* ```typescript
|
|
516
|
-
* const results = await client.
|
|
457
|
+
* const results = await client.analysisDataForActivity(
|
|
517
458
|
* activity,
|
|
518
459
|
* ["metrics", "report"]
|
|
519
460
|
* );
|
|
@@ -533,42 +474,38 @@ export declare class ModelHealthService {
|
|
|
533
474
|
* }
|
|
534
475
|
* ```
|
|
535
476
|
*
|
|
536
|
-
* @note Individual download failures are silently excluded from results.
|
|
537
477
|
*/
|
|
538
|
-
|
|
478
|
+
analysisDataForActivity(activity: Activity, dataTypes: AnalysisDataType[]): Promise<AnalysisData[]>;
|
|
539
479
|
/**
|
|
540
|
-
*
|
|
480
|
+
* Creates an activity and starts recording a dynamic movement trial.
|
|
541
481
|
*
|
|
542
|
-
*
|
|
543
|
-
*
|
|
482
|
+
* Must be called after both camera and subject calibration are complete.
|
|
483
|
+
* Call `stopRecording` when the subject has finished the movement.
|
|
544
484
|
*
|
|
545
|
-
* @param activityName A descriptive name for this activity (e.g., "cmj
|
|
546
|
-
* @param session The session this activity is associated with
|
|
547
|
-
* @returns The newly created
|
|
548
|
-
* @throws If recording cannot start (
|
|
485
|
+
* @param activityName A descriptive name for this activity (e.g., `"cmj"`, `"squat"`).
|
|
486
|
+
* @param session The session this activity is associated with.
|
|
487
|
+
* @returns The newly created `Activity`.
|
|
488
|
+
* @throws If recording cannot start (e.g., missing calibration).
|
|
549
489
|
*
|
|
550
490
|
* @example
|
|
551
491
|
* ```typescript
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
* // Subject performs CMJ while cameras record
|
|
555
|
-
*
|
|
556
|
-
* // When complete, stop recording
|
|
492
|
+
* const activity = await client.startRecording("cmj", session);
|
|
493
|
+
* // Subject performs movement...
|
|
557
494
|
* await client.stopRecording(session);
|
|
558
495
|
* ```
|
|
559
496
|
*/
|
|
560
|
-
|
|
497
|
+
startRecording(activityName: string, session: Session): Promise<Activity>;
|
|
561
498
|
/**
|
|
562
|
-
* Stops recording
|
|
499
|
+
* Stops the active recording for a movement trial.
|
|
563
500
|
*
|
|
564
|
-
* Call this
|
|
501
|
+
* Call this after the subject has completed the movement. Once stopped, the recorded
|
|
502
|
+
* videos begin uploading and can be tracked with `activityStatus`.
|
|
565
503
|
*
|
|
566
|
-
* @param session The session to stop recording in
|
|
567
|
-
* @throws If
|
|
504
|
+
* @param session The session context to stop recording in.
|
|
505
|
+
* @throws If there is no active recording or the request fails.
|
|
568
506
|
*
|
|
569
507
|
* @example
|
|
570
508
|
* ```typescript
|
|
571
|
-
* // After recording is complete
|
|
572
509
|
* await client.stopRecording(session);
|
|
573
510
|
* ```
|
|
574
511
|
*/
|
|
@@ -576,16 +513,16 @@ export declare class ModelHealthService {
|
|
|
576
513
|
/**
|
|
577
514
|
* Retrieves the current processing status of an activity.
|
|
578
515
|
*
|
|
579
|
-
* Poll this method
|
|
580
|
-
*
|
|
516
|
+
* Poll this method after `stopRecording` to track upload and processing progress.
|
|
517
|
+
* Once the status reaches `ready`, pass the activity to `startAnalysis`.
|
|
581
518
|
*
|
|
582
|
-
* @param activity
|
|
583
|
-
* @returns The current
|
|
584
|
-
* @throws
|
|
519
|
+
* @param activity The activity to check status for.
|
|
520
|
+
* @returns The current `ActivityStatus`.
|
|
521
|
+
* @throws If the request fails.
|
|
585
522
|
*
|
|
586
523
|
* @example
|
|
587
524
|
* ```typescript
|
|
588
|
-
* const status = await client.
|
|
525
|
+
* const status = await client.activityStatus(activity);
|
|
589
526
|
*
|
|
590
527
|
* switch (status.type) {
|
|
591
528
|
* case "ready":
|
|
@@ -603,60 +540,46 @@ export declare class ModelHealthService {
|
|
|
603
540
|
* }
|
|
604
541
|
* ```
|
|
605
542
|
*/
|
|
606
|
-
|
|
543
|
+
activityStatus(activity: Activity): Promise<ActivityStatus>;
|
|
607
544
|
/**
|
|
608
|
-
* Starts an analysis task for
|
|
545
|
+
* Starts an analysis task for an activity that is ready for analysis.
|
|
609
546
|
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
547
|
+
* Call this after `activityStatus` returns `ready`. Use the
|
|
548
|
+
* returned `Analysis` with `analysisStatus` to poll progress.
|
|
612
549
|
*
|
|
613
|
-
* @param analysisType The type of analysis to
|
|
614
|
-
* @param activity The activity to analyze
|
|
615
|
-
* @param session The session containing the activity
|
|
616
|
-
* @returns An
|
|
617
|
-
* @throws
|
|
550
|
+
* @param analysisType The type of analysis to run (for example, `"gait"`, `"counter_movement_jump"`).
|
|
551
|
+
* @param activity The activity to analyze.
|
|
552
|
+
* @param session The session context containing the activity.
|
|
553
|
+
* @returns An `Analysis` for tracking analysis progress.
|
|
554
|
+
* @throws If the activity is not ready or the request fails.
|
|
618
555
|
*
|
|
619
556
|
* @example
|
|
620
557
|
* ```typescript
|
|
621
|
-
* const task = await client.startAnalysis(
|
|
622
|
-
*
|
|
623
|
-
* activity,
|
|
624
|
-
* session
|
|
625
|
-
* );
|
|
626
|
-
*
|
|
627
|
-
* // Poll for completion
|
|
628
|
-
* const status = await client.getAnalysisStatus(task);
|
|
558
|
+
* const task = await client.startAnalysis("counter_movement_jump", activity, session);
|
|
559
|
+
* const status = await client.analysisStatus(task);
|
|
629
560
|
* ```
|
|
630
561
|
*/
|
|
631
|
-
startAnalysis(analysisType: AnalysisType, activity: Activity, session: Session): Promise<
|
|
562
|
+
startAnalysis(analysisType: AnalysisType, activity: Activity, session: Session): Promise<Analysis>;
|
|
632
563
|
/**
|
|
633
564
|
* Retrieves the current status of an analysis task.
|
|
634
565
|
*
|
|
635
|
-
* Poll this method to monitor
|
|
636
|
-
*
|
|
566
|
+
* Poll this method after `startAnalysis` to monitor progress.
|
|
567
|
+
* When status reaches `completed`, download results with `analysisDataForActivity`.
|
|
637
568
|
*
|
|
638
|
-
* @param task The task returned from `startAnalysis
|
|
639
|
-
* @returns The current
|
|
640
|
-
* @throws
|
|
569
|
+
* @param task The task returned from `startAnalysis`.
|
|
570
|
+
* @returns The current `AnalysisStatus`.
|
|
571
|
+
* @throws If the request fails.
|
|
641
572
|
*
|
|
642
573
|
* @example
|
|
643
574
|
* ```typescript
|
|
644
|
-
* const status = await client.
|
|
575
|
+
* const status = await client.analysisStatus(task);
|
|
645
576
|
*
|
|
646
577
|
* switch (status.type) {
|
|
647
578
|
* case "processing":
|
|
648
579
|
* console.log("Analysis running...");
|
|
649
580
|
* break;
|
|
650
581
|
* case "completed":
|
|
651
|
-
*
|
|
652
|
-
* activity,
|
|
653
|
-
* ["metrics", "report"]
|
|
654
|
-
* );
|
|
655
|
-
* const metricsEntry = results.find((r) => r.resultDataType === "metrics");
|
|
656
|
-
* if (metricsEntry?.data) {
|
|
657
|
-
* const metrics = JSON.parse(new TextDecoder().decode(metricsEntry.data));
|
|
658
|
-
* console.log("Metrics:", metrics);
|
|
659
|
-
* }
|
|
582
|
+
* console.log("Analysis complete");
|
|
660
583
|
* break;
|
|
661
584
|
* case "failed":
|
|
662
585
|
* console.log("Analysis failed");
|
|
@@ -664,7 +587,7 @@ export declare class ModelHealthService {
|
|
|
664
587
|
* }
|
|
665
588
|
* ```
|
|
666
589
|
*/
|
|
667
|
-
|
|
590
|
+
analysisStatus(task: Analysis): Promise<AnalysisStatus>;
|
|
668
591
|
/**
|
|
669
592
|
* Parse a WASM response and normalise object keys to camelCase.
|
|
670
593
|
*
|