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 runcontainer_id(string, required): The HTML element ID where the assessment will be renderedauth_token(string, required): JWT authentication token for API accessrefresh_token(string, required): Token used to refresh the auth token when it expiresparams(object, required): Patient parameters for the assessmentage(number, required): Patient’s agegender(string, required): Patient’s gender (e.g., “M”, “F”, “O”)
practice_info(object, required): Practice and patient identification. See Practice Info Configuration belowtransaction_id(string, optional): Unique transaction identifieronEndCallback(function, optional): Callback function called when assessment endsonSaRedirectCallback(function, optional): Callback function called when assessment redirectsonSaSubmitCallback(function, optional): Callback function called when assessment is submittedonSaInitCallback(function, optional): Callback function called when assessment is initialized
Practice Info Configuration
Thepractice_info object is required and has two different use cases:
Patient-Initiated Assessment
Patient-Initiated Assessment
When a patient is taking the assessment for themselves:Required fields (at least one must be provided):
patient_uuid(string): Unique identifier for the patientunique_identifier(string): Alternative unique identifier for the patient
You can provide either
patient_uuid, unique_identifier, or both.Doctor-Initiated Assessment
Doctor-Initiated Assessment
When a doctor is conducting the assessment for a patient:Required fields:
- At least one patient identifier:
patient_uuid(string): Unique identifier for the patientunique_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.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 displayedauth_token(string, required): JWT authentication token for API accessrefresh_token(string, required): Token used to refresh the auth token when it expiresassessment_ids(string[], required): Array of assessment IDs to display
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
6. getWorkflowList
Fetches the list of available workflows. Parameters:category(string, optional): Optional category filter for workflows
Callback Functions
onSaInitCallback
Called when the assessment is successfully initialized and ready to start. Parameters:onSaCloseCallback (onEndCallback)
Called when the assessment is closed or ended by the user. Parameters:onSaSubmitCallback
Called when the user submits the assessment (completes all questions). Parameters:onSaRedirectCallback
Called when the assessment redirects to a different workflow. Parameters: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 codedisplay_message: User-friendly error messagemessage: Technical error details
AUTH_ERROR: Authentication failedNETWORK_ERROR: Network connection issuesFETCH_ERROR: Data fetching failedVALIDATION_ERROR: Invalid parametersUNKNOWN_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_idmatches 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_tokenandrefresh_tokenare 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_idexists 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
paramsobject includes bothageandgender - Verify
practice_infocontains at least one patient identifier (patient_uuidorunique_identifier) - For doctor-initiated assessments, include
practitioner_uuid

