Communitygithub.com

醫療保健 CDSS 開發模式

臨床決策支持系統(CDSS)開發模式。包含藥物交互作用檢查、劑量驗證、臨床評分(NEWS2、qSOFA)、警報嚴重度分類以及與 EMR 工作流程的整合。在建立臨床決策支援功能(如藥物交互作用檢查、劑量驗證、臨床評分或警報嚴重度)時使用。

醫療保健 CDSS 開發模式 是什麼?

此技能提供一套用於建構臨床決策支援系統(CDSS)的開發模式,這些系統可整合至電子病歷(EMR)工作流程中。它專注於病患安全關鍵模組,強調對偽陰性零容忍。主要模組包括一個純函數庫,用於藥物交互作用檢查(使用雙向互動配對)、劑量驗證(根據體重、年齡和腎功能進行調整)、以及臨床評分(例如,嚴格遵循英國皇家醫學會規格的 NEWS2)。警報會根據嚴重度進行分類(重大、主要、次要),並有特定的 UI 行為,例如重大警報會封鎖動作,且不得以滑出通知(Toast)形式實作。此技能還包含詳細的 TypeScript 介面、程式碼範例以及測試模式,以確保 100% 的通過率,因為任何遺漏的交互作用都構成病患安全事件。此技能支援 Cursor、Claude Code 和 Codex 等平台。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/healthcare-cdss-patterns

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

醫療保健 CDSS 開發模式 是做什麼的?

用於建構可整合至 EMR 工作流程的臨床決策支援系統(CDSS)的模式。CDSS 模組事關病患安全,對偽陰性零容忍。

使用時機

  • 實作藥物交互作用檢查
  • 建構劑量驗證引擎
  • 實作臨床評分系統(NEWS2、qSOFA、APACHE、GCS)
  • 設計異常臨床值的警報系統
  • 建構含安全檢查的醫囑輸入
  • 整合實驗室結果解讀與臨床背景

運作方式

CDSS 引擎是一個無副作用的純函數庫。輸入臨床數據,輸出警報。這使其完全可測試。

三個主要模組:

  1. checkInteractions(newDrug, currentMeds, allergies) — 檢查新藥物與當前用藥及已知過敏原的交互作用。回傳按嚴重度排序的 InteractionAlert[]。使用 DrugInteractionPair 資料模型。
  2. validateDose(drug, dose, route, weight, age, renalFunction) — 根據體重、年齡和腎功能調整規則驗證處方劑量。回傳 DoseValidationResult。
  3. calculateNEWS2(vitals) — 根據 NEWS2Input 計算國家早期預警評分 2。回傳包含總分、風險等級和升級指導的 NEWS2Result。
EMR UI
  ↓ (使用者輸入數據)
CDSS 引擎(純函數,無副作用)
  ├── 藥物交互作用檢查器
  ├── 劑量驗證器
  ├── 臨床評分(NEWS2、qSOFA 等)
  └── 警報分類器
  ↓ (回傳警報)
EMR UI(內聯顯示警報,若為重大則封鎖)

藥物交互作用檢查

interface DrugInteractionPair {
  drugA: string;           // 通用名稱
  drugB: string;           // 通用名稱
  severity: 'critical' | 'major' | 'minor';
  mechanism: string;
  clinicalEffect: string;
  recommendation: string;
}

function checkInteractions(
  newDrug: string,
  currentMedications: string[],
  allergyList: string[]
): InteractionAlert[] {
  if (!newDrug) return [];
  const alerts: InteractionAlert[] = [];
  for (const current of currentMedications) {
    const interaction = findInteraction(newDrug, current);
    if (interaction) {
      alerts.push({ severity: interaction.severity, pair: [newDrug, current],
        message: interaction.clinicalEffect, recommendation: interaction.recommendation });
    }
  }
  for (const allergy of allergyList) {
    if (isCrossReactive(newDrug, allergy)) {
      alerts.push({ severity: 'critical', pair: [newDrug, allergy],
        message: `與記錄的過敏原交互反應:${allergy}`,
        recommendation: '未經過敏諮詢請勿處方' });
    }
  }
  return alerts.sort((a, b) => severityOrder(a.severity) - severityOrder(b.severity));
}

交互作用配對必須是雙向的:如果藥物 A 與藥物 B 交互作用,那麼藥物 B 也與藥物 A 交互作用。

劑量驗證

interface DoseValidationResult {
  valid: boolean;
  message: string;
  suggestedRange: { min: number; max: number; unit: string } | null;
  factors: string[];
}

function validateDose(
  drug: string,
  dose: number,
  route: 'oral' | 'iv' | 'im' | 'sc' | 'topical',
  patientWeight?: number,
  patientAge?: number,
  renalFunction?: number
): DoseValidationResult {
  const rules = getDoseRules(drug, route);
  if (!rules) return { valid: true, message: '無可用的驗證規則', suggestedRange: null, factors: [] };
  const factors: string[] = [];

  // 安全考量:如果規則需要體重但體重缺失,則封鎖(不通過)
  if (rules.weightBased) {
    if (!patientWeight || patientWeight <= 0) {
      return { valid: false, message: `${drug} 需要體重(mg/kg 藥物)`,
        suggestedRange: null, factors: ['weight_missing'] };
    }
    factors.push('weight');
    const maxDose = rules.maxPerKg * patientWeight;
    if (dose > maxDose) {
      return { valid: false, message: `超過 ${patientWeight}kg 的最大劑量`,
        suggestedRange: { min: rules.minPerKg * patientWeight, max: maxDose, unit: rules.unit }, factors };
    }
  }

  // 根據年齡調整(當規則定義年齡區間且年齡已提供時)
  if (rules.ageAdjusted && patientAge !== undefined) {
    factors.push('age');
    const ageMax = rules.getAgeAdjustedMax(patientAge);
    if (dose > ageMax) {
      return { valid: false, message: `超過 ${patientAge} 歲的年齡調整後最大值`,
        suggestedRange: { min: rules.typicalMin, max: ageMax, unit: rules.unit }, factors };
    }
  }

  // 根據腎功能調整(當規則定義 eGFR 區間且 eGFR 已提供時)
  if (rules.renalAdjusted && renalFunction !== undefined) {
    factors.push('renal');
    const renalMax = rules.getRenalAdjustedMax(renalFunction);
    if (dose > renalMax) {
      return { valid: false, message: `超過 eGFR ${renalFunction} 的腎功能調整後最大值`,
        suggestedRange: { min: rules.typicalMin, max: renalMax, unit: rules.unit }, factors };
    }
  }

  // 絕對最大值
  if (dose > rules.absoluteMax) {
    return { valid: false, message: `超過絕對最大值 ${rules.absoluteMax}${rules.unit}`,
      suggestedRange: { min: rules.typicalMin, max: rules.absoluteMax, unit: rules.unit },
      factors: [...factors, 'absolute_max'] };
  }
  return { valid: true, message: '在範圍內',
    suggestedRange: { min: rules.typicalMin, max: rules.typicalMax, unit: rules.unit }, factors };
}

臨床評分:NEWS2

interface NEWS2Input {
  respiratoryRate: number; oxygenSaturation: number; supplementalOxygen: boolean;
  temperature: number; systolicBP: number; heartRate: number;
  consciousness: 'alert' | 'voice' | 'pain' | 'unresponsive';
}
interface NEWS2Result {
  total: number;           // 0-20
  risk: 'low' | 'low-medium' | 'medium' | 'high';
  components: Record<string, number>;
  escalation: string;
}

評分表必須完全符合英國皇家醫學會的規格。

警報嚴重度與 UI 行為

嚴重度UI 行為臨床醫師需採取的動作
重大 (Critical)封鎖動作。不可關閉的模態視窗。紅色。必須記錄覆寫原因才能繼續
主要 (Major)內聯警告橫幅。橙色。必須確認才能繼續
次要 (Minor)內聯資訊提示。黃色。僅需知悉,無需動作

重大警報絕對不得自動關閉或以滑出通知(Toast)形式實作。覆寫原因必須儲存在稽核軌跡中。

測試 CDSS(對偽陰性零容忍)

describe('CDSS — 病患安全', () => {
  INTERACTION_PAIRS.forEach(({ drugA, drugB, severity }) => {
    it(`檢測到 ${drugA} + ${drugB}(${severity})`, () => {
      const alerts = checkInteractions(drugA, [drugB], []);
      expect(alerts.length).toBeGreaterThan(0);
      expect(alerts[0].severity).toBe(severity);
    });
    it(`檢測到 ${drugB} + ${drugA}(反向)`, () => {
      const alerts = checkInteractions(drugB, [drugA], []);
      expect(alerts.length).toBeGreaterThan(0);
    });
  });
  it('當體重缺失時封鎖 mg/kg 藥物', () => {
    const result = validateDose('gentamicin', 300, 'iv');
    expect(result.valid).toBe(false);
    expect(result.factors).toContain('weight_missing');
  });
  it('優雅地處理格式錯誤的藥物數據', () => {
    expect(() => checkInteractions('', [], [])).not.toThrow();
  });
});

通過標準:100%。任何一次遺漏的交互作用都是一起病患安全事件。

反模式

  • 讓 CDSS 檢查變成可選或可跳過,且無需記錄原因
  • 將交互作用檢查實作為滑出通知(Toast)
  • 對藥物或臨床數據使用 any 型別
  • 硬編碼交互作用配對,而非使用可維護的資料結構
  • 在 CDSS 引擎中靜默捕獲錯誤(必須大聲地呈現失敗)
  • 當體重數據不可用時跳過基於體重的驗證(必須封鎖,而非通過)

範例

範例 1:藥物交互作用檢查

const alerts = checkInteractions('warfarin', ['aspirin', 'metformin'], ['penicillin']);
// [{ severity: 'critical', pair: ['warfarin', 'aspirin'],
//    message: '增加出血風險', recommendation: '避免合併使用' }]

範例 2:劑量驗證

const ok = validateDose('paracetamol', 1000, 'oral', 70, 45);
// { valid: true, suggestedRange: { min: 500, max: 4000, unit: 'mg' } }

const bad = validateDose('paracetamol', 5000, 'oral', 70, 45);
// { valid: false, message: '超過絕對最大值 4000mg' }

const noWeight = validateDose('gentamicin', 300, 'iv');
// { valid: false, factors: ['weight_missing'] }

範例 3:NEWS2 評分

const result = calculateNEWS2({
  respiratoryRate: 24, oxygenSaturation: 93, supplementalOxygen: true,
  temperature: 38.5, systolicBP: 100, heartRate: 110, consciousness: 'voice'
});
// { total: 13, risk: 'high', escalation: '緊急臨床審查。考慮 ICU。' }

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相關技能