Create a new Model Health client.
Configuration options including API key
Retrieves activities for a specific subject with pagination and sorting.
Use this to display a subject's activity history or implement paginated list interfaces.
The ID of the subject whose activities to retrieve.
Zero-based index to start from. Use 0 for the first page.
Number of activities to retrieve per request.
Sort order for the results (for example, "updated_at" for most recent first).
An array of Activity objects, or an empty array if none exist.
Retrieves all movement activities associated with a session.
Activities represent individual recording trials and contain references to captured videos and results. Use this to review past data or fetch results for completed activities.
The session ID to retrieve activities for.
An array of Activity objects, or an empty array if none exist.
Retrieves the current processing status of an activity.
Poll this method after stopRecording to track upload and processing progress.
Once the status reaches ready, pass the activity to startAnalysis.
The activity to check status for.
The current ActivityStatus.
const status = await client.activityStatus(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;
}
Retrieves all available activity tags.
Use the returned tags to populate a tag picker or validate tag values before assigning them to activities.
An array of ActivityTag objects, or an empty array if none are configured.
Downloads result data for an activity with a completed analysis.
Use this after analysisStatus returns completed to retrieve metrics,
a report, or raw data. Downloads run concurrently and failed downloads are silently
excluded from results.
The activity to download analysis results from. Must have a completed analysis.
The analysis result data types to download (for example, "metrics", "report", "data").
An array of AnalysisData, one entry per successfully downloaded type.
May be empty if no results are available or all downloads fail.
const results = await client.analysisDataForActivity(
activity,
["metrics", "report"]
);
for (const result of results) {
switch (result.type) {
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;
}
}
Retrieves the current status of an analysis task.
Poll this method after startAnalysis to monitor progress.
When status reaches completed, download results with analysisDataForActivity.
The task returned from startAnalysis.
The current AnalysisStatus.
Downloads the prepared archive as raw ZIP data.
Call this after archiveStatus returns ready. The download URL is
managed internally and cached for the lifetime of the WASM instance.
The archive returned from prepareArchive.
The raw ZIP file bytes as a Uint8Array.
Retrieves the current status of an archive preparation task.
Poll this method after prepareArchive until the status is ready,
then download the archive with archiveData.
The archive returned from prepareArchive.
The current ArchiveStatus.
Calibrates cameras using a checkerboard pattern.
Determines each camera's position and orientation in 3D space (extrinsics), enabling reconstruction of real-world movement from multiple 2D video feeds. Required once per session setup — recalibrate only if cameras are moved.
Note:
rowsandcolumnsrefer to internal corners, not squares. A 5×6 board has 4 internal corner rows and 5 internal corner columns.
The session context in which calibration is performed.
The checkerboard dimensions and placement used for calibration.
Callback called with progress updates during calibration.
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(status);
});
Calibrates a subject by recording a neutral standing pose.
Scales the 3D biomechanical model to the subject's body size. Must be run after camera calibration and requires the subject profile to include height and weight.
Important: The subject must stand upright, feet pointing forward, completely still, and fully visible to all cameras for the duration of the recording.
The subject to calibrate.
The session context in which calibration is performed.
Callback called with calibration status updates.
Applies settings to an existing session.
Call this after createSession and before calibration to override any
default settings. If not called, the session retains the defaults applied
during creation.
All fields in config are optional — omit any field to keep its default.
The session to configure.
The settings to apply. Pass {} to keep all defaults.
Creates a session.
A session is the parent container for a movement capture workflow. It links related entities such as activities and subjects and provides the context used by subsequent operations.
A new Session with a unique identifier.
Creates a subject profile.
Height and weight are required for biomechanical analysis. Once created, the subject
can be calibrated using calibrateSubject.
The subject profile details including name and anthropometrics.
The newly created Subject with its assigned ID.
const params: SubjectParameters = {
name: "John Smith",
weight: 75.0, // kilograms
height: 180.0, // centimeters
birthYear: 1990,
};
const subject = await client.createSubject(params);
console.log(`Created subject with ID: ${subject.id}`);
// Use the subject for calibration
await client.calibrateSubject(subject, session, (status) => {
console.log(status);
});
Deletes an activity.
Permanently removes the activity and all associated videos, results and metadata.
The activity to delete.
Retrieves an activity by its ID.
Use this to fetch the latest state of an activity, including its videos, results, and current processing status.
The unique identifier of the activity.
The Activity with its current details.
Imports a set of trials into a new session.
Performs the full import workflow: session creation, configuration, subject association, trial creation, video download and upload, processing trigger and polling until complete for each trial.
Progress is reported via statusCallback with ImportStatus values.
A JSON array of trial objects to import.
The subject to associate with the session.
Session configuration. Pass {} for defaults.
Callback called with progress updates. Defaults to no-op.
The Session containing all imported trials.
const session = await client.importSession(
activitiesJson,
subject,
null,
{ framerate: 60 },
(status) => {
switch (status.type) {
case "creating_session":
console.log("Creating session...");
break;
case "uploading_video":
console.log(`[${status.trial}] ${status.uploaded}/${status.total}`);
break;
case "processing":
console.log("Processing...");
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.
Downloads motion data from a processed activity.
Use this after an activity reaches ready status to retrieve biomechanical result files
such as kinematics, marker data, or an OpenSim model. Downloads run concurrently and
failed downloads are silently excluded from results.
The activity to download data from. Must have completed processing.
The motion data types to download (for example, "kinematics_mot", "markers", "animation").
An array of MotionData, one entry per successfully downloaded type. May be empty
if no results are available or all downloads fail.
Begins preparing a session archive.
Kicks off a server-side task that packages the session data into a ZIP file.
Poll archiveStatus until the status is ready, then download the archive
with archiveData.
The session to archive.
Whether to include raw videos in the archive. Defaults to false.
An Archive for tracking archive preparation progress.
Retrieves all sessions for the account associated with the API key.
Use this to list existing sessions before creating a new one, or to resume a previous capture workflow.
To connect a device to a specific session, use the session qrcode URL to download
the QR code image data, then display it in your app to be captured by the ModelHealth
mobile app.
An array of Session objects, or an empty array if none exist.
const sessions = await client.sessionList();
console.log(`Found ${sessions.length} sessions`);
const firstSession = sessions[0];
if (firstSession?.qrcode) {
const response = await fetch(firstSession.qrcode);
const qrCodeImageData = new Uint8Array(await response.arrayBuffer());
// Display qrCodeImageData in your app so the mobile app can scan it
}
Starts an analysis task for an activity that is ready for analysis.
Call this after activityStatus returns ready. Use the
returned Analysis with analysisStatus to poll progress.
The type of analysis to run (for example, "gait", "counter_movement_jump").
The activity to analyze.
The session context containing the activity.
An Analysis for tracking analysis progress.
Creates an activity and starts recording a dynamic movement trial.
Must be called after both camera and subject calibration are complete.
Call stopRecording when the subject has finished the movement.
A descriptive name for this activity (e.g., "cmj", "squat").
The session this activity is associated with.
Optionalconfig: ActivityConfigOptional recording configuration.
The newly created Activity.
Stops the active recording for a movement trial.
Call this after the subject has completed the movement. Once stopped, the recorded
videos begin uploading and can be tracked with activityStatus.
The session context to stop recording in.
Retrieves all subjects associated with the API key.
Subjects represent individuals being monitored or assessed. Each subject may contain demographic information, physical measurements and categorization tags.
An array of Subject objects, or an empty array if none exist.
Updates an activity.
Only mutable fields (such as name) are applied on the server. The server-side
state is returned, so use the result rather than the input going forward.
The activity to update, with modified properties.
The updated Activity as stored on the server.
Downloads video data for a specific activity.
Fetches all videos associated with the activity that match the specified version. Downloads run concurrently. Videos with invalid URLs or failed downloads are silently excluded from the result.
The activity whose videos should be downloaded.
The version of videos to download (for example, "raw" or "synced").
An array of Uint8Array objects. May be empty if no videos are available
or all downloads fail.
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