# Mapping Loinc

Maps laboratory and clinical observation names extracted by OpenMed to LOINC codes...

- Repository: https://github.com/maziyarpanahi/openmed (5755 stars)
- Category: Testing
- License: Apache-2.0
- Last updated: 2026-10-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add maziyarpanahi/openmed --skill mapping-loinc -g -a claude-code -y`
Codex: `npx skills add maziyarpanahi/openmed --skill mapping-loinc -g -a codex -y`
Cursor: `npx skills add maziyarpanahi/openmed --skill mapping-loinc -g -a cursor -y`
Gemini CLI: `npx skills add maziyarpanahi/openmed --skill mapping-loinc -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add maziyarpanahi/openmed`

## Description

Maps laboratory and clinical observation names extracted by OpenMed to LOINC codes using the public Regenstrief LOINC and FHIR terminology APIs. Use when the user wants to code lab tests, vital signs, or observations to LOINC, resolve a test name plus specimen and method to the correct LOINC part-model code, attach UCUM units, or build a US Core Laboratory Result Observation. Trigger keywords: LOINC, lab coding, observation code, UCUM units, specimen, method, US Core lab, FHIR Observation, lab result mapping, panel vs analyte. Pairs after OpenMed NER: consume Disease/Chemical/lab-name entities from openmed.analyze_text and map each measurement to a LOINC code. LOINC is free to use under the Regenstrief license (registration/terms-of-use, no fee); UMLS/SNOMED stay user-supplied and out-of-process.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Mapping lab/observation names to LOINC

Ground free-text lab and observation names that OpenMed surfaces to **LOINC**
(Logical Observation Identifiers Names and Codes), the universal standard for
identifying *what was measured*. A LOINC code is a fully specified observation, not just an analyte but the full six-axis model: **Component, Property, Time,
System (specimen), Scale, Method**.

LOINC is **free** to use. It is published by the Regenstrief Institute under the
LOINC license: you accept terms-of-use (and register to download the table), but
there is no fee and no per-use restriction. The standard, public path for
license-clean mapping is a **FHIR terminology server** exposing LOINC via
`$lookup` / `$validate-code`, or Regenstrief's hosted **fhir.loinc.org**.

## When to use

- A note or report contains lab/observation names ("serum potassium",
  "hemoglobin A1c", "blood pressure") and you need a stable LOINC code each.
- You must disambiguate by **specimen/system** ("glucose in serum" vs
  "glucose in urine") or **method** ("HbA1c by HPLC").
- You need **UCUM** units to pair with the result value, or a US Core
  `Observation` (Laboratory Result) coded with LOINC.
- You are mapping a **panel** (e.g. CBC, BMP) vs its individual **analytes**.

For diagnoses/procedures use `coding-icd10`; for drugs use `normalizing-rxnorm`;
LOINC is for *observations and measurements*.

## Quick start (real LOINC / FHIR terminology calls)

Regenstrief hosts a public FHIR terminology endpoint at `https://fhir.loinc.org`
(HTTP Basic auth with your free LOINC account). Many sites instead point at their
own server (HAPI, Ontoserver, Snowstorm-with-LOINC). The operations are the same.

```python
import requests
from requests.auth import HTTPBasicAuth

FHIR = "https://fhir.loinc.org"
AUTH = HTTPBasicAuth("YOUR_LOINC_USER", "YOUR_LOINC_PASSWORD")  # free account
LOINC_SYSTEM = "http://loinc.org"

The rest: https://github.com/maziyarpanahi/openmed/blob/HEAD/skills/mapping-loinc/SKILL.md
