npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

bridge-iq-client

v1.0.4

Published

Node.js client for ThakaaMed's imaging AI service

Readme

BridgeIQ Client for Node.js

npm License Node.js Version

A Node.js client library for ThakaaMed's Bridge IQ imaging AI analysis service. This library provides a seamless interface to ThakaaMed's radiography analysis API.

About ThakaaMed

ThakaaMed is a pioneering Saudi Arabian healthcare technology company founded in February 2023, dedicated to transforming healthcare through artificial intelligence. As Saudi Arabia's first homegrown medical AI company, ThakaaMed focuses on developing comprehensive artificial intelligence solutions for the healthcare sector, with primary emphasis on medical imaging diagnostics.

Installation

npm install bridge-iq-client
# or
yarn add bridge-iq-client
# or
pnpm add bridge-iq-client

Quick Start

// Using CommonJS
const { BridgeIQClient } = require('bridge-iq-client');

// Using ES Modules
import { BridgeIQClient } from 'bridge-iq-client';

// Initialize client with your credentials
const client = new BridgeIQClient(
  'your_client_id',
  'your_client_secret',
  'your_device_path',
  'base_url'
);

// Check if the API is available
async function checkApiHealth() {
  const isHealthy = await client.healthCheck();
  console.log(`API is ${isHealthy ? 'healthy' : 'unhealthy'}`);
}

// Send an image for analysis
async function analyzeImage() {
  try {
    // Send the image
    const analysis = await client.sendAnalysis(
      'path/to/radiograph.dcm',
      'P12345',          // Optional patient ID
      'John Doe',        // Optional patient name
      'M',               // Optional patient gender
      '1990-01-01',      // Optional patient date of birth
      'panoramic_adult'  // Optional radiography type
    );
    
    console.log(`Analysis submitted with request ID: ${analysis.request_id}`);
    
    // Wait for the analysis to complete
    const status = await client.waitForCompletion(
      analysis.request_id,
      300000,  // 5 minutes timeout
      5000     // Check every 5 seconds
    );
    
    console.log(`Analysis status: ${status.analysis_status}`);
    
    // If completed, download the PDF report
    if (status.isCompleted && status.hasPdf) {
      const pdfPath = await client.downloadReport(
        status.report_pdf_link,
        './patient_report.pdf'
      );
      console.log(`Report downloaded to ${pdfPath}`);
    }
  } catch (error) {
    console.error('Error:', error.message);
  }
}

Examples

The package includes comprehensive examples in the examples directory:

# Run the full demo script
node examples/demo.js

The demo script showcases:

  • Client initialization and API health checks
  • Processing single images
  • Processing multiple images in parallel with AsyncBridgeIQClient
  • PDF generation with automated waiting and retry mechanisms
  • Error handling and reporting

For more details, see the README.md file in the examples directory.

Features

  • Simple API for radiography analysis
  • Automatic handling of authentication
  • Progress tracking for analysis requests
  • PDF report download
  • Comprehensive error handling
  • Detailed logging
  • TypeScript support with full type definitions
  • Cross-platform compatibility

Supported Radiography Types

  • panoramic_adult - Panoramic radiograph for adults
  • panoramic_kid - Panoramic radiograph for children
  • bitewing - Bitewing radiograph
  • periapical - Periapical radiograph
  • cbct - Coming soon
  • ceph - Coming soon

Advanced Usage

Custom Environment Configuration

import { BridgeIQClient, Environment } from 'bridge-iq-client';

// For development or testing
const client = new BridgeIQClient(
  'your_client_id',
  'your_client_secret',
  'your_device_path',
  'base_url',
  Environment.TESTING
);

Using the AsyncBridgeIQClient

import { AsyncBridgeIQClient } from 'bridge-iq-client';

// Though the regular client is already Promise-based in Node.js,
// this class is provided for API compatibility with the Python version.
const client = new AsyncBridgeIQClient(
  'your_client_id',
  'your_client_secret',
  'your_device_path',
  'base_url'
);

// The API is the same as the regular client
const analysis = await client.sendAnalysis('path/to/image.dcm');

Custom Logging

import { BridgeIQClient, Logger, LogLevel } from 'bridge-iq-client';

// Configure a custom logger with debug level
const logger = new Logger('my-app', LogLevel.DEBUG, true, './logs/bridge-iq.log');

// Pass logger to client
const client = new BridgeIQClient(
  'your_client_id',
  'your_client_secret',
  'your_device_path',
  'base_url',
  'production',
  120000,   // 2 minutes timeout
  3,        // Max retries
  logger
);

Error Handling

import { 
  BridgeIQClient, 
  BridgeIQError,
  AuthenticationError,
  ConnectionError,
  ValidationError
} from 'bridge-iq-client';

async function safeAnalysis() {
  try {
    const analysis = await client.sendAnalysis('path/to/image.dcm');
    return analysis;
  } catch (error) {
    if (error instanceof AuthenticationError) {
      console.error('Authentication failed. Check your credentials.');
    } else if (error instanceof ConnectionError) {
      console.error('Could not connect to the API. Check your internet connection.');
    } else if (error instanceof ValidationError) {
      console.error('Invalid parameters:', error.message);
    } else if (error instanceof BridgeIQError) {
      console.error('API error:', error.message);
      console.error('Response:', error.response);
    } else {
      console.error('Unexpected error:', error);
    }
    throw error;
  }
}

API Reference

The library provides the following main classes:

BridgeIQClient

Main client for interacting with the BridgeIQ API.

Methods

  • healthCheck(): Check if the API is available
  • sendAnalysis(imagePath, patientId?, patientName?, patientGender?, patientDob?, radiographyType?, callbackUrl?, reportType?): Send an image for analysis
  • checkStatus(requestId): Check the status of an analysis
  • waitForCompletion(requestId, timeout?, pollInterval?): Wait for an analysis to complete
  • downloadReport(reportUrl, outputPath): Download a PDF report

AsyncBridgeIQClient

Asynchronous client with the same interface as BridgeIQClient. In Node.js, this is provided for API compatibility with the Python library, as the regular client is already Promise-based.

Development

Building the Library

# Install dependencies
npm install

# Build the library
npm run build

# Run tests
npm test

# Lint the code
npm run lint

# Format the code
npm run format

Publishing to NPM

# Using the publish script (recommended)
./scripts/publish.sh --test      # Publish with 'next' tag
./scripts/publish.sh --production # Publish with 'latest' tag

# Or manually
npm run build
npm publish

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, please contact [email protected] or visit our website.