Skip to main content

Assessment TS SDK Implementation

This guide provides everything you need to integrate the Self Assessment SDK into your application.

Overview

The Self Assessment SDK allows you to integrate intelligent assessment workflows into your healthcare applications. It provides:
  • Interactive Assessments: Run dynamic, workflow-based patient assessments
  • Flexible Workflows: Support for multiple assessment workflows and categories

Installation

Prerequisites

  • A modern web browser
  • A web server or development environment
  • Valid authentication tokens from your Self Assessment provider

Setup

Add the SDK script directly to your HTML:

Core Functions

1. runSaApp

Initializes and runs a Self Assessment application. Parameters:
  • workflow_id (number, required): The ID of the assessment workflow to run
  • container_id (string, required): The HTML element ID where the assessment will be rendered
  • auth_token (string, required): JWT authentication token for API access
  • refresh_token (string, required): Token used to refresh the auth token when it expires
  • params (object, required): Patient parameters for the assessment
    • age (number, required): Patient’s age
    • gender (string, required): Patient’s gender (e.g., “M”, “F”, “O”)
  • practice_info (object, required): Practice and patient identification. See Practice Info Configuration below
  • transaction_id (string, optional): Unique transaction identifier
  • onEndCallback (function, optional): Callback function called when assessment ends
  • onSaRedirectCallback (function, optional): Callback function called when assessment redirects
  • onSaSubmitCallback (function, optional): Callback function called when assessment is submitted
  • onSaInitCallback (function, optional): Callback function called when assessment is initialized

Practice Info Configuration

The practice_info object is required and has two different use cases:
When a patient is taking the assessment for themselves:Required fields (at least one must be provided):
  • patient_uuid (string): Unique identifier for the patient
  • unique_identifier (string): Alternative unique identifier for the patient
You can provide either patient_uuid, unique_identifier, or both.
When a doctor is conducting the assessment for a patient:Required fields:
  • At least one patient identifier:
    • patient_uuid (string): Unique identifier for the patient
    • unique_identifier (string): Alternative unique identifier for the patient
  • practitioner_uuid (string): Unique identifier for the doctor/practitioner
When practitioner_uuid is included, the assessment is associated with the doctor’s practice.
Examples:

2. closeSaApp

Closes the currently running Self Assessment application. Example:

3. showSaSubmission

Displays assessment submission data in a modal or container. Parameters:
  • container_id (string, required): The HTML element ID where the submission will be displayed
  • auth_token (string, required): JWT authentication token for API access
  • refresh_token (string, required): Token used to refresh the auth token when it expires
  • assessment_ids (string[], required): Array of assessment IDs to display
Example:

4. closeSaSubmissionApp

Closes the currently displayed submission application. Example:

5. fetchAssessment

Fetches assessment data from the server. Parameters:
  • status (string, required): The status of assessments to fetch (e.g., ‘COMPLETED’, ‘PENDING’)
  • unique_identifier (string, required): Unique identifier for the assessment
Example:

6. getWorkflowList

Fetches the list of available workflows. Parameters:
  • category (string, optional): Optional category filter for workflows
Example:

Callback Functions

onSaInitCallback

Called when the assessment is successfully initialized and ready to start. Parameters:
Example:

onSaCloseCallback (onEndCallback)

Called when the assessment is closed or ended by the user. Parameters:
Example:

onSaSubmitCallback

Called when the user submits the assessment (completes all questions). Parameters:
Example:

onSaRedirectCallback

Called when the assessment redirects to a different workflow. Parameters:
Example:

Complete Implementation Example

Type Definitions

TRunSaApp

TShowSaSubmission

Assessment Response

Workflow List Response

Error Handling

All functions return consistent error objects with:
  • error_code: Machine-readable error code
  • display_message: User-friendly error message
  • message: Technical error details
Common Error Codes:
  • AUTH_ERROR: Authentication failed
  • NETWORK_ERROR: Network connection issues
  • FETCH_ERROR: Data fetching failed
  • VALIDATION_ERROR: Invalid parameters
  • UNKNOWN_ERROR: Unexpected errors

Troubleshooting

Common Issues

1. Container Not Found

Problem: Assessment doesn’t appear in the container. Solution:
  • Ensure the container element exists before calling runSaApp
  • Check that container_id matches the actual HTML element ID
  • Make sure the container has proper dimensions

2. Authentication Errors

Problem: Assessment fails to initialize due to auth issues. Solution:
  • Verify your auth_token and refresh_token are valid
  • Check that tokens haven’t expired
  • Ensure you’re using the correct authentication flow for Self Assessment

3. Workflow Not Found

Problem: Assessment fails with workflow-related errors. Solution:
  • Verify the workflow_id exists and is accessible
  • Use getWorkflowList() to see available workflows
  • Check if the workflow requires specific parameters

4. Missing Required Parameters

Problem: Assessment fails to initialize due to missing parameters. Solution:
  • Ensure params object includes both age and gender
  • Verify practice_info contains at least one patient identifier (patient_uuid or unique_identifier)
  • For doctor-initiated assessments, include practitioner_uuid