Reka Bentuk Seni Bina CDS Hooks

CDS Hooks adalah spesifikasi HL7 untuk menyepadukan perkhidmatan sokongan keputusan klinikal (CDS) dengan aliran kerja EHR. Ia membolehkan sistem luaran memberikan cadangan semasa titik keputusan klinikal.


Gambaran Keseluruhan Seni Bina

┌────────────────────────────────────────────────────────────────┐
│                        Sistem EHR                              │
│  ┌──────────────────────────────────────────────────────────┐ │
│  │                    Aliran Kerja Klinikal                 │ │
│  │                                                          │ │
│  │   [Lihat Pesakit] → [Preskripsi] → [Tandatangan Order]  │ │
│  │         │                │                │              │ │
│  │         ▼                ▼                ▼              │ │
│  │    patient-view    order-select    order-sign           │ │
│  │         │                │                │              │ │
│  └─────────┴────────────────┴────────────────┴──────────────┘ │
│                             │                                  │
│                     CDS Hooks Client                           │
└─────────────────────────────┬──────────────────────────────────┘
                              │
              ┌───────────────┴───────────────┐
              ▼                               ▼
┌─────────────────────────┐    ┌─────────────────────────┐
│    MyTxGNN CDS Service  │    │   Perkhidmatan CDS Lain │
│                         │    │                         │
│  ┌───────────────────┐  │    │  ┌───────────────────┐  │
│  │ Discovery Endpoint│  │    │  │ Discovery Endpoint│  │
│  │ GET /cds-services │  │    │  │ GET /cds-services │  │
│  └───────────────────┘  │    │  └───────────────────┘  │
│                         │    │                         │
│  ┌───────────────────┐  │    │  ┌───────────────────┐  │
│  │ Service Endpoint  │  │    │  │ Service Endpoint  │  │
│  │POST /cds-services/│  │    │  │POST /cds-services/│  │
│  │    {service-id}   │  │    │  │    {service-id}   │  │
│  └───────────────────┘  │    │  └───────────────────┘  │
└─────────────────────────┘    └─────────────────────────┘

Hooks yang Disokong

1. patient-view

Dicetuskan apabila doktor membuka rekod pesakit.

Aspek Nilai
Titik Pencetus Buka carta pesakit
Tujuan Amaran awal, ringkasan
Konteks patientId, userId

Contoh MyTxGNN:

{
  "cards": [
    {
      "summary": "Calon Penggunaan Semula Dikesan",
      "detail": "3 ubat pesakit mempunyai ramalan penggunaan semula keyakinan tinggi",
      "indicator": "info",
      "source": {
        "label": "MyTxGNN"
      }
    }
  ]
}

2. order-select

Dicetuskan apabila doktor memilih ubat untuk preskripsi.

Aspek Nilai
Titik Pencetus Pilih ubat
Tujuan Cadangan, amaran awal
Konteks selections, draftOrders

3. order-sign

Dicetuskan sebelum doktor menandatangani pesanan.

Aspek Nilai
Titik Pencetus Tandatangan pesanan
Tujuan Amaran kritikal, pengesahan
Konteks draftOrders

Reka Bentuk Perkhidmatan MyTxGNN

Discovery Response

{
  "services": [
    {
      "hook": "patient-view",
      "id": "mytxgnn-patient-summary",
      "title": "MyTxGNN Patient Summary",
      "description": "Shows drug repurposing opportunities for patient's current medications",
      "prefetch": {
        "medications": "MedicationRequest?patient=&status=active"
      }
    },
    {
      "hook": "order-select",
      "id": "mytxgnn-drug-info",
      "title": "MyTxGNN Drug Information",
      "description": "Shows repurposing predictions for selected drug",
      "prefetch": {
        "medications": "MedicationRequest?patient=&status=active"
      }
    }
  ]
}

Prefetch

Prefetch membolehkan perkhidmatan CDS meminta data yang diperlukan dalam permintaan hook:

{
  "prefetch": {
    "patient": "Patient/",
    "medications": "MedicationRequest?patient=&status=active",
    "conditions": "Condition?patient=&clinical-status=active"
  }
}

Aliran Permintaan

1. Permintaan Hook

POST /cds-services/mytxgnn-drug-info
Content-Type: application/json

{
  "hook": "order-select",
  "hookInstance": "abc-123",
  "context": {
    "userId": "Practitioner/dr-smith",
    "patientId": "Patient/john-doe",
    "selections": ["MedicationRequest/draft-1"]
  },
  "prefetch": {
    "medications": {
      "resourceType": "Bundle",
      "entry": [...]
    }
  }
}

2. Pemprosesan

def process_hook(request):
    # 1. Ekstrak konteks
    patient_id = request['context']['patientId']
    selections = request['context']['selections']

    # 2. Dapatkan ubat dari prefetch atau query
    medications = request.get('prefetch', {}).get('medications')
    if not medications:
        medications = fetch_medications(patient_id)

    # 3. Cari ramalan MyTxGNN
    predictions = get_repurposing_predictions(medications)

    # 4. Jana kad
    cards = generate_cards(predictions)

    return {"cards": cards}

3. Respons

{
  "cards": [
    {
      "uuid": "card-1",
      "summary": "Prednisolone: 15 ramalan penggunaan semula",
      "detail": "Prednisolone mempunyai 15 indikasi berpotensi dengan skor ≥0.7, termasuk rinitis alahan dan asma.",
      "indicator": "info",
      "source": {
        "label": "MyTxGNN",
        "url": "https://mytxgnn.yao.care"
      },
      "links": [
        {
          "label": "Lihat laporan penuh",
          "url": "https://mytxgnn.yao.care/drugs/prednisolone/",
          "type": "absolute"
        }
      ]
    }
  ]
}

Struktur Kad

Medan Jenis Penerangan
uuid string Pengenalan unik kad
summary string Tajuk ringkas (< 140 aksara)
detail string Penerangan terperinci (markdown)
indicator code info, warning, critical
source object Sumber maklumat
suggestions array Cadangan tindakan
links array Pautan luaran

Pelaksanaan

Teknologi

Komponen Pilihan
Pelayan Flask, FastAPI, Express
Pangkalan Data PostgreSQL, Redis (cache)
FHIR Client fhirclient, hapi-fhir

Contoh Pelayan (FastAPI)

from fastapi import FastAPI, Request
from pydantic import BaseModel

app = FastAPI()

class CDSRequest(BaseModel):
    hook: str
    hookInstance: str
    context: dict
    prefetch: dict = None

@app.get("/cds-services")
async def discovery():
    return {
        "services": [
            {
                "hook": "patient-view",
                "id": "mytxgnn-summary",
                "title": "MyTxGNN Summary"
            }
        ]
    }

@app.post("/cds-services/mytxgnn-summary")
async def patient_summary(request: CDSRequest):
    patient_id = request.context.get("patientId")
    # Logik pemprosesan...
    return {
        "cards": [
            {
                "summary": "Ringkasan MyTxGNN",
                "detail": "...",
                "indicator": "info",
                "source": {"label": "MyTxGNN"}
            }
        ]
    }

Pengujian

CDS Hooks Sandbox

Gunakan sandbox.cds-hooks.org untuk menguji perkhidmatan:

  1. Masukkan URL discovery: https://mytxgnn.yao.care/cds-services
  2. Pilih hook (cth. patient-view)
  3. Konfigurasi konteks
  4. Lihat respons kad

Amalan Terbaik

  1. Prestasi: Respons dalam < 500ms
  2. Relevansi: Hanya papar kad yang bermakna
  3. Kejelasan: Gunakan bahasa mudah difahami
  4. Tindakan: Sertakan cadangan yang boleh dilaksanakan
  5. Pengendalian Ralat: Kembalikan senarai kad kosong jika tiada amaran

Sumber Rujukan

Sumber Pautan
CDS Hooks Spec cds-hooks.org
CDS Hooks Sandbox sandbox.cds-hooks.org
HL7 CDS Hooks IG hl7.org/fhir/cds-hooks

Penafian
Dokumentasi seni bina ini adalah untuk rujukan reka bentuk. Pelaksanaan CDS untuk kegunaan klinikal memerlukan pengujian dan pengesahan yang teliti.

Kemas kini terakhir: 2026-03-03 | Pasukan Penyelidikan MyTxGNN

Hak Cipta © 2026 Projek MyTxGNN. Untuk tujuan penyelidikan sahaja. Bukan nasihat perubatan.