← Back to Documentation

Official SDKs & Libraries

Official client libraries for integrating with HealthCloud Marketplace in your preferred language.

JavaScript / TypeScript

For Node.js, React, Next.js, and browsers

npm install @healthcloud/sdk
Stablev2.1.0

Python

For Flask, Django, FastAPI, and data science

pip install healthcloud-sdk
Stablev2.1.0

JavaScript / TypeScript SDK

Installation

npm install @healthcloud/sdk

Or using Yarn: yarn add @healthcloud/sdk

Quick Start

import { HealthCloudClient } from '@healthcloud/sdk';

// Initialize the client
const client = new HealthCloudClient({
  apiKey: process.env.HEALTHCLOUD_API_KEY,
  environment: 'production' // or 'sandbox'
});

// Browse marketplace models
const models = await client.marketplace.getAssets({
  type: 'model',
  category: 'diagnostic_imaging',
  limit: 10
});

console.log('Available models:', models);

// Deploy a model
const deployment = await client.models.deploy({
  modelId: 'radiology-classifier-v2',
  environment: 'production',
  fhirResources: ['Observation', 'DiagnosticReport']
});

console.log('Deployment endpoint:', deployment.endpoint);

// Make a prediction
const result = await client.models.predict({
  deploymentId: deployment.id,
  input: {
    imagingStudyId: 'study-123',
    patientId: 'patient-456'
  }
});

console.log('Prediction:', result);

Advanced Features

// Manage favorites
await client.favorites.add('radiology-classifier-v2');
const myFavorites = await client.favorites.list();

// Submit new app
const submission = await client.apps.submit({
  name: 'My AI Model',
  description: 'Advanced diagnostic tool',
  version: '1.0.0',
  type: 'model',
  category: 'diagnostic_imaging',
  pricing: {
    type: 'usage_based',
    costPerRequest: 0.05
  }
});

// MCP integration
const mcpSession = await client.mcp.createSession({
  targetModelId: 'clinical-decision-engine',
  patientId: 'patient-123'
});

const response = await mcpSession.send({
  type: 'inference_request',
  payload: { fhirResources: [diagnosticReport] }
});

// HC Token operations
const balance = await client.tokens.getBalance();
await client.tokens.purchase({ amount: 1000, paymentMethod: 'stripe' });

Python SDK

Installation

pip install healthcloud-sdk

Quick Start

from healthcloud import HealthCloudClient

# Initialize the client
client = HealthCloudClient(
    api_key=os.environ['HEALTHCLOUD_API_KEY'],
    environment='production'
)

# Browse marketplace models
models = client.marketplace.get_assets(
    asset_type='model',
    category='diagnostic_imaging',
    limit=10
)

print(f'Found {len(models)} models')

# Deploy a model
deployment = client.models.deploy(
    model_id='radiology-classifier-v2',
    environment='production',
    fhir_resources=['Observation', 'DiagnosticReport']
)

print(f'Deployment endpoint: {deployment.endpoint}')

# Make a prediction
result = client.models.predict(
    deployment_id=deployment.id,
    input_data={
        'imaging_study_id': 'study-123',
        'patient_id': 'patient-456'
    }
)

print(f'Prediction: {result.prediction}')
print(f'Confidence: {result.confidence}')

Advanced Features

# Manage favorites
client.favorites.add('radiology-classifier-v2')
my_favorites = client.favorites.list()

# Submit new app
submission = client.apps.submit(
    name='My AI Model',
    description='Advanced diagnostic tool',
    version='1.0.0',
    asset_type='model',
    category='diagnostic_imaging',
    pricing={
        'type': 'usage_based',
        'cost_per_request': 0.05
    }
)

# MCP integration
mcp_session = client.mcp.create_session(
    target_model_id='clinical-decision-engine',
    patient_id='patient-123'
)

response = mcp_session.send(
    message_type='inference_request',
    payload={'fhir_resources': [diagnostic_report]}
)

# HC Token operations
balance = client.tokens.get_balance()
client.tokens.purchase(amount=1000, payment_method='stripe')

# Data science integration (pandas, numpy)
import pandas as pd

# Fetch patient observations as DataFrame
observations_df = client.fhir.get_observations_df(
    patient_id='patient-123',
    codes=['8867-4'],  # LOINC code for heart rate
    start_date='2025-01-01',
    end_date='2025-11-02'
)

print(observations_df.describe())

TypeScript Support

The JavaScript SDK includes full TypeScript type definitions for IDE autocomplete and type safety:

import { 
  HealthCloudClient,
  MarketplaceAsset,
  DeploymentConfig,
  FHIRResource
} from '@healthcloud/sdk';

const client = new HealthCloudClient({ apiKey: process.env.API_KEY! });

// Full type safety
const models: MarketplaceAsset[] = await client.marketplace.getAssets({
  type: 'model',
  category: 'diagnostic_imaging'
});

const config: DeploymentConfig = {
  modelId: 'radiology-classifier-v2',
  environment: 'production',
  fhirResources: ['Observation']
};

Error Handling

JavaScript:

try {
  const result = await client.models.predict({
    deploymentId: 'invalid-id',
    input: data
  });
} catch (error) {
  if (error.code === 'NOT_FOUND') {
    console.error('Deployment not found');
  } else if (error.code === 'RATE_LIMIT_EXCEEDED') {
    console.error('Rate limit exceeded, retry after:', error.retryAfter);
  } else {
    console.error('Unexpected error:', error.message);
  }
}

Python:

from healthcloud.exceptions import NotFoundError, RateLimitError

try:
    result = client.models.predict(
        deployment_id='invalid-id',
        input_data=data
    )
except NotFoundError:
    print('Deployment not found')
except RateLimitError as e:
    print(f'Rate limit exceeded, retry after: {e.retry_after}')
except Exception as e:
    print(f'Unexpected error: {e}')

📦 SDK Resources

GitHub Repository

Source code, examples, and issues

Changelog

Version history and release notes

Code Examples

Sample applications and tutorials