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

loinc-mapping-validator

v0.0.4

Published

Checks whether UCUM code is appropriate for a given LOINC code.

Downloads

13

Readme

A LOINC Mapping Validator

This validator is designed to check whether the LOINC mapping for the records are correct. Currently it only considers the unit of a record but down the road this might be expanded to consider the values and potentially other factors as well.

This package comes with a library and a command line tool. There is also a web-based LOINC mapping validator that is backed by this library and lives in the "gh-pages" branch of this package.

The LOINC Mapping Validator Library

At the core of this package is the LOINC mapping library. To use the library:

const validator = require('loinc-mapping-validator').validator; The validator exposes the following elements:

  • validator.validateLoincUnit() is the function that you can call to validate a given (LOINC number, unit) to see if they go together.
    Input parameters - validator.validateLoincUnit(loinc, unit):
    • loinc: the LOINC number whose mapping is to be checked
    • unit: the unit string that is used to validate the LOINC mapping.
      Output: an object with the following fields:
      • loinc: the same as the input loinc
      • unit: the same as the input unit
      • unitStatus: unit validation status code, see UnitVldStatus below for more details
      • loincStatus: LOINC mapping validation status code, see LoincVldStatus below for more details
      • substituted_unit: a ucum unit that the given unit can be mapped to (when it's non-ucum unit)
  • validator.UnitVldStatus specifies the set of status codes of unit validation results - see UnitVldStatusNote below for more details.
  • validator.UnitVldStatusNote describes the status codes in UnitVldStatus:
    • VALID: The unit is a valid UCUM unit
    • INVALID_FIXED: The unit is not a UCUM unit but there is a known mapping to a UCUM unit as provided under LMV_SUBSTITUTED_UNIT,
    • INVALID_UNKNOWN: The unit is not a UCUM unit and there is no known mapping to a UCUM unit
    • MISSING_UNIT: The unit is not provided as input
  • validator.LoincVldStatus specifies the set of status codes of LOINC mapping validation results. See LoincVldStatusNote below for more details.
  • validator.LoincVldStatusNote describes the status codes in LoincVldStatus:
    • CORRECT: The LOINC mapping matches with the unit
    • INCORRECT: The LOINC mapping does not match with the unit
    • UNKNOWN: Unit information not available for the LOINC number
    • MISSING_LOINC: The LOINC number is not provided

The Command-line Tool

There is a command line tool that comes with this package, which you can use to batch validate records in a CSV input file, and output a new CSV file that contains all the input columns plus a few new columns that indicate the validation status for each record.

How to use the command line tool

To use the command line tool, you will need to work with Windows command terminals or Linux terminals.

  • Install Node.js on your system
  • Download this package

To validate the test file that comes with this package:

cd into the directory where you saved this package
node bin/validateLoincUnitCSV.js -i data/sample-test-file.csv -l LOINC -u UNIT

Here are more details on the command line syntax/options:

node bin/validateLoincUnitCSV.js -i <input-csv-file> -l <loinc-column-name> -u <unit-column-name> [-o <output-file>]

Where:

  • <input-csv-file>
    • must be a CSV file - there are different variants of CSV files, we can't guarantee that this tool works with every one of them. But we've tested it that it works with the CSV file saved from Microsoft excel as "CSV (Comma Delimited)" format.
    • must have the column name row (header row)
    • must have a column for the unit
    • must have a column for the LOINC number
  • <loinc-column-name>
    • The name of the column that has the LOINC number
  • <unit-column-name>
    • The name of the column that has the unit
  • <output-file>
    • This parameter is optional, and if not specified, will print to the standard output (terminal). Please see below for the details on the output file format.
The output file format:
  • A CSV file with all the columns in the input file
  • 5 new columns for the validation results:
    • LMV_UNIT_STATUS: the validation status of the unit. See the descriptions on UnitVldStatusNote above for more details
    • LMV_LOINC_STATUS: the validation status of the LOINC mapping. See the descriptions
      on LoincVldStatusNote above for more details.
    • LMV_SUBSTITUTED_UNIT: if the given unit is not a UCUM unit and there is a known mapping to a UCUM unit, it will be suggested here.
    • LMV_UNIT_NOTE: a note explaining the LMV_UNIT_STATUS. See the descriptions on UnitVldStatusNote above for more details
    • LMV_LOINC_NOTE: a note explaining the LMV_LOINC_STATUS. See the descriptions on LoincVldStatusNote above for more details