Self Assessment 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, optional): Additional parameters for the assessment (e.g., age, gender)practice_info
(object, optional): Information about the practice and patienttransaction_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
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_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
andrefresh_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