Help users record and manage medication intake, set reminders, and look up basic medication information.
Use Cases
- The user says "Help me note down the medications I need to take every day" or "Remind me to take my medication at 8 PM"
- The user needs to manage the intake times of multiple medications
- The user wants to look up basic information about a certain medication
Medication List Management
Data Storage
# 药单存储路径
mkdir -p ~/.xiaodazi/medication
Medication List Format
cat > ~/.xiaodazi/medication/prescriptions.json << 'EOF' { "medications": [ { "name": "Atorvastatin Calcium Tablets", "dosage": "20mg", "frequency": "Once daily", "time": "21:00", "notes": "Take before bed, avoid taking with grapefruit", "started": "2025-01-15", "prescriber": "Cardiology Dr. Wang" } ], "updated_at": "2025-02-07" } EOF
### 添加药物
用户口述后,LLM 结构化写入药单。
### 查看药单
```bash
cat ~/.xiaodazi/medication/prescriptions.json | python3 -c "
import json, sys
data = json.load(sys.stdin)
for m in data.get('medications', []):
print(f'💊 {m[\"name\"]} {m[\"dosage\"]}')
print(f' 频率: {m[\"frequency\"]},时间: {m[\"time\"]}')
if m.get('notes'):
print(f' 注意: {m[\"notes\"]}')
print()
"
Medication Records
# 记录服药
cat >> ~/.xiaodazi/medication/log_$(date +%Y-%m).json << EOF
{"date": "$(date +%Y-%m-%d)", "time": "$(date +%H:%M)", "medication": "阿托伐他汀钙片", "taken": true}
EOF
Reminder Mechanism
In conjunction with macos-notification / windows-notification / linux-notification to send reminders:
# macOS 提醒示例
osascript -e 'display notification "该服用阿托伐他汀钙片 20mg 了" with title "小搭子 · 用药提醒" sound name "default"'
Medication Information Lookup (OpenFDA API, free)
# 按药名查询
curl -s "https://api.fda.gov/drug/label.json?search=openfda.brand_name:atorvastatin&limit=1" | python3 -c "
import json, sys
data = json.load(sys.stdin)
result = data.get('results', [{}])[0]
print(f'药品: {result.get(\"openfda\", {}).get(\"brand_name\", [\"?\"])[0]}')
print(f'用途: {result.get(\"indications_and_usage\", [\"?\"])[0][:200]}...')
print(f'警告: {result.get(\"warnings\", [\"?\"])[0][:200]}...')
"
Safety Rules
- Disclaimer: Include "For reference only, please follow your doctor's advice" every time medication information is provided
- No Diagnosis: Do not judge the user's symptoms, do not recommend medications
- Do Not Advise Stopping/Changing Medication: Such actions must be discussed with a doctor
- Medication list data is stored only locally and is not uploaded