parsing-lab-values
できること
このスキルは、エージェントに、検査結果を基準範囲と比べる方法を教えます。各値を低い、正常、高い、重篤のいずれかに分類し、結果を見やすくします。
使う場面
- ✓検査値の一覧があり、基準範囲の外にある値を知りたいとき。
- ✓「135から145」や「未満」の記号を含む基準範囲を、正しく読む必要があるとき。
- ✓HやLなどの検査のフラグがあり、それを再計算せずに残したいとき。
スキルのリンク
https://github.com/maziyarpanahi/openmed/blob/master/skills/parsing-lab-values/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“血液検査の結果のうち、基準範囲と比べて高いものや低いものはどれですか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントはテキストから範囲を読み取り、数値と比べます。ラベルを付け、検査機関がすでに設定したフラグがあれば、それを残します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Parsing lab values
Lab results in clinical text arrive as a value, a unit, and a reference range
("Sodium 132 mmol/L (135–145)"). To act on them you need a structured
abnormal flag — is 132 low, normal, high, or critical? OpenMed's
openmed.clinical lab helpers parse the reference range deterministically and
derive the flag, honoring any explicit flag the originating lab already supplied.
The helpers are unit-agnostic by design: they compare numbers within a stated
range and never convert units, so a mmol/L value is never silently compared
against a mg/dL range.
When to use
- After
extracting-clinical-entitiessurfaces lab/measurement entities and you need to classify each as low / normal / high / critical. - The user asks to parse reference ranges, flag abnormal labs, build a flagged
labs table, or interpret values like
<5,>=10,0.5 - 1.2. - You have an originating-lab flag (
H,L,C,HH) and want it honored over a derived comparison.
Quick start
from openmed.clinical import (
parse_reference_range, derive_abnormal_flag, LAB_FLAG_ADVISORY,
)
# Closed range
rng = parse_reference_range("135-145")
# -> {"low": 135.0, "high": 145.0, "low_inclusive": True, "high_inclusive": True}
derive_abnormal_flag(132, rng) # "low"
derive_abnormal_flag(140, "135-145") # "normal" (raw range string accepted)
derive_abnormal_flag(150, "135 to 145") # "high"
# One-sided bounds
derive_abnormal_flag(7, parse_reference_range("<5")) # "high" (above the cap)
derive_abnormal_flag(3, parse_reference_range(">=10")) # "low"
# Honor the lab's own explicit flag (takes precedence over derived comparison)
derive_abnormal_flag(132, "135-145", explicit_flag="C") # "critical"
derive_abnormal_flag(132, "135-145", explicit_flag="HH") # "critical"
# Unparseable / non-numeric inputs fail safe rather than guessing
derive_abnormal_flag("pending", "135-145") # "unknown"
derive_abnormal_flag(132, "see report") # "unknown"
print(LAB_FLAG_ADVISORY) # surface this disclaimer with derived flags
AbnormalFlag is one of "low" | "normal" | "high" | "critical" | "unknown".
ReferenceRange is a typed mapping of low, high, low_inclusive,
high_inclusive.
Workflow
- Get value + range + (optional) lab flag from extracted lab entities. The value should be numeric; the range may be a raw string or a parsed mapping.
- Parse the reference range with
parse_reference_range. It handles closed ranges ("135-145","0.5 - 1.2","135 to 145", en/em dashes) and one-sided bounds ("<5","<=5",">10",">=10"). Contradictory or unparseable ranges return empty bounds rather than a guess — by design. - Derive the flag with
derive_abnormal_flag(value, range, explicit_flag=). Resolution order: an explicit lab flag wins first (H/HIGH,L/LOW,C/CRIT/CRITICAL,HH/LL→ critical,N/NORMAL); an unknown explicit flag returns"unknown"instead of being silently ignored. With no explicit flag, it compares the numeric value against the parsed bounds, respecting inclusive vs. exclusive edges. - Handle
"unknown"explicitly. Non-numeric values, empty/unparseable ranges, or unrecognized explicit flags yield"unknown". Treat it as "needs review," not "normal." - Attach the advisory. Surface
LAB_FLAG_ADVISORYwherever derived flags are shown — derived flags are heuristic and do not replace the originating laboratory's own diagnostic flagging.
Hand-off to / from OpenMed
- From
extracting-clinical-entities:analyze_textlab/measurement entities give you the value text, unit, and often the reference range; this skill turns them into structured flags. Parse the numeric value out of the entity surface before callingderive_abnormal_flag. - OpenMed calls:
from openmed.clinical import parse_reference_range, derive_abnormal_flag, ReferenceRange, AbnormalFlag, LAB_FLAG_ADVISORY. - To
reconciling-problem-lists/ FHIR grounding: acritical/high/lowflag becomes a FHIRObservation.interpretationcode (HL7 v3 ObservationInterpretation:H,L,HH,LL,N). Ground the LOINC code and UCUM unit out-of-process; OpenMed emits the flag, not the terminology binding.
Edge cases & gotchas
- Unit-agnostic — convert before comparing. The helpers ignore units entirely. If the value and the range are in different units (mg/dL vs mmol/L), the fla
よくある質問
単位の換算もしますか?
いいえ。与えられた範囲の中で数値を比べるだけなので、異なる単位の値を混同しません。
検査機関がすでに印を付けていたら?
エージェントが計算した値よりも、検査機関のフラグを優先します。
表ではないテキストでも使えますか?
はい。ナトリウム132 mmol/Lと基準範囲135から145のように、臨床テキストに書かれた値も読めます。
詳細
作者による元の説明
Parse laboratory values and reference ranges from clinical text and flag results as low, normal, high, or critical with OpenMed. Use when the user needs to interpret lab results, compute abnormal flags, parse reference ranges like \"135-145\" or \"<5\", honor an originating-lab flag (H/L/critical), or turn extracted lab entities into structured high/low/critical signals. Covers openmed.clinical.parse_reference_range, derive_abnormal_flag, ReferenceRange, and AbnormalFlag, with UCUM/LOINC framing. Unit-agnostic — it does not convert units. Pairs after extracting-clinical-entities (lab entities
repo: maziyarpanahi/openmed
人気
- GitHubのスター
- 5.8k
- ランキング
- #14717
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
annotating-variants
5.8kエージェントが、無料の公開アノテーターを使って、遺伝子バリアントの作用を予測し、HGVS名をゲノム上の位置に変換し、集団の頻度を付与できるよう支援します。
ask-openmed
5.8kエージェントが、臨床テキストの依頼に合ったOpenMedのワークフローを選べるよう支援します。患者データが含まれる可能性がある場合は、必ずプライバシーの確認から始めます。
assembling-fhir-bundles
5.8kエージェントが、複数のFHIR健康記録を、内部の参照を正しくつないだ一つのトランザクションBundleにまとめ、EHRに送れる状態にします。
auditing-deid-leakage
5.8kエージェントが、匿名化済みの臨床テキストに残っている識別子(SSN、カード番号、メール、日付など)をスキャンし、残っていれば公開を止めます。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。