@lhncbc/ucum-lhc 7.1.2 → 7.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +3 -4
- package/README.md +18 -5
- package/browser-dist/ucum-lhc.min.js +1 -1
- package/browser-dist/ucum-lhc.min.js.map +1 -1
- package/package.json +1 -1
- package/source/unit.js +1 -1
- package/source/unitString.js +6 -20
- package/source-cjs/ucumLhcUtils.js +1 -2
- package/source-cjs/ucumLhcUtils.js.map +1 -1
- package/source-cjs/unit.js +3 -4
- package/source-cjs/unit.js.map +1 -1
- package/source-cjs/unitString.js +10 -22
- package/source-cjs/unitString.js.map +1 -1
package/LICENSE.md
CHANGED
|
@@ -23,14 +23,13 @@ If this product includes all or a portion of the UCUM table, UCUM codes, and
|
|
|
23
23
|
UCUM definitions or is derived from it, it is subject to a license from
|
|
24
24
|
Regenstrief Institute, Inc. and The UCUM Organization. Your use of the UCUM table,
|
|
25
25
|
UCUM codes, UCUM definitions also is subject to this license, a copy of which is
|
|
26
|
-
available at
|
|
27
|
-
Specification are available for download at
|
|
26
|
+
available at https://ucum.org/license. The current complete UCUM table and UCUM
|
|
27
|
+
Specification are available for download at https://ucum.org. The UCUM
|
|
28
28
|
table and UCUM codes are copyright © 1995-2009, Regenstrief Institute, Inc.
|
|
29
29
|
and the Unified Codes for Units of Measures (UCUM) Organization. All rights reserved.
|
|
30
30
|
|
|
31
31
|
If UCUM content is included, this software is distributed under the conditions
|
|
32
|
-
set forth at
|
|
33
|
-
terms and conditions.
|
|
32
|
+
set forth at https://ucum.org/license and the following terms and conditions.
|
|
34
33
|
|
|
35
34
|
The following terms and conditions are based on the BSD open-source license.
|
|
36
35
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ucum-lhc
|
|
2
2
|
This is the LHC implementation of validation and conversion services based on
|
|
3
|
-
the [Unified Code for Units of Measure](
|
|
3
|
+
the [Unified Code for Units of Measure](https://ucum.org) (UCUM) code
|
|
4
4
|
system created by the Regenstrief Institute, Inc.
|
|
5
5
|
|
|
6
6
|
See our [overview page](https://ucum.nlm.nih.gov/ucum-lhc) for
|
|
@@ -146,9 +146,7 @@ utils object as described above):
|
|
|
146
146
|
For information on unit string formatting, look at the _Ucum Unit Expression
|
|
147
147
|
Validation_ section on the [demo page](https://ucum.nlm.nih.gov/ucum-lhc/demo.html).
|
|
148
148
|
There is a button labeled "Show entry hints". That will give you a short description
|
|
149
|
-
of unit strings, and includes a link to the
|
|
150
|
-
[UCUM Specification](http://unitsofmeasure.org/ucum.html), where you can find
|
|
151
|
-
the full deal.
|
|
149
|
+
of unit strings, and includes a link to the [UCUM Specification](https://ucum.org/ucum).
|
|
152
150
|
|
|
153
151
|
#### convertUnitTo(fromUnitCode, fromVal, toUnitCode, options)
|
|
154
152
|
|
|
@@ -183,7 +181,8 @@ using them in actual clinical settings.
|
|
|
183
181
|
* 'status' the will be: 'succeeded' if the conversion was successfully
|
|
184
182
|
calculated; 'failed' if the conversion could not be made, e.g., if
|
|
185
183
|
the units are not commensurable; or 'error' if an error occurred;
|
|
186
|
-
* 'toVal' the numeric value indicating the conversion amount
|
|
184
|
+
* 'toVal' the numeric value indicating the conversion amount (without any
|
|
185
|
+
rounding for significant digits), or null
|
|
187
186
|
if the conversion failed (e.g., the units are not commensurable);
|
|
188
187
|
* 'msg' is an array of messages, if the string is invalid or an
|
|
189
188
|
error occurred, indicating the problem, or an explanation of a
|
|
@@ -359,3 +358,17 @@ If you wish to modify the code, the build process is simply:
|
|
|
359
358
|
npm run build
|
|
360
359
|
|
|
361
360
|
If you wish to modify or update either of the source data files (ucum-essence.xml or ucum.csv), see impexp/README.md for instructions on build steps for data changes.
|
|
361
|
+
|
|
362
|
+
### Testing
|
|
363
|
+
Tests can be run with:
|
|
364
|
+
|
|
365
|
+
npm run test
|
|
366
|
+
|
|
367
|
+
Although package does not directly use the UCUM "Functional Tests"
|
|
368
|
+
(https://ucum.org/docs/functional-tests and
|
|
369
|
+
https://github.com/FHIR/Ucum-java/blob/master/src/test/resources/UcumFunctionalTests.xml),
|
|
370
|
+
we have run those tests using ucum-lhc, and we found that all but two tests pass.
|
|
371
|
+
The two tests that do not pass are checking for rounding of values at the right
|
|
372
|
+
number of signifant digits. The package does not round to significant digits,
|
|
373
|
+
since if you round too early in a calculation, you can lose accuracy.
|
|
374
|
+
|