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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@syncorix/clinical-plugin

v0.2.2

Published

Headless Clinical AI SDK

Downloads

1,120

Readme

@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

  1. Intake Phase: OpenAI asks 6 conversational questions (supports streaming with token-by-token display)
  2. 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... }, }, ])