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

glucoguard

v0.1.0

Published

TypeScript client for the GlucoGuard diabetes and cardiovascular risk prediction API

Readme

glucoguard — TypeScript/JavaScript SDK

Typed client for the GlucoGuard REST API. Works in Node 18+ and modern browsers. Zero runtime dependencies.

Install

npm install glucoguard
# or
pnpm add glucoguard
# or
yarn add glucoguard

Quick start

import { GlucoGuard } from 'glucoguard';

const gg = new GlucoGuard({ apiKey: 'sk_live_...' });

const result = await gg.predictDiabetes({
  age: 55,
  gender: 0,
  bmi: 30,
  systolic_bp: 140,
  diastolic_bp: 88,
  hba1c: 6.5,
});

console.log(`Risk: ${result.risk_score}% (${result.risk_category})`);
for (const factor of result.top_factors.slice(0, 3)) {
  console.log(`  ${factor.feature}: ${factor.direction} (${factor.shap_value.toFixed(3)})`);
}

Batch predictions

const patients = [
  { age: 55, gender: 0, bmi: 30, systolic_bp: 140, diastolic_bp: 88 },
  { age: 35, gender: 1, bmi: 22, systolic_bp: 118, diastolic_bp: 72 },
];

const result = await gg.predictBatch(patients);

if (GlucoGuard.isInlineResult(result)) {
  console.log(`Processed ${result.total} patients in ${result.processing_time_ms}ms`);
  for (const item of result.results) {
    console.log(`Patient ${item.index}: diabetes ${item.diabetes.risk_score}%`);
  }
}

Webhook batch jobs

For long-running batches, pass a webhookUrl and GlucoGuard will POST the result to your endpoint when complete. The response includes the signed HMAC-SHA256 signature in X-GlucoGuard-Signature.

const ack = await gg.predictBatch(patients, {
  webhookUrl: 'https://your-server.com/glucoguard-hook',
});

if (GlucoGuard.isWebhookResult(ack)) {
  console.log(`Job queued: ${ack.job_id}`);
}

Error handling

Every failure is a typed error. Check with instanceof:

import {
  GlucoGuard,
  AuthenticationError,
  RateLimitError,
  ValidationError,
  GlucoGuardError,
} from 'glucoguard';

try {
  await gg.predictDiabetes(patient);
} catch (err) {
  if (err instanceof AuthenticationError) {
    console.error('Bad API key');
  } else if (err instanceof RateLimitError) {
    console.error('Slow down and retry');
  } else if (err instanceof ValidationError) {
    console.error('Bad request:', err.message);
  } else if (err instanceof GlucoGuardError) {
    console.error(`API error ${err.statusCode}: ${err.message}`);
    console.error(`request_id: ${err.requestId}`);  // useful for support
  }
}

Ops endpoints

await gg.health();                    // public liveness probe
await gg.status();                    // detailed status + model versions
await gg.usage(7);                    // your key's usage over 7 days
await gg.modelInfo('diabetes');       // model metrics + feature importance
await gg.samplePatients();            // pre-configured demo patients

PDF reports

import { writeFile } from 'node:fs/promises';

const bytes = await gg.generatePDFReport({
  patient,
  diabetes_result: diabetesResult,
  cvd_result: cvdResult,
  patient_name: 'Jane Smith',
});
await writeFile('report.pdf', Buffer.from(bytes));

Browser usage

The client uses the built-in fetch API, so it works in modern browsers with zero config. Do not expose your API key in client-side code — always call the API from a trusted backend and proxy requests.

// browser-only — proxy through your own backend
const gg = new GlucoGuard({
  apiKey: 'sk_live_server_proxy_token',
  baseUrl: '/proxy/glucoguard',  // your backend forwards to the real API
});

Node 16 or older

The SDK requires a fetch implementation. Node 18+ has it built in. For older versions:

npm install undici
import { fetch } from 'undici';
import { GlucoGuard } from 'glucoguard';

const gg = new GlucoGuard({
  apiKey: 'sk_live_...',
  fetch: fetch as unknown as typeof globalThis.fetch,
});

TypeScript

Every method is fully typed. The package ships with .d.ts files, so IDE autocompletion works out of the box.

import type { PatientInput, PredictionResult } from 'glucoguard';

function makePatient(): PatientInput {
  return { age: 55, gender: 0, bmi: 30, systolic_bp: 140, diastolic_bp: 88 };
}

Links

  • API docs: https://glucoguard.analyticadss.com/docs
  • Web app: https://glucoguard.analyticadss.com
  • Status: https://glucoguard.analyticadss.com/status.html
  • Issues: mailto:[email protected]

Built by Analytica Data Science Solutions.