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

chvocab

v0.1.1

Published

Mapping texts to UMLS via the Consumer Health Vocabulary (CHV)

Downloads

14

Readme

NPM version Build Status

CHV Concept Extractor

This is a small utility tool to extract UMLS concepts in supplied input texts via the Consumer Health Vocabulary (CHV).

Installation

Install via npm:

npm install chvocab

Getting Started

The packages exports a namespace with two functions:

analyze(string, [callback])

The first parameter expects the text to be analyzed, and the second parameter is a callback function which gets passed the result set of concepts identified in the CHV. The function chooses only one concept for each word phrase via the following algorithm:

  1. If there are different candidates for a word phrase in CHV, the longest one is picked pickd. For example, if the phrase "heart attack" appears in the supplied string, the candidate set of UMLS concepts would comprise the concepts heart, attack and heart attack with the latter concept being returned.
  2. For candidates of equal length, the one with the highest familiarity score in the CHV is chosen.

Example:

input = "Chronic Kidney Disease is a progressive loss in renal function" 
chvocab.analyze(input, function(err, data){
  console.log(data)
})

Output:

[ { CUI: 'C0205191',
    Term: 'chronic',
    CHV_preferred_name: 'chronic (qualifier value)',
    UMLS_preferred_name: 'chronic',
    Explanation: '',
    Count: 1,
    Positions: [ 0 ] },
  { CUI: 'C0022658',
    Term: 'kidney disease',
    CHV_preferred_name: 'kidney diseases',
    UMLS_preferred_name: 'kidney disease',
    Explanation: '',
    Count: 1,
    Positions: [ 8 ] },
  { CUI: 'C0205329',
    Term: 'progressive',
    CHV_preferred_name: 'progressive (qualifier value)',
    UMLS_preferred_name: 'progressive',
    Explanation: '',
    Count: 1,
    Positions: [ 28 ] },
  { CUI: 'C0232804',
    Term: 'renal function',
    CHV_preferred_name: 'renal function, nos',
    UMLS_preferred_name: 'kidney function',
    Explanation: '',
    Count: 1,
    Positions: [ 48 ] } ]

getCHV([callback])

If one would like to use the CHV data for a different purpose, one can access it via this function. As soon as the data set is loaded, the callback function is invoked. This function has parameters err, data, of which the latter one holds the data set provided it was successfully loaded into memory.

Instead of using the callback style, one can work with Promises since both functions also return a Promise implemented via the bluebird package.

Command Line Interface

Install the package globally to access the command line tool from everywhere:

npm install chvocab -g

Then you can simply invoke chvExtract from the terminal. Type chvExtract --help to see the different options of how you can input data and retrieve the extracted results.

If you prefer to not install the package globally, you can access the command-line utility via

node lib/chvExtract.js

License

The Consumer Health Vocabulary (CHV) is developed by Consumer Health Vocabulary Initiative, an on-going collaboration among researchers from a number of institutions including the University of Utah, Brigham and Women's Hospital, Harvard Medical School, National Library of Medicine, and University of Wisconsin. It is licensed under the GNU GENERAL PUBLIC LICENSE, Version 2 and consequently this package is also licensed under GPL-2.