New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@syncorix/clinical-plugin

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@syncorix/clinical-plugin

Headless Clinical AI SDK

latest
Source
npmnpm
Version
0.3.2
Version published
Maintainers
1
Created
Source

@syncorix/clinical-plugin

Headless SDK for integrating AI-powered clinical consultations into pharmacy and healthcare applications.

Installation

npm install @syncorix/clinical-plugin

Quick Start

import { ClinicalConsultationPlugin } from '@syncorix/clinical-plugin';

const plugin = new ClinicalConsultationPlugin({
  bffUrl: 'https://your-bff-url.railway.app',
  apiKey: 'your-api-key',
  accessTokenKey: 'access_token', // localStorage/sessionStorage key for auth token
  pharmacyCookieKey: 'pharmacy_id' // localStorage/sessionStorage key for pharmacy ID
});

// Initialize consultation
const sessionId = 'unique-session-id';
const response = await plugin.sync(sessionId, {
  patientContext: { age: 30, gender: 'male' },
  vitals: { heartRateBpm: 75, temperatureC: 37.2 },
  consultationId: 'consultation-id'
});

// Send messages (regular JSON response)
const chatResponse = await plugin.sendMessage(sessionId, 'I have a headache');
console.log(chatResponse.nextQuestion);
console.log(chatResponse.differential);

// Send messages with streaming (specialist phase only)
await plugin.sendMessage(sessionId, 'It started 3 days ago', {
  stream: true,
  onStream: (event) => {
    console.log('Streaming event:', event);
    // Update UI progressively as pharmacy AI "thinks"
  }
});

// Finalize consultation
await plugin.finalize(sessionId);

API Reference

Constructor

new ClinicalConsultationPlugin(config: {
  bffUrl: string;
  apiKey: string;
  accessTokenKey?: string;
  pharmacyCookieKey?: string;
})

Methods

sync(sessionId: string, context: ConsultationContext)

Initialize or hydrate a consultation session.

Returns: Initial response with first question

sendMessage(sessionId: string, message: string, options?)

Send a user message and get AI response.

Options:

  • stream?: boolean - Enable SSE streaming (specialist phase only)
  • onStream?: (event: any) => void - Callback for streaming events

Returns:

  • JSON response (default)
  • Void with streaming callbacks (if stream: true)

finalize(sessionId: string)

Complete and persist the consultation to the pharmacy system.

Streaming vs JSON

JSON Mode (Default)

const response = await plugin.sendMessage(sessionId, message);
// Wait for complete response, then update UI

Use when: You want simple request/response pattern

Streaming Mode

await plugin.sendMessage(sessionId, message, {
  stream: true,
  onStream: (event) => {
    // Receive progressive updates
    
    if (event.type === 'token') {
      // Intake phase: progressive token-by-token streaming
      console.log('Token:', event.content);
      console.log('Accumulated:', event.accumulated);
      // Show question appearing word-by-word (ChatGPT style)
    }
    
    if (event.type === 'complete') {
      // Intake phase: final structured data
      console.log('Question:', event.question);
      console.log('Checklist:', event.checklist);
      // Update UI with complete question and checklist status
    }
    
    if (event.question) {
      // Specialist phase: pharmacy AI question
      console.log('Pharmacy question:', event.question);
      console.log('Differential:', event.differential);
      // Update UI with diagnostic information
    }
  }
});

Use when:

  • You want to show progressive "thinking" indicators
  • Better UX for ChatGPT-style appearance
  • Show token-by-token question generation (intake)
  • Show progressive pharmacy AI responses (specialist)

Streaming Event Types:

Intake Phase (OpenAI):

// Progressive tokens
{ type: 'token', content: 'How', accumulated: 'How' }
{ type: 'token', content: ' can', accumulated: 'How can' }
{ type: 'token', content: ' I', accumulated: 'How can I' }
// ... more tokens ...

// Final complete response
{ 
  type: 'complete', 
  question: 'How can I help you today?',
  checklist: { chief_complaint: '', onset: '', ... }
}

Specialist Phase (Pharmacy API):

// Pharmacy API events (format depends on pharmacy API)
{
  question: 'Where is your headache located?',
  differential: [
    { label: 'Migraine', probability: 0.45 },
    { label: 'Tension Headache', probability: 0.35 }
  ],
  text: 'Location Assessment',
  ...
}

Phases

  • Intake Phase: OpenAI asks 6 conversational questions (supports streaming with token-by-token display)
  • Specialist Phase: Pharmacy AI diagnostic questions (supports streaming with progressive updates)

Both phases support streaming and JSON modes. The plugin automatically detects the phase and handles streaming appropriately.

License

MIT import reactDom from 'eslint-plugin-react-dom'

export default defineConfig([ globalIgnores(['dist']), { files: ['**/*.{ts,tsx}'], extends: [ // Other configs... // Enable lint rules for React reactX.configs['recommended-typescript'], // Enable lint rules for React DOM reactDom.configs.recommended, ], languageOptions: { parserOptions: { project: ['./tsconfig.node.json', './tsconfig.app.json'], tsconfigRootDir: import.meta.dirname, }, // other options... }, }, ])

FAQs

Package last updated on 08 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts