mapping-loinc
Skill này làm gì
Skill này ánh xạ tên xét nghiệm và quan sát, như kali huyết thanh hoặc huyết áp, sang mã LOINC, các mã chuẩn cho những gì được đo. Skill dùng các dịch vụ thuật ngữ công khai miễn phí. Dành cho các nhóm mã hóa kết quả xét nghiệm để trao đổi dữ liệu.
Khi nào nên dùng
- ✓Khi tên xét nghiệm hoặc dấu hiệu sinh tồn trong ghi chú cần một mã LOINC chuẩn.
- ✓Khi một xét nghiệm cần xác định mẫu bệnh phẩm hoặc phương pháp để chọn đúng mã LOINC.
- ✓Khi quan sát xét nghiệm US Core phải được xây dựng với một mã xét nghiệm.
Liên kết skill
https://github.com/maziyarpanahi/openmed/blob/master/skills/mapping-loinc/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy ánh xạ tên xét nghiệm trong báo cáo này sang mã LOINC, kể cả mẫu bệnh phẩm, và thêm đơn vị UCUM.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent tra cứu từng tên trong một dịch vụ thuật ngữ FHIR công khai, kiểm tra thành phần, mẫu bệnh phẩm và phương pháp, rồi trả về mã LOINC phù hợp kèm đơn vị.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
LOINC có miễn phí không?
Có. LOINC miễn phí sử dụng theo các điều khoản giấy phép, không có phí.
Nó có mã hóa chẩn đoán không?
Không. Chẩn đoán dùng skill ICD-10, còn thuốc dùng skill RxNorm.
Nó gắn những đơn vị nào?
Nó gắn đơn vị UCUM để đi cùng giá trị từng kết quả.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 5.8k
- Vị trí xếp hạng
- #14711
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
annotating-variants
5.8kGiúp agent dự đoán tác động của biến thể di truyền, đổi tên HGVS sang vị trí bộ gen và gắn tần suất quần thể bằng công cụ chú giải miễn phí.
ask-openmed
5.8kGiúp agent chọn đúng quy trình OpenMed cho yêu cầu về văn bản lâm sàng, luôn kiểm tra quyền riêng tư trước khi có thể có dữ liệu bệnh nhân.
assembling-fhir-bundles
5.8kGói nhiều bản ghi y tế FHIR thành một Bundle giao dịch để gửi tới EHR, với các tham chiếu nội bộ được liên kết đúng.
auditing-deid-leakage
5.8kQuét văn bản lâm sàng đã khử nhận dạng để tìm định danh còn sót như SSN, số thẻ, email và ngày tháng, và chặn phát hành nếu còn sót.
Skill tương tự
discrawl
394kCho phép agent của bạn tìm kiếm và tóm tắt kho lưu trữ tin nhắn Discord trên máy, kiểm tra độ mới của dữ liệu và đọc tin nhắn trực tiếp.
clickhouse-io
280kGiúp agent của bạn tối ưu truy vấn và schema trong ClickHouse theo thực hành tốt nhất cho phân tích dữ liệu hiệu năng cao khi truy vấn chậm.
scientific-db-pubmed-database
280kGiúp agent của bạn tìm bài báo khoa học trong lĩnh vực y sinh. Hữu ích cho nghiên cứu cần thông tin y khoa cụ thể.