Communitygithub.com

ヘルスケアCDSSパターン

クリニカルデシジョンサポートシステム(CDSS)開発パターン。薬剤相互作用チェック、投与量検証、臨床スコアリング(NEWS2、qSOFA)、アラート重大度分類、EMRワークフローへの統合を提供します。

ヘルスケアCDSSパターン とは?

このスキルは、EMR(電子医療記録)ワークフローに統合するためのクリニカルデシジョンサポートシステム(CDSS)を構築するための包括的なパターンを提供します。CDSSモジュールは患者の安全に直結するため、false negative(見逃し)は絶対に許されません。主な機能は3つあります。1つ目は、新規薬剤と現在の投薬、アレルギー情報に基づいて相互作用をチェックし、重症度順にソートされたアラートを返す `checkInteractions` 関数。2つ目は、体重・年齢・腎機能に基づいて投与量を検証する `validateDose` 関数。3つ目は、NEWS2やqSOFAなどの臨床スコアを計算する `calculateNEWS2` 関数です。このエンジンは副作用のない純粋関数として設計されており、テストが容易で、アラートはUI上で重大度に応じた動作(ブロック・警告・情報)を行います。このスキルはClaude Codeやその他のAIエージェントで使用でき、安全な臨床判断をコードで実装したい開発者にとって非常に有用です。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/healthcare-cdss-patterns

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

ヘルスケアCDSS開発パターン

EMRワークフローに統合するクリニカルデシジョンサポートシステム(CDSS)を構築するためのパターン。CDSSモジュールは患者の安全に直結します — false negative(見逃し)は絶対に許されません。

使用するタイミング

  • 薬剤相互作用チェックの実装
  • 投与量検証エンジンの構築
  • 臨床スコアリングシステム(NEWS2、qSOFA、APACHE、GCS)の実装
  • 異常な臨床値に対するアラートシステムの設計
  • 安全性チェック付きの投薬オーダー入力の構築
  • 臨床コンテキストを考慮した検査結果解釈の構築

仕組み

CDSSエンジンは副作用のない純粋関数ライブラリです。臨床データを入力し、アラートを出力します。これにより完全にテスト可能になります。

3つの主要モジュール:

  1. checkInteractions(newDrug, currentMeds, allergies) — 新規薬剤を現在の投薬および既知のアレルギーと照合します。重症度順にソートされたInteractionAlert[]を返します。DrugInteractionPairデータモデルを使用します。
  2. validateDose(drug, dose, route, weight, age, renalFunction) — 処方された投与量を体重ベース、年齢調整、腎機能調整のルールに対して検証します。DoseValidationResultを返します。
  3. calculateNEWS2(vitals) — NEWS2InputからNational Early Warning Score 2を計算します。合計スコア、リスクレベル、エスカレーションガイダンスを含むNEWS2Resultを返します。
EMR UI
  ↓ (ユーザーがデータを入力)
CDSS Engine (純粋関数、副作用なし)
  ├── 薬剤相互作用チェッカー
  ├── 投与量バリデーター
  ├── 臨床スコアリング (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: `Cross-reactivity with documented allergy: ${allergy}`,
        recommendation: 'Do not prescribe without allergy consultation' });
    }
  }
  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: 'No validation rules available', suggestedRange: null, factors: [] };
  const factors: string[] = [];

  // SAFETY: ルールが体重を必要とするが体重がない場合はBLOCK(通過させない)
  if (rules.weightBased) {
    if (!patientWeight || patientWeight <= 0) {
      return { valid: false, message: `Weight required for ${drug} (mg/kg drug)`,
        suggestedRange: null, factors: ['weight_missing'] };
    }
    factors.push('weight');
    const maxDose = rules.maxPerKg * patientWeight;
    if (dose > maxDose) {
      return { valid: false, message: `Dose exceeds max for ${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: `Exceeds age-adjusted max for ${patientAge}yr`,
        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: `Exceeds renal-adjusted max for eGFR ${renalFunction}`,
        suggestedRange: { min: rules.typicalMin, max: renalMax, unit: rules.unit }, factors };
    }
  }

  // 絶対最大値
  if (dose > rules.absoluteMax) {
    return { valid: false, message: `Exceeds absolute max ${rules.absoluteMax}${rules.unit}`,
      suggestedRange: { min: rules.typicalMin, max: rules.absoluteMax, unit: rules.unit },
      factors: [...factors, 'absolute_max'] };
  }
  return { valid: true, message: 'Within range',
    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;
}

スコアリングテーブルは、Royal College of Physiciansの仕様と完全に一致している必要があります。

アラートの重大度とUI動作

重大度UI動作臨床医に必要なアクション
Criticalアクションをブロック。非表示不可のモーダル。赤色。続行するには上書き理由を文書化する必要あり
Majorインラインの警告バナー。橙色。続行する前に承認が必要
Minorインラインの情報メモ。黄色。認識のみ、アクション不要

Criticalアラートは、自動で消去されたり、トースト通知として実装されてはいけません。上書き理由は監査証跡に保存される必要があります。

CDSSのテスト(False Negativeに対するゼロトレランス)

describe('CDSS — Patient Safety', () => {
  INTERACTION_PAIRS.forEach(({ drugA, drugB, severity }) => {
    it(`detects ${drugA} + ${drugB} (${severity})`, () => {
      const alerts = checkInteractions(drugA, [drugB], []);
      expect(alerts.length).toBeGreaterThan(0);
      expect(alerts[0].severity).toBe(severity);
    });
    it(`detects ${drugB} + ${drugA} (reverse)`, () => {
      const alerts = checkInteractions(drugB, [drugA], []);
      expect(alerts.length).toBeGreaterThan(0);
    });
  });
  it('blocks mg/kg drug when weight is missing', () => {
    const result = validateDose('gentamicin', 300, 'iv');
    expect(result.valid).toBe(false);
    expect(result.factors).toContain('weight_missing');
  });
  it('handles malformed drug data gracefully', () => {
    expect(() => checkInteractions('', [], [])).not.toThrow();
  });
});

合格基準:100%。1回の見逃し相互作用が患者安全インシデントになります。

アンチパターン

  • CDSSチェックをオプションにしたり、文書化された理由なしにスキップ可能にすること
  • 相互作用チェックをトースト通知として実装すること
  • 薬剤データや臨床データにany型を使用すること
  • 保守可能なデータ構造を使用せずに相互作用ペアをハードコーディングすること
  • CDSSエンジンでエラーを黙ってキャッチすること(障害は大きく表面化させる必要があります)
  • 体重が利用できない場合に体重ベースの検証をスキップすること(通過させず、ブロックする必要があります)

例

例1:薬剤相互作用チェック

const alerts = checkInteractions('warfarin', ['aspirin', 'metformin'], ['penicillin']);
// [{ severity: 'critical', pair: ['warfarin', 'aspirin'],
//    message: 'Increased bleeding risk', recommendation: 'Avoid combination' }]

例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: 'Exceeds absolute max 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: 'Urgent clinical review. Consider 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/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

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.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

関連スキル