Lab Result Interpretation
A medical assistant tool that transforms complex biochemical laboratory test results into clear, patient-friendly explanations.
Quick Check
CODEBLOCK0
When to Use
- - Use this skill to interpret biochemical lab test results and generate patient-friendly explanations.
- Use this skill to flag abnormal values with severity indicators and contextual health recommendations.
- Use this skill for data analysis tasks that require explicit assumptions, bounded scope, and a reproducible output format.
- Use this skill when you need a documented fallback path for missing inputs, execution errors, or partial evidence.
Workflow
- 1. Confirm the user objective, required inputs, and non-negotiable constraints before doing detailed work.
- Validate that the request matches the documented scope and stop early if the task would require unsupported assumptions.
- Use the packaged script path or the documented reasoning path with only the inputs that are actually available.
- Return a structured result that separates assumptions, deliverables, risks, and unresolved items.
- If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.
Critical values: When any value is in the critical range, output a Critical Findings Summary block at the top of the response before the per-test breakdown. Sort findings by severity (critical → high → normal). Include an explicit urgent care recommendation for critical values.
Features
- - Parses various lab test formats (numeric values, units, reference ranges)
- Compares values against standard reference ranges
- Generates patient-friendly explanations
- Flags abnormal values with severity indicators (critical → high → normal order)
- Provides contextual health recommendations
- Includes mandatory medical disclaimer in all outputs
Supported Test Types
| Category | Tests |
|---|
| Blood Routine | WBC, RBC, Hemoglobin, Platelets, Hematocrit |
| Lipid Panel |
Total Cholesterol, LDL, HDL, Triglycerides |
|
Liver Function | ALT, AST, ALP, GGT, Bilirubin, Total Protein, Albumin |
|
Kidney Function | Creatinine, BUN, eGFR, Uric Acid |
|
Blood Sugar | Fasting Glucose, HbA1c |
|
Thyroid | TSH, T3, T4, FT3, FT4 |
|
Electrolytes | Sodium, Potassium, Chloride, Calcium, Magnesium |
|
Inflammation | CRP, ESR |
Usage
As Module
CODEBLOCK1
CLI
CODEBLOCK2
Parameters
| Name | Type | Default | Required | Description |
|---|
| file | string | "" | No | Path to lab report file to process |
| interactive |
boolean | false | No | Enable interactive mode for manual input |
| input | string | "" | No | Direct lab test input string for interpretation |
Input Format
Accepts flexible formats:
CODEBLOCK3
Output Format
CODEBLOCK4
Medical Disclaimer
This tool provides educational information only and is not a substitute for professional medical advice, diagnosis, or treatment. Always consult with a qualified healthcare provider for interpretation of lab results. This tool does not diagnose — it only explains test meanings.
References
- -
references/lab_reference_ranges.json — Standard reference ranges - INLINECODE1 — Patient-friendly templates
- INLINECODE2 — Test descriptions and clinical notes
Dependencies
- - Python >= 3.8 (strictly required; dataclasses module used)
- Runtime version guard: The script must check
sys.version_info >= (3, 8) at startup and exit with 'Error: Python 3.8+ required' if the check fails, before any imports.
Prerequisites
CODEBLOCK5
Input Validation
This skill accepts: biochemical laboratory test results in standard formats (test name, value, unit, reference range) for the purpose of generating patient-friendly explanations.
If the user's request does not involve lab result interpretation — for example, asking to diagnose a condition, prescribe treatment, interpret imaging results, or perform general medical consultation — do not proceed with the workflow. Instead respond:
"lab-result-interpretation is designed to explain biochemical lab test values in patient-friendly language. It does not diagnose conditions or replace medical advice. Your request appears to be outside this scope. Please provide lab test values with reference ranges, or consult a qualified healthcare provider."
Do not continue the workflow when the request is out of scope, missing lab values, or would require clinical diagnosis. For missing inputs, state exactly which fields are missing.
Fallback Behavior
If scripts/main.py fails or required inputs are incomplete:
- 1. Report the exact failure point and error message.
- State what can still be completed (e.g., partial interpretation of available values).
- Manual fallback: use
--interactive mode to enter values one at a time, or provide the raw value and reference range for manual comparison. - Do not fabricate lab values, reference ranges, or clinical interpretations.
Boundary Enforcement
This skill explicitly does not:
- - Diagnose medical conditions
- Recommend specific medications or dosages
- Replace consultation with a licensed healthcare provider
- Interpret imaging, pathology, or genetic test results (for imaging results, consult a radiologist report; for genetic tests, consult a genetic counselor)
Any request that would require crossing these boundaries must be declined with the medical disclaimer and a referral to appropriate professional resources.
Output Requirements
Every final response must make these items explicit when relevant:
- - Objective or requested deliverable
- Inputs used and assumptions introduced
- Workflow or decision path
- Critical Findings Summary (if any value is critical — placed at top, before per-test breakdown)
- Core result, recommendation, or artifact
- Constraints, risks, caveats, or validation needs (including medical disclaimer)
- Unresolved items and next-step checks
Error Handling
- - If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.
- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
- If
scripts/main.py fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback. - If the
--file path contains ../ or points outside the workspace, reject with a path traversal warning before opening the file. - Do not fabricate files, citations, data, search results, or execution outcomes.
Response Template
Use the following fixed structure for non-trivial requests:
- 1. Objective
- Inputs Received
- Assumptions
- Workflow
- Critical Findings Summary (if applicable — urgent care recommendation for critical values)
- Deliverable
- Risks and Limits (always include medical disclaimer)
- Next Checks
For stress/multi-constraint requests, also include:
- - Constraints checklist (compliance, performance, error paths)
- Explicit boundary statement confirming no diagnosis was made
- Unresolved items with explicit blocking reasons
If the request is simple, you may compress the structure, but always keep the medical disclaimer and scope limits explicit.
实验室结果解读
一款医疗辅助工具,可将复杂的生化实验室检测结果转化为清晰、通俗易懂的患者友好型解释。
快速检查
bash
python -m py_compile scripts/main.py
python scripts/main.py --help
python scripts/main.py --interactive
使用场景
- - 使用此技能解读生化实验室检测结果,并生成患者友好型解释。
- 使用此技能标记异常值,附带严重程度指标和情境化健康建议。
- 用于需要明确假设、有限范围和可重复输出格式的数据分析任务。
- 当需要针对缺失输入、执行错误或部分证据提供文档化的备用路径时使用此技能。
工作流程
- 1. 在进行详细工作前,确认用户目标、所需输入和不可协商的约束条件。
- 验证请求是否与文档化范围匹配,如果任务需要不支持的假设,则提前停止。
- 仅使用实际可用的输入,采用打包脚本路径或文档化的推理路径。
- 返回结构化结果,将假设、交付物、风险和未解决项分开呈现。
- 如果执行失败或输入不完整,切换到备用路径,并明确说明阻止完整完成的具体原因。
危急值: 当任何值处于危急范围时,在响应顶部、逐项检测结果分解之前,输出一个危急发现摘要模块。按严重程度排序(危急→高→正常)。对危急值包含明确的紧急护理建议。
功能特点
- - 解析多种实验室检测格式(数值、单位、参考范围)
- 将数值与标准参考范围进行比较
- 生成患者友好型解释
- 标记异常值并附带严重程度指标(按危急→高→正常顺序)
- 提供情境化健康建议
- 所有输出中均包含强制性医疗免责声明
支持的检测类型
| 类别 | 检测项目 |
|---|
| 血常规 | 白细胞、红细胞、血红蛋白、血小板、血细胞比容 |
| 血脂四项 |
总胆固醇、低密度脂蛋白、高密度脂蛋白、甘油三酯 |
|
肝功能 | 丙氨酸氨基转移酶、天冬氨酸氨基转移酶、碱性磷酸酶、γ-谷氨酰转移酶、胆红素、总蛋白、白蛋白 |
|
肾功能 | 肌酐、血尿素氮、估算肾小球滤过率、尿酸 |
|
血糖 | 空腹血糖、糖化血红蛋白 |
|
甲状腺功能 | 促甲状腺激素、三碘甲状腺原氨酸、甲状腺素、游离三碘甲状腺原氨酸、游离甲状腺素 |
|
电解质 | 钠、钾、氯、钙、镁 |
|
炎症指标 | C反应蛋白、血沉 |
使用方法
作为模块
python
from scripts.main import LabResultInterpreter
interpreter = LabResultInterpreter()
result = interpreter.interpret(总胆固醇: 5.8 mmol/L (参考范围: 3.1-5.7))
print(result.explanation)
命令行界面
text
python scripts/main.py --file lab_report.txt
python scripts/main.py --interactive
参数
| 名称 | 类型 | 默认值 | 必需 | 描述 |
|---|
| file | 字符串 | | 否 | 要处理的实验室报告文件路径 |
| interactive |
布尔值 | false | 否 | 启用交互模式进行手动输入 |
| input | 字符串 | | 否 | 用于解读的直接实验室检测输入字符串 |
输入格式
接受灵活格式:
检测名称: 数值 单位 (参考范围: 最小值-最大值)
检测名称 数值 单位 参考范围: 最小值-最大值
检测名称: 数值 (最小值-最大值)
输出格式
json
{
test_name: 总胆固醇,
value: 5.8,
unit: mmol/L,
reference_min: 3.1,
reference_max: 5.7,
status: 偏高,
explanation: 您的总胆固醇略高于正常范围...,
severity: 轻度,
recommendation: 考虑减少饱和脂肪摄入...
}
医疗免责声明
本工具仅提供教育信息,不能替代专业医疗建议、诊断或治疗。请始终咨询合格的医疗保健提供者以解读实验室结果。本工具不进行诊断——仅解释检测含义。
参考资料
- - references/labreferenceranges.json — 标准参考范围
- references/explanationtemplates.json — 患者友好型模板
- references/testmetadata.json — 检测描述和临床说明
依赖项
- - Python >= 3.8(严格要求;使用数据类模块)
- 运行时版本检查: 脚本必须在启动时检查 sys.version_info >= (3, 8),如果检查失败,在任何导入之前退出并显示 错误:需要 Python 3.8+。
前提条件
text
pip install -r requirements.txt
输入验证
此技能接受:标准格式的生化实验室检测结果(检测名称、数值、单位、参考范围),用于生成患者友好型解释。
如果用户的请求不涉及实验室结果解读——例如,要求诊断疾病、开具治疗方案、解读影像结果或进行一般医疗咨询——则不继续执行工作流程。而是回复:
lab-result-interpretation 旨在用患者友好型语言解释生化实验室检测值。它不诊断疾病或替代医疗建议。您的请求似乎超出了此范围。请提供带有参考范围的实验室检测值,或咨询合格的医疗保健提供者。
当请求超出范围、缺少实验室值或需要临床诊断时,不要继续工作流程。对于缺失输入,明确说明哪些字段缺失。
备用行为
如果 scripts/main.py 失败或所需输入不完整:
- 1. 报告确切的失败点和错误消息。
- 说明仍然可以完成的内容(例如,对可用值的部分解读)。
- 手动备用:使用 --interactive 模式逐个输入值,或提供原始值和参考范围进行手动比较。
- 不要编造实验室值、参考范围或临床解读。
边界执行
此技能明确不:
- - 诊断医疗状况
- 推荐特定药物或剂量
- 替代持证医疗保健提供者的咨询
- 解读影像、病理或基因检测结果(对于影像结果,请咨询放射科医生报告;对于基因检测,请咨询遗传咨询师)
任何需要跨越这些边界的请求都必须被拒绝,并附上医疗免责声明和转介至适当的专业资源。
输出要求
每个最终响应在相关时必须明确包含以下项目:
- - 目标或请求的交付物
- 使用的输入和引入的假设
- 工作流程或决策路径
- 危急发现摘要(如果任何值为危急——置于顶部,在逐项检测结果分解之前)
- 核心结果、建议或产物
- 约束条件、风险、注意事项或验证需求(包括医疗免责声明)
- 未解决项和后续检查
错误处理
- - 如果缺少必需输入,明确说明哪些字段缺失,并仅请求最少量的额外信息。
- 如果任务超出文档化范围,则停止,而不是猜测或悄然扩大任务范围。
- 如果 scripts/main.py 失败,报告失败点,总结仍然可以安全完成的内容,并提供手动备用方案。
- 如果 --file 路径包含 ../ 或指向工作区之外,在打开文件前拒绝并发出路径遍历警告。
- 不要编造文件、引用、数据、搜索结果或执行结果。
响应模板
对于非简单请求,使用以下固定结构:
- 1. 目标
- 收到的输入
- 假设
- 工作流程
- 危急发现摘要(如适用——对危急值的紧急护理建议)
- 交付物
- 风险和限制(始终包含医疗免责声明)
- 后续检查
对于压力/多约束请求,还需包含:
- - 约束检查清单(合规性、性能、错误路径)
- 明确声明未进行诊断的边界声明
- 未解决项及明确的阻止原因
如果请求简单,可以压缩结构,但始终明确包含医疗免责声明和范围限制。