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 🙏

© 2024 – Pkg Stats / Ryan Hefner

umls-api

v0.0.4

Published

promise-based api to interact with the [UMLS](https://uts.nlm.nih.gov/) terminology service

Downloads

14

Readme

umls-api

NOTE

  • after 8 hours a "ETIMEDOUT" error is thrown - requiring need to get

end point support

  • search by string (search)
  • search by CUI code (cui)

installation

npm install umls-api --save

run tests

npm run test
  • or -
yarn test

Example: cui

  • you want to lookup CUI=C0009044

node code

const { UmlsApi } = require('umls-api')
const credentialsApiKey = {apikey:'<your-umls-apikey>'}
const credentialsUsernamePassword = {username:'<user>',password:'<pw>'}
// you can use either credentialsApiKey or credentialsUsernamePassword
new UmlsApi(credentialsApiKey)
    .authenticate()
    .then((umls) => 
        umls.cui('C0009044')
        .then((res) => console.log(JSON.stringify(res.data))))

output

{
  "pageSize": 25,
  "pageNumber": 1,
  "pageCount": 1,
  "result": {
    "classType": "Concept",
    "ui": "C0009044",
    "suppressible": false,
    "dateAdded": "09-30-1990",
    "majorRevisionDate": "03-16-2016",
    "status": "R",
    "semanticTypes": [
      {
        "name": "Injury or Poisoning",
        "uri": "https://uts-ws.nlm.nih.gov/rest/semantic-network/2018AB/TUI/T037"
      }
    ],
    "atomCount": 65,
    "attributeCount": 0,
    "cvMemberCount": 0,
    "atoms": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0009044/atoms",
    "definitions": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0009044/definitions",
    "relations": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0009044/relations",
    "defaultPreferredAtom": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0009044/atoms/preferred",
    "relationCount": 5,
    "name": "Closed fracture of carpal bone"
  }
}

Example: search

node code

const { UmlsApi } = require('umls-api')
const credentialsApiKey = {apikey:'<your-umls-apikey>'}
const credentialsUsernamePassword = {username:'<user>',password:'<pw>'}
// you can use either credentialsApiKey or credentialsUsernamePassword
new UmlsApi(credentialsApiKey)
    .authenticate()
    .then((umls) => 
        umls.search({string:'fracture of carpal bone'})
        .then((res) => console.log(JSON.stringify(res.data))))

output

{
  "pageSize": 25,
  "pageNumber": 1,
  "result": {
    "classType": "searchResults",
    "results": [
      {
        "ui": "C0009044",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0009044",
        "name": "Closed fracture of carpal bone"
      },
      {
        "ui": "C0016644",
        "rootSource": "MTH",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0016644",
        "name": "Fracture of carpal bone"
      },
      {
        "ui": "C0159765",
        "rootSource": "MTH",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0159765",
        "name": "Open fracture of carpal bone, unspecified"
      },
      {
        "ui": "C0272654",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0272654",
        "name": "Fracture of scaphoid bone of wrist"
      },
      {
        "ui": "C0272656",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0272656",
        "name": "Fracture of triquetral bone of wrist"
      },
      {
        "ui": "C0282014",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0282014",
        "name": "Fracture of trapezium of wrist"
      },
      {
        "ui": "C0559421",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0559421",
        "name": "Fracture of lunate bone of wrist"
      },
      {
        "ui": "C0559422",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0559422",
        "name": "Fracture of pisiform bone of wrist"
      },
      {
        "ui": "C0559424",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0559424",
        "name": "Fracture of trapezoidal bone of wrist"
      },
      {
        "ui": "C0559425",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0559425",
        "name": "Fracture of hamate bone of wrist"
      },
      {
        "ui": "C0559426",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0559426",
        "name": "Fracture of capitate bone of wrist"
      },
      {
        "ui": "C0840635",
        "rootSource": "ICD10AM",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0840635",
        "name": "Fracture of carpal bone, unspecified"
      },
      {
        "ui": "C2213932",
        "rootSource": "MEDCIN",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C2213932",
        "name": "malunion of fracture of carpal bone"
      },
      {
        "ui": "C2214345",
        "rootSource": "MEDCIN",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C2214345",
        "name": "nonunion of fracture of carpal bone"
      },
      {
        "ui": "C3669570",
        "rootSource": "SNOMEDCT_VET",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C3669570",
        "name": "Fracture of fourth carpal bone of equine limb"
      },
      {
        "ui": "C3669572",
        "rootSource": "SNOMEDCT_VET",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C3669572",
        "name": "Fracture of radial carpal bone of equine limb"
      },
      {
        "ui": "C3669573",
        "rootSource": "SNOMEDCT_VET",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C3669573",
        "name": "Fracture of intermediate carpal bone of equine limb"
      },
      {
        "ui": "C3669927",
        "rootSource": "SNOMEDCT_VET",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C3669927",
        "name": "Fracture of accessory carpal bone of equine limb"
      },
      {
        "ui": "C3669936",
        "rootSource": "SNOMEDCT_VET",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C3669936",
        "name": "Fracture of ulnar carpal bone of equine limb"
      },
      {
        "ui": "C3670076",
        "rootSource": "SNOMEDCT_VET",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C3670076",
        "name": "Fracture of third carpal bone"
      },
      {
        "ui": "C0272662",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0272662",
        "name": "Quervain's fracture"
      },
      {
        "ui": "C0434897",
        "rootSource": "SNOMEDCT_US",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0434897",
        "name": "Fracture dislocation of lunate"
      },
      {
        "ui": "C0478305",
        "rootSource": "ICD10",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C0478305",
        "name": "Fracture of other carpal bone(s)"
      },
      {
        "ui": "C2012741",
        "rootSource": "MEDCIN",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C2012741",
        "name": "open treatment of fracture of carpal bone"
      },
      {
        "ui": "C2164887",
        "rootSource": "MEDCIN",
        "uri": "https://uts-ws.nlm.nih.gov/rest/content/2018AB/CUI/C2164887",
        "name": "delayed union of fracture of carpal bone"
      }
    ]
  }
}

resources

terminology

steps to make things work

  1. get Ticket-Granting-Ticket (TGT) - btw, your TGT will be valid for 8 hours.
  2. get a service ticket (ST) by POST-ing to https://utslogin.nlm.nih.gov/cas/v1/api-key/{api-key} with header [Content-Type=application/x-www-form-urlencoded] and paramters [service=http://umlsks.nlm.nih.gov] this will return a ST like ST-380814-VBmBEOdgwj7cgLFinb9b-cas
  3. now use the ST in requests to UMLS (e.g. https://uts-ws.nlm.nih.gov/rest/search/current?string=diabetes&ticket={yourServiceTicket})
  4. for every new request go to step 2 and repeat. Some time over the next 8 hours the TGT will expire (not sure how you are informed) so you will need to acquire a new TGT.