Git Product home page Git Product logo

loinc-conversion's Introduction

REST-server that converts LOINC codes and UCUM units to a standardized representation

loinc-conversion is a REST-server that accepts lists of (LOINC-code, unit, value?) and returns corresponding lists of (LOINC-code, UCUM-unit, value). It provides three distinct functions:

  1. Standardization of UCUM units Returns a standardized UCUM unit for each LOINC code. (In most cases, the returned UCUM unit is the EXAMPLE_UNIT defined in the official Loinc.csv by Regenstrief.)

  2. Conversion of non-UCUM units For selected common (especially in Germany) non-UCUM laboratory units the valid UCUM unit is provided.

  3. Conversion of LOINC codes Selected LOINC codes that represent the same concept, and where a unambiguous conversion factor exists (e.g. 718-7 = "Hemoglobin [Mass/volume] in Blood" and 59260-0 = "Hemoglobin [Moles/volume] in Blood"), are converted to an arbitrarily* selected LOINC code (718-7 in the example).

    *The conversion target is the more common unit - which is highly subjective.

REST server description

Endpoint: POST /conversions Content-type: application/json Body:

[
  {
    "loinc": "str, e.g. 718-7",
    "unit": "UCUM unit, e.g. g/dL",
    "value": "float, optional(=1.0)",
    "id": "anything_you_want, optional"
  }
]

Example

Query

POST http://localhost:8080/conversions HTTP/1.1
content-type: application/json
[
  {
    "loinc": "718-7",
    "unit": "g/dL",
    "value": 12,
    "id": "my_internal_id_22"
  },
  {
    "loinc": "59260-0",
    "unit": "mmol/l",
    "value": 10
  }
]

Result

[
  {
    "value": 12,
    "unit": "g/dL",
    "loinc": "718-7",
    "id": "my_internal_id_22"
  },
  {
    "value": 16.1,
    "unit": "g/dL",
    "loinc": "718-7"
  }
]

Configuration

Environment variable Description Default
LOG_REQUESTS Whether all API requests should be logged to stdout. false
PORT The port to bind the web server to. 8080

Development

Install Dependencies

npm install

Run with hot reload

npm run watch

The app now runs on http://localhost:8080/api/v1/conversions and restarts everytime a file in the src/ dir changes.

Run tests

npm run tests:e2e

This expects the app to run on http://localhost:8080. You can specify a different endpoint by setting the API_ENDPOINT env var.

Benchmark

# Processor Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4001 Mhz, 4 Core(s), 8 Logical Processor(s)
# 32 GB DDR4 RAM @ 3600 MHz
$ bombardier -d 30s "http://localhost:8080/api/v1/conversions?loinc=718-7&unit=g%2FdL&value=10"
Bombarding http://localhost:8080/api/v1/conversions?loinc=718-7&unit=g%2FdL&value=10 for 30s using 500 connection(s)
[=================================================================================================================] 30s
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec     15883.46    1672.96   52707.38
  Latency       31.51ms    45.90ms      2.76s
  HTTP codes:
    1xx - 0, 2xx - 476294, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:     5.61MB/s

Legal

This material contains content from LOINC (loinc.org). LOINC is copyright © 1995-2021, Regenstrief Institute, Inc. and the Logical Observation Identifiers Names and Codes (LOINC) Committee and is available at no cost under the license at loinc.org/license. LOINC® is a registered United States trademark of Regenstrief Institute, Inc.

loinc-conversion's People

Contributors

chgl avatar ckamann avatar dependabot[bot] avatar gebele avatar jabberwoc avatar jakobzierk avatar juliangruendner avatar noemide avatar renovate[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

loinc-conversion's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update dependency eslint-plugin-promise to v7
  • chore(deps): update dependency wait-on to v8
  • fix(deps): update dependency @lhncbc/ucum-lhc to v7
  • fix(deps): update dependency fastify-graceful-shutdown to v4

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

docker-compose
tests/e2e/compose.yaml
dockerfile
Dockerfile
  • docker/dockerfile 1.7@sha256:dbbd5e059e8a07ff7ea6233b213b36aa516b4c53c645f1817a4dd18b83cbea56
  • docker.io/library/node 21.7.2-slim@sha256:cce6eb16a48b952bf2277c41c9673ae63f6e9d52a1e6b376759b83b26382cbbe
  • gcr.io/distroless/nodejs20-debian12 nonroot@sha256:c4c595a36ad2ced3cd952fad295a6afcb4469e91927159cfb95790031fe65d95
github-actions
.github/workflows/ci.yaml
  • miracum/.github v1.8.3@392030c6f94fcfaa509a606af2b0907d022f2257
  • miracum/.github v1.8.3@392030c6f94fcfaa509a606af2b0907d022f2257
  • actions/checkout v4.1.4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/download-artifact v4.1.7@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • actions/download-artifact v4.1.7@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • miracum/.github v1.8.3@392030c6f94fcfaa509a606af2b0907d022f2257
  • ubuntu 22.04
.github/workflows/lint-pr-title.yaml
  • amannn/action-semantic-pull-request v5.5.2@cfb60706e18bc85e8aec535e3c577abe8f70378e
  • ubuntu 22.04
.github/workflows/schedule.yaml
  • miracum/.github v1.8.3@392030c6f94fcfaa509a606af2b0907d022f2257
.github/workflows/scorecard.yaml
  • actions/checkout v4.1.4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • ossf/scorecard-action v2.3.1@0864cf19026789058feabb7e87baa5f140aac736
  • actions/upload-artifact v4.3.3@65462800fd760344b1a7b4382951275a0abb4808
  • github/codeql-action v3.25.3@d39d31e687223d841ef683f52467bd88e9b21c14
npm
package.json
  • @lhncbc/ucum-lhc 5.0.3
  • csv-parse 5.5.5
  • fastify 4.26.2
  • fastify-graceful-shutdown 3.5.3
  • fastify-metrics 11.0.0
  • http-status-codes 2.3.0
  • pino 9.0.0
  • chai 4.4.1
  • chai-http 4.4.0
  • eslint 8.57.0
  • eslint-config-prettier 9.1.0
  • eslint-config-semistandard 17.0.0
  • eslint-config-standard 17.1.0
  • eslint-plugin-import 2.29.1
  • eslint-plugin-n 15.7.0
  • eslint-plugin-promise 6.1.1
  • jest 29.7.0
  • minimist 1.2.8
  • wait-on 7.2.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.