1.0.6 • Published 1 year ago

aitriage-sdk-dev v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Aitriage SDK (JavaScript)

Overview

The Aitriage SDK is a JavaScript library designed to simplify integration with the Aitriage API. It provides convenient methods for authentication, retrieval, and management of data related to medical assessments and patient information.

Features

  • Authentication: Secure login using API keys.
  • Assessment Management:
    • Fetch lists of assessments and detailed information for specific assessments.
    • Retrieve segments (parts) of assessments.
    • Export assessment reports as PDF files.
  • Patient Management:
    • Fetch lists of patients and detailed information for specific patients.
    • Retrieve notes associated with patients.

Installation

Install the Aitriage SDK using npm or yarn:

npm install aitriage-sdk
# or
yarn add aitriage-sdk

Usage

Follow these steps to integrate and use the Aitriage SDK in your JavaScript project:

  1. Import and Initialize:

    import { AitriageSdk, MODE } from 'aitriage-sdk'
    
    const apiKey = 'YOUR_API_KEY'
    const accountNo = 'YOUR_ACCOUNT_NO'
    
    const aitriageSdk = new AitriageSdk(apiKey, accountNo, MODE.DEVELOPMENT) // Or MODE.PRODUCTION for production environment
  2. Authenticate:

    const loginResponse = await aitriageSdk.loginByApiKey()
  3. Interact with the API:

    try {
        const assessmentQuery = { limit: 10, page: 1 }
        const assessments = await aitriageSdk.getListAssessment(assessmentQuery)
        console.log('Assessments:', assessments)
    
        const patientDetails = await aitriageSdk.getDetailPatient('CUSTOMER_ID')
        console.log('Patient details:', patientDetails)
    
        // ... Use other SDK methods as needed (see API Reference)
    } catch (error) {
        console.error('API Error:', error)
        // Handle API errors appropriately
    }

Important Notes

  • Authentication is Key: Always call loginByApiKey() before using other SDK methods. This ensures proper authentication and authorization for your API requests.
  • Asynchronous Operations: Many SDK methods (e.g., getListAssessment, getDetailPatient) are asynchronous. Use await within async functions or .then() to handle their results and potential errors.
  • Error Handling: Implement robust error handling around SDK method calls. Catch and handle errors to prevent your application from crashing and to provide informative feedback to users.
  • Rate Limits: Be aware of the Aitriage API's rate limits to avoid exceeding them. If you encounter rate limiting errors, implement backoff strategies to retry requests after a delay.
  • Type Definitions: Leverage the TypeScript type definitions included in the SDK to get autocompletion, type checking, and better code maintainability. Refer to the types.ts file for details on available types.
1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago