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

ymed-api

v1.0.0

Published

Official client for YMed Medical Conversation and Diagnosis APIs

Readme

ymed-api

Official JavaScript/TypeScript client for the YMed Medical Conversation and Diagnosis APIs. Use it to extract structured clinical data from doctor–patient conversations and to get AI-powered differential diagnoses.

  • Medical Conversation: Send a transcript → get structured fields (chief complaints, medications, vitals, etc.).
  • Diagnosis: Send symptoms and optional patient context → get primary and alternative diagnoses with likelihoods.

Get your API key at developers.ymed.ai.

Install

npm install ymed-api

Requires Node.js 18+ (uses native fetch).

Quick start

const { YMedClient } = require('ymed-api');

const client = new YMedClient({
  apiKey: process.env.YMED_API_KEY,
  // baseUrl: 'https://v1.api.ymed.ai',  // optional, this is the default
});

// Extract structured data from a medical conversation
const extracted = await client.extractMedicalConversation({
  conversation: 'Doctor: What brings you in? Patient: Fever and cough for 3 days. Doctor: Any medications? Patient: Lisinopril for blood pressure.',
});
console.log(extracted.data.chiefComplaints);  // ['Fever', 'cough']
console.log(extracted.data.medications);      // ['Lisinopril for blood pressure']

// Get a differential diagnosis
const diagnosis = await client.getDiagnosis({
  symptoms: ['fever', 'cough'],
  patientAge: 35,
  patientSex: 'male',
});
console.log(diagnosis.data.primaryDiagnosis);
console.log(diagnosis.data.alternativeDiagnoses);

TypeScript

Types are included. Example with explicit types:

import { YMedClient, type MedicalConversationData, type DiagnosisData } from 'ymed-api';

const client = new YMedClient({ apiKey: process.env.YMED_API_KEY! });

const res = await client.extractMedicalConversation({
  conversation: 'Doctor: What brings you in? Patient: Headache and fever.',
});
const data: MedicalConversationData = res.data;

API

new YMedClient(options)

| Option | Type | Required | Default | Description | |-----------|--------|----------|--------------------------|--------------------------------| | apiKey | string | Yes | — | API key from YMed Developers | | baseUrl | string | No | https://v1.api.ymed.ai | API base URL | | timeout | number | No | 60000 | Request timeout in milliseconds |

client.extractMedicalConversation(params)

  • params.conversation (string, required): Full medical conversation transcript.
  • Returns: Promise<MedicalConversationResponse> with success, data (chief complaints, medications, vitals, etc.), and metadata.responseTime.

client.getDiagnosis(params)

  • params.symptoms (string[], required): At least one symptom.
  • params.patientAge (number, optional)
  • params.patientSex ('male' | 'female' | 'other', optional)
  • params.medicalHistory (string[], optional)
  • params.currentMedications (string[], optional)
  • params.vitalSigns (object with temperature, bloodPressure, heartRate, respiratoryRate, optional)
  • Returns: Promise<DiagnosisResponse> with success, data.primaryDiagnosis, data.alternativeDiagnoses, and metadata.responseTime.

Error handling

On HTTP errors (4xx/5xx), the client throws YMedApiError with:

  • message: Error message from the API or a generic one.
  • statusCode: HTTP status (e.g. 401, 429, 500).
  • body: Parsed error body when available (error, message, details).
const { YMedClient, YMedApiError } = require('ymed-api');

const client = new YMedClient({ apiKey: 'ymed_...' });

try {
  const res = await client.extractMedicalConversation({ conversation: '...' });
  console.log(res.data);
} catch (err) {
  if (err instanceof YMedApiError) {
    if (err.statusCode === 401) console.error('Invalid API key');
    if (err.statusCode === 429) console.error('Rate limit exceeded');
    console.error(err.message, err.body);
  }
  throw err;
}

Rate limits

Rate limits are per API key and set in the Developers Portal. When exceeded, the API returns 429 and the client throws YMedApiError with statusCode: 429.

Links

License

MIT