The UCUM-LHC Library Overview
The UCUM-LHC library is a javascript library that provides validation and conversion services for the Unified Code for Units of Measure (UCUM) code system created by the Regenstrief Institute, Inc.
The UCUM code system describes "all units of measures being contemporarily used in international science, engineering, and business" (from the Unified Code for Units of Measure description). The UCUM system uses dimensional analysis for conversion of commensurable units, which eliminates the need to hardcode conversion functions for most units. In addition, the UCUM system accomodates validation of unit codes built on other unit codes, e.g., mg/kg/h (milligram per killogram per hour).
See the code in action
Check out our demonstration page that illustrates the validation and conversion functions of the UCUM-LHC library.
Using the UCUM-LHC Code
The UCUM-LHC library can be downloaded and installed as a bower package or an npm package. The installed dist/ucum-lhc.js module package includes the code you need for the validation and conversion functions as well as the UCUM code definitions file. The UCUM-LHC code provides validation and conversion capabilities for units of measure. Those functions are accessed from the ucumPkg.UcumLhcUtils class. Descriptions of those functions are included in the README.md file in the UCUM-LHC GitHub repository.
Clone the ucum-lhc repository from GitHub
You may clone the ucum-lhc repository from GitHub here. The repository includes all the code found in the ucum-lhc bower package as well as supporting code in the form of test code, data import/export code, and the code for the demo site. Instructions for cloning a GitHub repository are on the GitHub page.