mapping-loinc
Qué hace
Esta skill asigna nombres de análisis y observaciones, como potasio sérico o presión arterial, a códigos LOINC, los códigos estándar de lo que se mide. Usa servicios de terminología públicos y gratuitos. Es para equipos que codifican resultados de laboratorio para la interoperabilidad.
Cuándo usarla
- ✓Cuando los nombres de pruebas de laboratorio o de constantes vitales de las notas necesitan un código LOINC estándar.
- ✓Cuando una prueba necesita identificar su muestra o su método para elegir el código LOINC correcto.
- ✓Cuando una observación de laboratorio de US Core debe construirse con una prueba codificada.
Link de la skill
https://github.com/maziyarpanahi/openmed/blob/master/skills/mapping-loinc/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Asigna a códigos LOINC los nombres de análisis de este informe, incluida la muestra, y añade las unidades UCUM.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente busca cada nombre en un servicio público de terminología FHIR, revisa el componente, la muestra y el método, y devuelve el código LOINC correspondiente con sus unidades.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
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.
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"
def lookup(code: str) -> dict:
"""$lookup: return the fully specified name + axes for a LOINC code."""
r = requests.get(
f"{FHIR}/CodeSystem/$lookup",
params={"system": LOINC_SYSTEM, "code": code},
auth=AUTH, headers={"Accept": "application/fhir+json"}, timeout=15,
)
r.raise_for_status()
return r.json()
def validate(code: str, display: str) -> bool:
r = requests.get(
f"{FHIR}/CodeSystem/$validate-code",
params={"url": LOINC_SYSTEM, "code": code, "display": display},
auth=AUTH, headers={"Accept": "application/fhir+json"}, timeout=15,
)
r.raise_for_status()
params = {p["name"]: p.get("valueBoolean") for p in r.json().get("parameter", [])}
return bool(params.get("result"))
print(lookup("2823-3")) # Potassium [Moles/volume] in Serum or Plasma
Search candidate LOINC codes from a text name with the Regenstrief search API
(https://loinc.org/search/) or a ValueSet/$expand filter on your server:
def expand_filter(text: str, count: int = 10) -> list[dict]:
"""Text-filter the LOINC code system to candidate concepts."""
r = requests.get(
f"{FHIR}/ValueSet/$expand",
params={"url": "http://loinc.org/vs", "filter": text, "count": count},
auth=AUTH, headers={"Accept": "application/fhir+json"}, timeout=20,
)
r.raise_for_status()
return r.json().get("expansion", {}).get("contains", [])
Workflow
- Extract observation/analyte mentions with OpenMed.
- Assemble the axes you have from surrounding text: component (what), specimen/system (serum, urine, blood), method (HPLC, immunoassay), and scale (quantitative vs ordinal). More axes → a more specific, correct LOINC.
- Search candidates via
$expand?filter=(or Regenstrief search). - Disambiguate by matching specimen and property. "Glucose" alone is ambiguous; "glucose, serum, mass/volume" resolves to one code.
- Validate the chosen code with
$validate-code, then$lookupto pull the long common name and the canonical UCUM example unit. - Emit
{system: "http://loinc.org", code, display}plus the UCUM unit for the result value, into a US Core Observation.
Hand-off from OpenMed
openmed.analyze_text(..., output_format="dict") returns entities, each a dict
with text, label, confidence, start, end. Lab analytes often surface
under Chemical/Disease models; run the relevant model and feed the spans in:
import openmed
note = "Labs: serum potassium 5.1 mmol/L, hemoglobin A1c 7.8
Preguntas frecuentes
¿Es gratuito LOINC?
Sí. LOINC es gratuito de usar según sus condiciones de licencia, sin tarifa.
¿También codifica diagnósticos?
No. Los diagnósticos usan la skill de ICD-10, y los medicamentos usan la skill de RxNorm.
¿Qué unidades añade?
Añade unidades UCUM para acompañar al valor de cada resultado.
Detalles
Descripción original del autor
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
repo: maziyarpanahi/openmed
Popularidad
- Estrellas en GitHub
- 5,8 mil
- Posición en el ranking
- #14711
- Licencia
- Apache-2.0
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
annotating-variants
5,8 milAyuda a tu agente a predecir qué hace una variante genética, convertir nombres HGVS en posiciones del genoma y añadir frecuencias poblacionales, usando anotadores públicos gratuitos.
ask-openmed
5,8 milAyuda a tu agente a elegir el flujo de trabajo de OpenMed adecuado para una petición de texto clínico, empezando siempre por una comprobación de privacidad si puede haber datos de pacientes.
assembling-fhir-bundles
5,8 milEmpaqueta varios registros de salud FHIR en un único Bundle de transacción listo para enviar a un EHR, con las referencias internas enlazadas correctamente.
auditing-deid-leakage
5,8 milBusca en texto clínico desidentificado restos de identificadores, como números de la seguridad social, de tarjeta, correos y fechas, y bloquea la publicación si queda alguno.
Skills parecidas
discrawl
394 milPermite que tu agente busque y resuma un archivo local guardado de mensajes de Discord, revise qué tan actual es y lea mensajes directos.
clickhouse-io
280 milAyuda a tu agente a optimizar consultas y esquemas en ClickHouse con buenas prácticas para cargas analíticas de alto rendimiento. Úsalo si las consultas son muy lentas.
scientific-db-pubmed-database
280 milAyuda a tu agente a buscar artículos científicos del ámbito biomédico. Es útil para investigaciones que necesitan información médica específica.