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

pgs_catalog_sdk

v1.1.5

Published

Retrieves polygenic scores from the PGS Catalog.

Readme

pgs_catalog_sdk

Browser-first JavaScript SDK for retrieving PGS Catalog score and trait data, caching it with localforage, and powering the included demo dashboard.

Live demo

https://lorenasandoval88.github.io/pgs_catalog_sdk/

Documentation

Additional usage notes are available in the project wiki.

Quick start

Test the published bundle directly in a browser console:

const sdk = await import("https://lorenasandoval88.github.io/pgs_catalog_sdk/dist/sdk.mjs");

const scores = await sdk.fetchAllScores();
const categories = await sdk.getScoresPerCategory();

console.log({ scores, categories });

Project structure

  • sdk.js: public SDK entry point.
  • src/js/getPGS_loadScores.js: score loading, caching, summaries, and category/trait aggregations.
  • src/js/getPGS_loadTraits.js: trait loading, caching, and summary generation.
  • src/js/getPGS_loadTxts.js: scoring file download and cache management.
  • src/js/landingPage.js: dashboard rendering helpers and high-level stats loaders.
  • src/js/storage.js: storage inspection utilities.
  • src/js/getPGS_main.js: demo-page bootstrap.
  • src/css/styles.css: demo-page styles.
  • dist/: generated browser bundles.

Build and run

Install dependencies and build the bundles:

npm install
npm run build

The build generates:

  • dist/loadScores.bundle.mjs
  • dist/loadTraits.bundle.mjs
  • dist/main.mjs
  • dist/sdk.mjs

To try the demo locally, serve the repository root with any static file server and open index.html.

Public SDK API

Current exports from sdk.js:

  • localforage
  • fetchAllScores
  • fetchSomeScores
  • getScoresPerTrait
  • getScoresPerCategory
  • loadScoreStats
  • getTxts
  • fetchTraits
  • estimateLocalForageSizeKB
  • checkStorageKB
  • getTextSizeKB

getTxts

getTxts(ids, optionalArg, cache = true)

  • cache defaults to true (current behavior).
  • Set cache to false to skip both cache reads and cache writes for that call.

Examples:

await sdk.getTxts(ids); // default: uses cache
await sdk.getTxts(ids, undefined, false); // bypass cache for this call

Cloud SDK (Node.js)

A separate, Node-safe bundle (cloud_sdk.mjs, 4.4 KB) for Cloud Run and server deployment.

Features

  • Exposes core PGS SDK loaders for Node/Cloud environments
  • No browser UI dependencies in the cloud entry surface
  • Lean bundle size optimized for containerized environments
  • Ready for Google Cloud Run, AWS Lambda, or any Node.js host

Installation

npm install pgs_catalog_sdk

Cloud SDK Exports

  • fetchAllScores()
  • fetchSomeScores(ids)
  • loadScoreStats()
  • getScoresPerTrait()
  • getScoresPerCategory()
  • getTxts(ids, optionalArg, cache = true)
  • fetchTraits()

Cloud SDK Usage

import {
  fetchAllScores,
  fetchSomeScores,
  fetchTraits,
  getScoresPerTrait,
  getScoresPerCategory,
  getTxts,
  loadScoreStats,
} from "pgs_catalog_sdk/cloud_sdk.mjs";

const scores = await fetchSomeScores(["PGS000001", "PGS000050"]);
console.log(scores.length);

const traits = await fetchTraits();
console.log(traits?.length ?? 0);

Build Details

  • Source: src/js/getPGS_loadScores.js, src/js/getPGS_loadTxts.js, src/js/getPGS_loadTraits.js, src/js/landingPage.js
  • Entry: cloudNodeEntry.js (exports the cloud-safe SDK surface)
  • Build: npm run build generates both dist/sdk.mjs (browser) and dist/cloud_sdk.mjs (Node)
  • Critical Fix: Rollup intro shim var self = globalThis; prevents jszip runtime crash from bundled self reference