diabetes-management

Personal diabetes self-management assistant. Supports recording blood glucose, meals (carbohydrates/calories), medications, exercise, weight, HbA1c and notes; performs statistical analyses (mean, TIR time-in-range percentage, hypo/hyperglycemia events, estimated HbA1c from average glucose); and generates daily or period management reports (Markdown or self-contained HTML, including TIR distribution bars and daily trends). Includes built-in Chinese food carbohydrate references and glycemic control standards, for recording, viewing control trends, and generating weekly/monthly management reports.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "diabetes-management" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-4dabd2c0a3dfe72ec278662a6aa9f596ed6386d0bbd5d46ab484cd2b83012ce3. Verify the upstream source and version against https://skillhub.cn/skills/user_a16b2e76/tangniaobingzhushou before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Personal diabetes self-management assistant. Supports recording blood glucose, meals (carbohydrates/calories), medications, exercise, weight, HbA1c and notes; performs statistical analyses (mean, TIR time-in-range percentage, hypo/hyperglycemia events, estimated HbA1c from average glucose); and generates daily or period management reports (Markdown or self-contained HTML, including TIR distribution bars and daily trends). Includes built-in Chinese food carbohydrate references and glycemic control standards, for recording, viewing control trends, and generating weekly/monthly management reports.

0 Downloads

Introduction source: third_party · user_a16b2e76 · 1.1.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: diabetes-management
description: 个人糖尿病自我管理助手。支持记录血糖、餐食(碳水/热量)、用药、运动、体重、糖化血红蛋白(HbA1c)与备注,并基于这些数据做统计分析(均值、TIR 达标时间占比、低血糖/高血糖事件、由平均血糖估算 HbA1c)、生成每日/周期管理报告(Markdown 或自包含 HTML,含 TIR 分布条与每日趋势)。内置中式食物碳水参考与控糖标准。当用户想记录血糖/饮食/用药、查看控糖趋势、生成糖尿病管理周报/月报、了解 TIR 或 HbA1c 含义、或做糖尿病自我健康管理时使用。
agent_created: true
version: "1.1.0"

个人糖尿病管理助手

Overview

为糖尿病患者 / 高风险人群提供一套零依赖(仅 Python 标准库)的自我管理工具:把分散的血糖、饮食、用药、运动、体重、HbA1c 记录集中到一份 JSON 数据中,自动产出统计指标与可视化报告。既可在对话里随时记录与查询,也可定期生成可发给医生 / 家属 / 自己的管理报告。

核心理念:记录 → 统计 → 报告 → 行动,让控糖效果可量化、可追踪。

When to use

  • 记录一次血糖(空腹 / 餐后 / 睡前 / 随机),或连续记录血糖
  • 记录一餐的碳水 / 热量,评估饮食对血糖的影响
  • 记录用药、胰岛素、运动、体重、HbA1c
  • 查看一段时间内的控糖趋势(均值、TIR、高低血糖事件)
  • 生成糖尿病管理周报 / 月报(Markdown 或 HTML)
  • 理解 TIR(达标时间占比)、HbA1c、血糖控制目标等专业概念
  • 估算当前平均血糖对应的 HbA1c 水平

内置示例数据(开箱即用)

本 skill 自带一套可运行的示例数据,无需自备即可体验完整流程:

  • 路径:sample_data/demo_log.json(约 130 条记录,覆盖 2026-07-01~07-14 两周)
  • 配套报告:sample_data/demo_report.html、sample_data/demo_report.md

直接运行即可看到效果:

# 统计示例数据
python scripts/diabetes_log.py --store sample_data/demo_log.json stats --start 2026-07-01 --end 2026-07-14

# 生成 HTML 报告
python scripts/diabetes_report.py --store sample_data/demo_log.json --from 2026-07-01 --to 2026-07-14 --name 示例用户 --out sample_data/demo_report.html

Core workflow

  1. 建立个人数据库(首次使用):默认数据文件为 ~/.workbuddy/diabetes_log.json。 也可指定任意路径:--store /path/to/my_log.json,便于按人 / 按家人分别管理。
  2. 日常记录(随时):用 add-* 子命令追加血糖、餐食、用药、运动、体重、HbA1c、备注。
  3. 查询 / 复盘:用 list 查看最近记录,stats 看周期指标(TIR、均值、高低血糖事件)。
  4. 生成报告:用 diabetes_report.py 产出 Markdown(贴文档 / 微信)或 HTML(带图表、可打印成 PDF 发给医生)。
  5. 解读与行动:结合 references/glucose_standards.md(控糖目标 / TIR / HbA1c 公式)与报告里的"个性化提示",调整饮食 / 运动 / 用药,必要时就医。

Quick start(脚本)

记录

# 血糖(场景:空腹/餐前/餐后2h/睡前/夜间/随机)
python scripts/diabetes_log.py --store MY.json add-glucose --value 6.2 --context 空腹 --note "早起"

# 餐食(碳水克数、热量 kcal)
python scripts/diabetes_log.py --store MY.json add-meal --desc "米饭+青菜+鸡胸" --carbs 60 --calories 520

# 用药 / 运动 / 体重 / HbA1c / 备注
python scripts/diabetes_log.py --store MY.json add-med --name 二甲双胍 --dose "0.5g 早餐后"
python scripts/diabetes_log.py --store MY.json add-exercise --kind 快走 --minutes 30
python scripts/diabetes_log.py --store MY.json add-weight --kg 68.5
python scripts/diabetes_log.py --store MY.json add-hba1c --value 6.8
python scripts/diabetes_log.py --store MY.json add-note --text "今天运动后有点心慌"

查询与统计

# 最近 20 条(可加 --type glucose/meal/med/...)
python scripts/diabetes_log.py --store MY.json list --limit 20

# 指定时间段统计
python scripts/diabetes_log.py --store MY.json stats --start 2026-07-01 --end 2026-07-14

生成报告

# HTML 报告(含 TIR 分布、每日趋势、可打印 PDF)
python scripts/diabetes_report.py --store MY.json --from 2026-07-01 --to 2026-07-14 --name 张三 --out report.html

# Markdown 报告(适合贴文档 / 聊天)
python scripts/diabetes_report.py --store MY.json --name 张三 --out report.md

数据模型(JSON)

单文件 JSON,结构:

{
  "version": 1,
  "entries": [
    {"id": 1, "type": "glucose", "ts": "2026-07-01 07:10", "value": 6.2, "context": "空腹", "note": ""},
    {"id": 2, "type": "meal", "ts": "...", "desc": "...", "carbs": 60, "calories": 520, "note": ""},
    {"id": 3, "type": "med", "ts": "...", "name": "二甲双胍", "dose": "0.5g 早餐后", "note": ""},
    {"id": 4, "type": "exercise", "ts": "...", "kind": "快走", "minutes": 30, "note": ""},
    {"id": 5, "type": "weight", "ts": "...", "kg": 68.5},
    {"id": 6, "type": "hba1c", "ts": "...", "value": 7.2},
    {"id": 7, "type": "note", "ts": "...", "text": "..."}
  ]
}
  • --store 决定文件位置;不传则默认 ~/.workbuddy/diabetes_log.json。
  • 文件损坏时会自动备份为 .corrupt.<时间戳> 再新建空库,避免数据全丢。

健壮性 / 异常处理

工具面向长期日常记录,尽量做到"错了也不丢数据、提示看得懂":

  • 日期格式友好报错:--ts / --start / --end 若写错(如用 2026/07/01、26-7-1),会明确告诉你正确写法(2026-07-20 / 2026-07-20 08:30 / now),而不是抛一堆看不懂的报错。
  • 日期段含当天整天:--start/--end 传日期时,起始按当天 00:00、结束按当天 23:59:59 计入,避免"少统计了最后一天"。
  • 数据文件损坏自动备份:读取到坏文件时自动备份为 .corrupt.<时间戳> 并新建空库继续,原数据保留可找回。
  • 写入自动重试:保存数据 / 报告时若遇磁盘繁忙、文件被占用(如报告正被打开)等瞬时错误,会自动退避重试最多 3 次;仍失败才提示,并给出"检查磁盘空间 / 是否被其他程序占用"的排查方向,而非直接崩溃。
  • 未知血糖场景容错:--context 写了不认识的场景会按"随机"记录并友好提示,不中断。

指标说明(详见 references)

  • TIR(Time In Range):血糖处于 3.9–10.0 mmol/L 的时间占比,目标 ≥70%。
  • 估算 HbA1c:由平均血糖经 Nathan 公式 A1C(%) = (平均血糖_mg/dL + 46.7) / 28.7 推算(平均血糖 mg/dL = mmol/L×18),仅供趋势参考,不替代静脉化验。
  • 低血糖 / 高血糖事件:区间划分参见 references/glucose_standards.md。

Bundled resources

scripts/

  • diabetes_log.py — 数据记录与统计(add-* / list / stats),零依赖。
  • diabetes_report.py — 报告生成(Markdown / HTML),复用 diabetes_log.py 的统计逻辑。

references/

  • glucose_standards.md — 血糖控制目标、TIR 区间划分、HbA1c 公式、低血糖处理、提示触发逻辑。
  • food_carb_db.md — 中式常见食物碳水 / 热量参考表,用于餐食记录与估算。

sample_data/

  • demo_log.json — 两周示例记录(开箱即用)。
  • demo_report.html / demo_report.md — 由示例数据生成的报告样例。

设计要点 / 边界

  • 纯本地、零依赖:仅用 Python 标准库,不联网、不上传,适合健康隐私数据。
  • 口径一致性:统计与报告共用同一套区间与公式(在 diabetes_log.py 中定义,diabetes_report.py 复用),避免口径漂移。
  • 非医疗建议:所有输出仅用于自我管理参考,明确标注"不替代医生诊断与处方"。涉及用药调整、胰岛素剂量、急症(如严重低血糖 / 酮症)必须就医。

在对话中如何使用本 skill

当用户说"帮我记一下今早空腹血糖 6.2""这周血糖控制得怎么样""生成一份糖尿病周报""晚餐吃了米饭炒菜大概多少碳水"时:

  1. 判断意图属于记录 / 查询 / 报告 / 咨询哪一类。
  2. 记录类:调用 diabetes_log.py 的对应 add-* 子命令(用 --store 指定该用户的数据文件,默认 ~/.workbuddy/diabetes_log.json)。
  3. 查询 / 统计类:调用 stats / list;需要解释指标含义时加载 references/glucose_standards.md。
  4. 报告类:调用 diabetes_report.py 生成 HTML 或 Markdown,必要时用 present_files 展示给用户。
  5. 饮食咨询类:加载 references/food_carb_db.md 估算碳水 / 热量,并给"先菜后饭、搭配蛋白与蔬菜"等控糖建议。
  6. 始终在结论中保留"仅供参考、不替代医生诊断"的边界提示;出现严重低 / 高血糖时优先建议就医或按 15-15 法则处理。

Current listing version

1.1.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 面向糖尿病患者/高风险人群的刚需场景,提供血糖、饮食、用药、运动等全方位记录与统计分析
  • 支持生成可视化报告(Markdown/HTML),便于与医生/家属沟通,显著提升日常健康管理效率
  • 内置中式食物碳水参考与控糖标准,贴合本地用户需求
Trigger Precision95/100

Highlights

  • 触发词精准完整,覆盖记录、查询、报告、咨询等多种使用场景
  • 边界清晰,明确区分自我管理与医疗建议的界限
Structure and Standards95/100

Highlights

  • 结构清晰完整,包含从快速入门到详细工作流的全方位说明
  • 提供开箱即用的示例数据与报告样例,降低用户上手门槛
Execution Reliability95/100

Highlights

  • 健壮性设计优秀,涵盖日期格式容错、文件损坏自动备份、写入重试等关键异常处理
  • 纯本地零依赖,保障健康隐私数据安全
Evidence Verifiability (mean of the first four)95/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.