@modelhealth/modelhealth 0.1.41 → 0.1.43

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 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, ResultDataType, ResultData, AnalysisResultDataType, AnalysisResultData, AnalysisType, AnalysisTask, AnalysisTaskStatus, ActivityProcessingStatus, CalibrationStatus } from "./types.js";
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 (API key).
120
+ * Retrieves all sessions for the account associated with the API key.
121
121
  *
122
- * @returns An array of `Session` objects. Returns an empty array if no sessions exist.
123
- * @throws If the request fails due to network issues, authentication problems,
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
- * @example
127
- * ```typescript
128
- * try {
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
- * @param sessionId Unique session identifier
144
- * @returns The requested session with complete activity data
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 session = await client.getSession("session-abc123");
150
- * console.log(`Session has ${session.activities.length} activities`);
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
- getSession(sessionId: string): Promise<Session>;
145
+ sessionList(): Promise<Session[]>;
154
146
  /**
155
- * Creates a new session.
147
+ * Creates a session.
156
148
  *
157
- * A session is required before performing camera calibration. It represents
158
- * a single calibration workflow and groups multiple cameras together.
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
- * After creating a session, use camera calibration methods to calibrate your cameras.
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 a camera using a checkerboard pattern.
163
+ * Calibrates cameras using a checkerboard pattern.
183
164
  *
184
- * **Requirements:**
185
- * - A printed checkerboard pattern
186
- * - Accurate measurement of square size in millimeters
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
- * The calibration is automated and typically completes in a few seconds
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 created with `createSession()`
192
- * @param checkerboardDetails Configuration of the calibration checkerboard
193
- * @param statusCallback Callback function called with calibration progress updates
194
- * @throws If calibration fails (insufficient views, pattern not detected, etc.)
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("Calibration status:", status);
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
- * Captures the subject's neutral standing pose for model scaling.
195
+ * Calibrates a subject by recording a neutral standing pose.
216
196
  *
217
- * This step is required after camera calibration and before recording movement activities.
218
- * It takes a quick video of the subject standing in a neutral position, which is
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
- * **Instructions for subject:**
222
- * - Stand upright in a relaxed, natural position
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 the neutral pose for
227
- * @param session The session to perform calibration in
228
- * @param statusCallback Callback function called with calibration progress updates
229
- * @throws If pose capture fails (subject not detected, poor lighting, etc.)
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
- * // After successful camera calibration
234
- * await client.calibrateNeutralPose(subject, session, (status) => {
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
- calibrateNeutralPose(subject: Subject, session: Session, statusCallback: (status: CalibrationStatus) => void): Promise<void>;
215
+ calibrateSubject(subject: Subject, session: Session, statusCallback: (status: CalibrationStatus) => void): Promise<void>;
241
216
  /**
242
- * Retrieves all subjects associated with the account.
217
+ * Retrieves all subjects associated with the API key.
243
218
  *
244
- * Subjects represent individuals being monitored or assessed. Each subject
245
- * contains demographic information, physical measurements, and categorization tags.
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 has expired
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 new subject in the system.
235
+ * Creates a subject profile.
264
236
  *
265
- * Subjects represent individuals being monitored or assessed. After creating
266
- * a subject, they can be associated with sessions for neutral pose calibration
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 Subject details including name, measurements, and tags
270
- * @returns The newly created `Subject` with its assigned ID
271
- * @throws If creation fails (validation errors, duplicate name, etc.)
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 Doe",
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
- * // await client.calibrateNeutralPose(subject, session, (status) => { ... });
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
- * This method allows you to fetch activities associated with a particular subject,
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 (for pagination). Use 0 for first page.
304
- * @param count Number of activities to retrieve per request
305
- * @param sort Sort order for the results (e.g., "updated_at" for most recent first)
306
- * @returns An array of activities for the specified subject
307
- * @throws If the request fails or authentication has expired
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
- * // Get the 20 most recent activities for a subject
312
- * const recentActivities = await client.getActivitiesForSubject(
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
- * // Pagination - get the next 20 activities
320
- * const nextPage = await client.getActivitiesForSubject(
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
- getActivitiesForSubject(subjectId: string, startIndex: number, count: number, sort: ActivitySort): Promise<Activity[]>;
294
+ activitiesForSubject(subjectId: string, startIndex: number, count: number, sort: ActivitySort): Promise<Activity[]>;
329
295
  /**
330
- * Retrieves a specific activity by its ID.
296
+ * Retrieves an activity by its ID.
331
297
  *
332
- * Use this method to fetch the complete details of an activity, including
333
- * its videos, results, and current processing status.
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 requested activity with all its details
337
- * @throws If the activity doesn't exist, or if authentication has expired
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.getActivity("abc123");
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
- getActivity(activityId: string): Promise<Activity>;
312
+ fetchActivity(activityId: string): Promise<Activity>;
348
313
  /**
349
- * Updates an existing activity.
314
+ * Updates an activity.
350
315
  *
351
- * Use this method to modify activity properties such as the name.
352
- * The activity is updated on the server and the updated version is returned.
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 (with modified properties)
355
- * @returns The updated activity as stored on the server
356
- * @throws If the update fails or authentication has expired
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.getActivity("abc123");
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 from the system.
333
+ * Deletes an activity.
373
334
  *
374
- * This permanently removes the activity and all its associated data,
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 authentication has expired
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.getActivity("abc123");
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. All videos, analysis results,
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
- * Activity tags provide a way to categorize and filter activities.
395
- * This method returns all tags configured in the system, which can be
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 available activity tags
399
- * @throws If the request fails or authentication has expired
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.getActivityTags();
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
- getActivityTags(): Promise<ActivityTag[]>;
366
+ activityTags(): Promise<ActivityTag[]>;
413
367
  /**
414
- * Retrieves all movement activities associated with the account.
368
+ * Retrieves all movement activities associated with a session.
415
369
  *
416
- * Activities represent individual recording sessions and contain references to
417
- * captured videos and analysis results. Use this to review past data or
418
- * fetch analysis for completed activities.
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 Session identifier
421
- * @returns An array of `Activity` objects
422
- * @throws If the request fails or authentication has expired
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
- * // Find completed activities ready for analysis
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
- * Download video data for a specific activity.
391
+ * Downloads video data for a specific activity.
442
392
  *
443
- * Asynchronously fetches all videos associated with a given activity that match the specified type.
444
- * Videos with invalid URLs or failed downloads are silently excluded from the result.
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 type of videos to download (default: "synced")
448
- * @returns An array of video data as Uint8Array. The array may be empty if no valid
449
- * videos are available or all downloads fail.
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 = // ... obtained activity
454
- * const videoData = await client.downloadActivityVideos(activity, "raw");
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 This method performs concurrent downloads for optimal performance. Individual download
462
- * failures do not affect other requests.
412
+ * @note Downloads run concurrently. Individual download failures do not affect other requests.
463
413
  */
464
- downloadActivityVideos(activity: Activity, version?: VideoVersion): Promise<Uint8Array[]>;
414
+ videosForActivity(activity: Activity, version?: VideoVersion): Promise<Uint8Array[]>;
465
415
  /**
466
- * Downloads result data files from a processed activity.
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
- * This method is useful when you need access to raw analysis data rather than the
473
- * structured metrics provided by analysis result methods.
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 activity The completed activity to download data from
476
- * @param dataTypes The types of result data to download
477
- * @returns An array of result data, one entry per requested type. Returns an empty array if no
478
- * results are available or all downloads fail.
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.downloadActivityResultData(activity, ["kinematics_mot"]);
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
- downloadActivityResultData(activity: Activity, dataTypes: ResultDataType[]): Promise<ResultData[]>;
442
+ motionDataForActivity(activity: Activity, dataTypes: MotionDataType[]): Promise<MotionData[]>;
506
443
  /**
507
- * Downloads analysis result data for a completed activity.
444
+ * Downloads result data for an activity with a completed analysis.
508
445
  *
509
- * @param activity The activity that has completed analysis
510
- * @param dataTypes The types of analysis result data to download
511
- * @returns An array of analysis result data, one entry per requested type. Returns an empty
512
- * array if no results are available or all downloads fail.
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.downloadActivityAnalysisResultData(
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
- downloadActivityAnalysisResultData(activity: Activity, dataTypes: AnalysisResultDataType[]): Promise<AnalysisResultData[]>;
478
+ analysisDataForActivity(activity: Activity, dataTypes: AnalysisDataType[]): Promise<AnalysisData[]>;
539
479
  /**
540
- * Starts recording a dynamic movement activity.
480
+ * Creates an activity and starts recording a dynamic movement trial.
541
481
  *
542
- * After completing calibration steps (camera calibration and neutral pose),
543
- * use this method to begin recording an activity.
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-test")
546
- * @param session The session this activity is associated with
547
- * @returns The newly created activity
548
- * @throws If recording cannot start (session not calibrated, camera issues, etc.)
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
- * // Record a CMJ session
553
- * const activity = await client.record("cmj-2024", session);
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
- record(activityName: string, session: Session): Promise<Activity>;
497
+ startRecording(activityName: string, session: Session): Promise<Activity>;
561
498
  /**
562
- * Stops recording of a dynamic movement activity in a session.
499
+ * Stops the active recording for a movement trial.
563
500
  *
564
- * Call this method when the subject has completed the movement activity.
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 the activity cannot be stopped (invalid session ID, already stopped, etc.)
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 to determine when an activity is ready for analysis.
580
- * Activities must complete video upload and processing before analysis can begin.
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 A completed activity
583
- * @returns The current processing status
584
- * @throws Network or authentication errors
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.getStatus(activity);
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
- getStatus(activity: Activity): Promise<ActivityProcessingStatus>;
543
+ activityStatus(activity: Activity): Promise<ActivityStatus>;
607
544
  /**
608
- * Starts an analysis task for a completed activity.
545
+ * Starts an analysis task for an activity that is ready for analysis.
609
546
  *
610
- * The activity must have completed processing (status `.ready`) before analysis can begin.
611
- * Use the returned `AnalysisTask` to poll for completion.
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 perform, Gait, Squats, etc
614
- * @param activity The activity to analyze
615
- * @param session The session containing the activity
616
- * @returns An analysis task for tracking completion
617
- * @throws Network or authentication errors
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
- * AnalysisType.CounterMovementJump,
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<AnalysisTask>;
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 analysis progress. When status is `.completed`,
636
- * use `downloadActivityAnalysisResultData` to fetch metrics, report, or raw data.
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 analysis status
640
- * @throws Network or authentication errors
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.getAnalysisStatus(task);
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
- * const results = await client.downloadActivityAnalysisResultData(
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
- getAnalysisStatus(task: AnalysisTask): Promise<AnalysisTaskStatus>;
590
+ analysisStatus(task: Analysis): Promise<AnalysisStatus>;
668
591
  /**
669
592
  * Parse a WASM response and normalise object keys to camelCase.
670
593
  *