@cql-labs/vsac-api
v0.1.0
Published
Javascript SDK for interacting with Value Set Authority Center (VSAC) APIs.
Downloads
16
Readme
VSAC API SDK
A modern, type-safe Node.js SDK for interacting with the National Library of Medicine's Value Set Authority Center (VSAC) APIs.
Installation
npm install @cql-labs/vsac-apiFeatures
- TypeScript First: Full TypeScript implementation with comprehensive type definitions
- Zero External Runtime Dependencies: Built using standard Web API (
fetch) for maximum compatibility - Cross-Platform: Works in Node.js, Bun, and Deno
- Automatic XML to JSON: Seamlessly handles VSAC's XML responses by converting them to typed JSON objects
- Caching: Built-in support for caching strategies (memory, file based) to reduce API calls
Quick Start
import { SVSClient, UtilityClient } from '@cql-labs/vsac-api';
// Initialize the SVS Client
const svs = new SVSClient({
baseURL: 'https://vsac.nlm.nih.gov/vsac/svs',
apiKey: process.env.UMLS_API_KEY
});
// Initialize the Utility Client
const utility = new UtilityClient('https://vsac.nlm.nih.gov');
// Fetch a Value Set
const valueSet = await svs.retrieveValueSet('2.16.840.1.114222.4.11.837');
console.log(valueSet.displayName);Examples
We have provided comprehensive examples in the examples/ directory to help you get started:
- SVS Examples: Demonstrates retrieving Value Sets, searching by tags, and handling metadata.
- Utility Examples: Shows how to query programs, releases, and profiles.
To run the examples locally:
Clone the repository
Install dependencies:
npm installSet your
UMLS_API_KEYin a.envfileRun an example:
# Run with Bun bun run examples/svs-examples.ts # Or with Node (using tsx or similar) npx tsx examples/svs-examples.ts
API Documentation & Reference
Bruno API Collections
We use Bruno for documenting and testing VSAC API endpoints. You can find the collections in the reference/ directory.
To use them:
- Download and install Bruno.
- Open Bruno and select Open Collection.
- Navigate to the
reference/SVSdirectory in this repository. - You can now explore and test the VSAC APIs directly.
Contributing
We welcome contributions! Please follow these steps to contribute:
- Fork the repository on GitHub.
- Clone your fork locally.
- Install dependencies:
npm install. - Create a branch for your feature or fix.
- Make your changes. Ensure you follow the coding style (Prettier).
- Run tests:
npm test # Run unit tests npm run test:e2e # Run end-to-end tests (requires API key) - Refactor & Format:
npm run format. - Push your branch and submit a Pull Request.
License
Apache 2.0
Author
Jeyamurugan Palaniselvam
