Create a new Model Health client.
Configuration options including API key
Retrieves all movement activities associated with the account.
Activities represent individual recording sessions and contain references to captured videos and analysis results. Use this to review past data or fetch analysis for completed activities.
Session identifier
An array of Activity objects
const activities = await client.activityList(session.id);
// Find completed activities ready for analysis
const completed = activities.filter(t => t.status === "completed");
// Access videos and results
for (const activity of completed) {
console.log(`Activity: ${activity.name ?? activity.id}`);
console.log(`Videos: ${activity.videos.length}`);
console.log(`Results: ${activity.results.length}`);
}
Calibrates a camera using a checkerboard pattern.
Requirements:
The calibration is automated and typically completes in a few seconds
The session created with createSession()
Configuration of the calibration checkerboard
Callback function called with calibration progress updates
const session = await client.createSession();
const details: CheckerboardDetails = {
rows: 4, // Internal corners, not squares (for 5×6 board)
columns: 5, // Internal corners, not squares (for 5×6 board)
squareSize: 35, // Measured in millimeters
placement: "perpendicular"
};
await client.calibrateCamera(session, details, (status) => {
console.log("Calibration status:", status);
});
// Calibration complete, proceed to neutral pose
Captures the subject's neutral standing pose for model scaling.
This step is required after camera calibration and before recording movement activities. It takes a quick video of the subject standing in a neutral position, which is used to scale the biomechanical model to match the subject's dimensions.
Instructions for subject:
The subject to calibrate the neutral pose for
The session to perform calibration in
Callback function called with calibration progress updates
Creates a new session.
A session is required before performing camera calibration. It represents a single calibration workflow and groups multiple cameras together.
After creating a session, use camera calibration methods to calibrate your cameras.
A Session object with a unique identifier
Creates a new subject in the system.
Subjects represent individuals being monitored or assessed. After creating a subject, they can be associated with sessions for neutral pose calibration and movement activities.
Subject details including name, measurements, and tags
The newly created Subject with its assigned ID
const params: SubjectParameters = {
name: "John Doe",
weight: 75.0, // kilograms
height: 180.0, // centimeters
birthYear: 1990,
gender: "man",
sexAtBirth: "man",
characteristics: "Regular training schedule",
subjectTags: ["athlete"],
terms: true
};
const subject = await client.createSubject(params);
console.log(`Created subject with ID: ${subject.id}`);
// Use the subject for calibration
// await client.calibrateNeutralPose(subject, session, (status) => { ... });
Deletes an activity from the system.
This permanently removes the activity and all its associated data, including videos and analysis results. This action cannot be undone.
The activity to delete
Downloads analysis result data for a completed activity.
The activity that has completed analysis
The types of analysis result data to download
An array of analysis result data, one entry per requested type. Returns an empty array if no results are available or all downloads fail.
const results = await client.downloadActivityAnalysisResultData(
activity,
["metrics", "report"]
);
for (const result of results) {
switch (result.resultDataType) {
case "metrics":
const json = JSON.parse(new TextDecoder().decode(result.data));
break;
case "report":
// Use result.data directly as a PDF
break;
case "data":
// Use result.data directly as a ZIP file
break;
}
}
Downloads result data files from a processed activity.
After an activity completes processing, various result files become available for download. Use this method to retrieve specific types of data (kinematic measurements, visualizations) in their native file formats (JSON, CSV).
This method is useful when you need access to raw analysis data rather than the structured metrics provided by analysis result methods.
The completed activity to download data from
The types of result data to download
An array of result data, one entry per requested type. Returns an empty array if no results are available or all downloads fail.
// Download kinematics in MOT format
const results = await client.downloadActivityResultData(activity, ["kinematics_mot"]);
for (const result of results) {
switch (result.resultDataType) {
case "kinematics_mot":
// Use result.data directly as a .mot file
break;
}
}
// Download multiple types in one call
const allData = await client.downloadActivityResultData(
activity,
["kinematics_mot", "animation"]
);
console.log(`Downloaded ${allData.length} result files`);
Download video data for a specific activity.
Asynchronously fetches all videos associated with a given activity that match the specified type. Videos with invalid URLs or failed downloads are silently excluded from the result.
The activity whose videos should be downloaded
The version type of videos to download (default: "synced")
An array of video data as Uint8Array. The array may be empty if no valid videos are available or all downloads fail.
Retrieves activities for a specific subject with pagination and sorting.
This method allows you to fetch activities associated with a particular subject, with control over pagination and sort order. This is useful for displaying activity history or implementing infinite scroll interfaces.
The ID of the subject whose activities to retrieve
Zero-based index to start from (for pagination). Use 0 for first page.
Number of activities to retrieve per request
Sort order for the results (e.g., "updated_at" for most recent first)
An array of activities for the specified subject
Retrieves a specific activity by its ID.
Use this method to fetch the complete details of an activity, including its videos, results, and current processing status.
The unique identifier of the activity
The requested activity with all its details
Retrieves all available activity tags.
Activity tags provide a way to categorize and filter activities. This method returns all tags configured in the system, which can be used for filtering or organizing activities in your application.
An array of available activity tags
Retrieves the current status of an analysis task.
Poll this method to monitor analysis progress. When status is .completed,
use downloadActivityAnalysisResultData to fetch metrics, report, or raw data.
The task returned from startAnalysis
The current analysis status
const status = await client.getAnalysisStatus(task);
switch (status.type) {
case "processing":
console.log("Analysis running...");
break;
case "completed":
const results = await client.downloadActivityAnalysisResultData(
activity,
["metrics", "report"]
);
const metricsEntry = results.find((r) => r.resultDataType === "metrics");
if (metricsEntry?.data) {
const metrics = JSON.parse(new TextDecoder().decode(metricsEntry.data));
console.log("Metrics:", metrics);
}
break;
case "failed":
console.log("Analysis failed");
break;
}
Retrieve a specific session by ID with all activities populated.
Unique session identifier
The requested session with complete activity data
Retrieves the current processing status of an activity.
Poll this method to determine when an activity is ready for analysis. Activities must complete video upload and processing before analysis can begin.
A completed activity
The current processing status
const status = await client.getStatus(activity);
switch (status.type) {
case "ready":
console.log("Activity ready for analysis");
break;
case "processing":
console.log("Still processing...");
break;
case "uploading":
console.log(`Uploaded ${status.uploaded}/${status.total} videos`);
break;
case "failed":
console.log("Processing failed");
break;
}
Initialize the WASM module and client.
Must be called before using any other methods if autoInit: false
was specified in the configuration. Safe to call multiple times.
Starts recording a dynamic movement activity.
After completing calibration steps (camera calibration and neutral pose), use this method to begin recording an activity.
A descriptive name for this activity (e.g., "cmj-test")
The session this activity is associated with
The newly created activity
Retrieves all sessions for the account (API key).
An array of Session objects. Returns an empty array if no sessions exist.
Starts an analysis task for a completed activity.
The activity must have completed processing (status .ready) before analysis can begin.
Use the returned AnalysisTask to poll for completion.
The type of analysis to perform, Gait, Squats, etc
The activity to analyze
The session containing the activity
An analysis task for tracking completion
Stops recording of a dynamic movement activity in a session.
Call this method when the subject has completed the movement activity.
The session to stop recording in
Retrieves all subjects associated with the account.
Subjects represent individuals being monitored or assessed. Each subject contains demographic information, physical measurements, and categorization tags.
An array of Subject objects
Updates an existing activity.
Use this method to modify activity properties such as the name. The activity is updated on the server and the updated version is returned.
The activity to update (with modified properties)
The updated activity as stored on the server
Model Health SDK Client for biomechanical analysis.
Main entry point for interacting with the Model Health SDK. Provides authentication, session management, data download, and analysis capabilities.
Example: Create with API key
Example: With custom configuration