Chuyển đến nội dung chính

Bài 10: ATLAS — Concept Sets & Cohort Definitions

Tạo Concept Sets (include/exclude descendants, mapped), thiết kế Cohort Definitions (initial events, inclusion criteria, censoring, era logic), best practices cho cohort design, generate SQL và execute trên CDM database.

🏗️ Kiến trúc — Bài 10 Bài 10: ATLAS — Concept Sets & Cohort Definitions

OHDSI & OMOP CDM — Phân tích Dữ liệu Y tế Toàn diện

Phần 4: Phân tích Dữ liệu với ATLAS

xdev.asia

Bài 10: ATLAS — Concept Sets & Cohort Definitions

Giới thiệu

Cohort Definition là trung tâm của mọi phân tích trong ATLAS. Một "cohort" (đoàn hệ) là tập hợp bệnh nhân thỏa mãn các tiêu chí lâm sàng cụ thể trong một khoảng thời gian xác định.

Trước khi tạo cohort, bạn cần xây dựng Concept Sets — các tập hợp concepts dùng lại được.


1. Concept Sets — Chi tiết

1.1 Tạo Concept Set

ATLAS → Concept Sets → New Concept Set

Ví dụ: "Type 2 Diabetes Conditions"

Bước 1: Search "type 2 diabetes" trong ATLAS
Bước 2: Thêm concepts vào concept set:

┌──────────┬───────────────────────────────┬──────────┬─────────┐
│ Concept  │ Name                          │ Excluded │ Desc.   │
├──────────┼───────────────────────────────┼──────────┼─────────┤
│ 201826   │ Type 2 diabetes mellitus      │ ☐        │ ☑       │
│ 443238   │ Diabetic neuropathy           │ ☐        │ ☐       │
│ 4193704  │ Type 2 DM w/renal compl      │ ☐        │ ☐       │
│ 201254   │ Type 1 diabetes mellitus      │ ☑        │ ☐       │
└──────────┴───────────────────────────────┴──────────┴─────────┘

Columns giải thích:
- Excluded: ☑ = LOẠI BỎ concept này (exclude Type 1 DM)
- Descendants (Desc.): ☑ = bao gồm tất cả descendants trong hierarchy
- Mapped: ☑ = bao gồm cả non-standard mapped concepts

1.2 Include Descendants — Quan trọng

Concept 201826: Type 2 diabetes mellitus (SNOMED)
├── Descendants (khi ☑ Include Descendants):
│   ├── 443238  Diabetic neuropathy
│   ├── 4193704 Type 2 DM with renal complications
│   ├── 4063043 Type 2 DM with ophthalmic complications
│   ├── 443729  Diabetic retinopathy
│   ├── 4128709 Diabetic foot
│   └── ... (hàng trăm descendants)

Best Practice:
- ☑ Include Descendants cho ancestor concepts (Type 2 DM)
  → Tự động bao gồm DM with complications
- ☐ Exclude Descendants cho concepts cần loại bỏ cụ thể

1.3 Resolved Concept Set

ATLAS tab "Included Concepts" → xem danh sách đầy đủ concepts

"Type 2 Diabetes Conditions":
  201826 + descendants = 287 concepts included
  MINUS 201254 (Type 1 DM) = excluded
  = Final: ~285 concepts

→ Đây là tập concepts sẽ dùng trong Cohort Definitions

2. Cohort Definitions

2.1 Cấu trúc Cohort Definition

Cohort Definition gồm 4 phần:

1. INITIAL EVENTS (Sự kiện khởi đầu)
   → Sự kiện đưa bệnh nhân vào cohort
   → VD: Lần đầu được chẩn đoán Type 2 DM

2. INCLUSION CRITERIA (Tiêu chí bao gồm)
   → Điều kiện thêm phải thỏa mãn
   → VD: Có ≥ 365 ngày observation trước

3. COHORT EXIT (Rời khỏi cohort)
   → Khi nào bệnh nhân ra khỏi cohort
   → VD: Hết observation period, hoặc fixed duration

4. CENSORING EVENTS (Sự kiện kiểm duyệt)
   → Sự kiện kết thúc follow-up
   → VD: Tử vong, chuyển viện

2.2 Ví dụ: New-Onset Type 2 DM Cohort

Mục tiêu: Tìm bệnh nhân Type 2 DM mới khởi phát

INITIAL EVENTS:
  Event: Condition Occurrence
  Concept Set: "Type 2 Diabetes Conditions"
  First occurrence only: ☑ (chỉ lần chẩn đoán đầu tiên)

  Timeline:
  ←── 365 days before ───┤ Index Date ├──── After ────→
                          │ (first DM  │
                          │ diagnosis) │

INCLUSION CRITERIA:
  Criterion 1: "Có observation trước"
    Having: Observation Period
    At least 365 days BEFORE index date
    → Đảm bảo bệnh nhân có đủ lịch sử

  Criterion 2: "Không có DM trước đó"
    NOT Having: Condition Occurrence
    Concept Set: "Type 2 Diabetes Conditions"
    In the 365 days BEFORE index date
    → Loại bỏ bệnh nhân đã có DM trước (new-onset only)

  Criterion 3: "Tuổi ≥ 18"
    Having: Demographics
    Age ≥ 18 at index date

COHORT EXIT:
  End of continuous observation period

CENSORING:
  Death event

2.3 Tạo trong ATLAS

ATLAS → Cohort Definitions → New Cohort

Tab "Definition":

┌─────────────────────────────────────────────────────────┐
│  Cohort Definition: New-Onset Type 2 DM                 │
│                                                         │
│  ┌── Cohort Entry Events ──────────────────────────┐   │
│  │                                                  │   │
│  │  Add Initial Event:                              │   │
│  │  [+ Add Condition Occurrence]                    │   │
│  │                                                  │   │
│  │  Any condition occurrence of:                    │   │
│  │  [Type 2 Diabetes Conditions ▼]  (Concept Set)  │   │
│  │                                                  │   │
│  │  ☑ First occurrence only                         │   │
│  │  □ Restrict initial events to...                 │   │
│  └──────────────────────────────────────────────────┘   │
│                                                         │
│  ┌── Inclusion Criteria ───────────────────────────┐   │
│  │                                                  │   │
│  │  ↓ Criterion 1: Has ≥ 365 days prior obs        │   │
│  │  ↓ Criterion 2: No prior DM in 365 days         │   │
│  │  ↓ Criterion 3: Age ≥ 18                        │   │
│  │                                                  │   │
│  │  [+ Add Criterion]                              │   │
│  └──────────────────────────────────────────────────┘   │
│                                                         │
│  ┌── Cohort Exit ─────────────────────────────────┐   │
│  │  ○ End of observation period                     │   │
│  │  ○ Fixed duration: ___ days after index          │   │
│  │  ○ Custom exit criteria                          │   │
│  └──────────────────────────────────────────────────┘   │
│                                                         │
│  [💾 Save]  [▶ Generate]  [📋 Export]  [SQL]          │
└─────────────────────────────────────────────────────────┘

3. Inclusion Criteria — Chi tiết

3.1 Criteria Types

Criteria có thể dựa trên:

Clinical Events:
  - Condition Occurrence (chẩn đoán)
  - Drug Exposure (thuốc)
  - Procedure Occurrence (thủ thuật)
  - Measurement (xét nghiệm) — kèm value filter
  - Observation (quan sát)
  - Visit Occurrence (lượt khám)
  - Device Exposure (thiết bị)

Demographics:
  - Age (at index date)
  - Gender
  - Race
  - Ethnicity

Temporal:
  - Observation Period (trước/sau index date)

3.2 Temporal Logic

Relative to Index Date:

  ←── Before ───┤ Index ├──── After ────→

  Any time before index:    (-inf, 0]
  Within 365 days before:   [-365, 0]
  Within 30 days after:     [0, 30]
  Any time after index:     [0, +inf)
  Between 30 and 365 after: [30, 365]

Ví dụ: "Dùng Metformin trong 30 ngày sau chẩn đoán DM"
  Drug Exposure: Metformin
  Time window: [0, 30] days after index
  Count: At least 1 occurrence

3.3 Attrition Report

Sau khi Generate cohort, ATLAS hiển thị Attrition:

Total patients:                     50,000  (100%)
  ↓ Has Type 2 DM diagnosis
  Has initial event:                 8,500   (17%)
  ↓ First occurrence only
  First occurrence:                  6,200   (12.4%)
  ↓ Criterion 1: ≥ 365 days prior obs
  After criterion 1:                 5,800   (11.6%)
  ↓ Criterion 2: No prior DM
  After criterion 2:                 4,500   (9.0%)
  ↓ Criterion 3: Age ≥ 18
  Final cohort:                      4,200   (8.4%)

→ Giúp hiểu mỗi criterion loại bao nhiêu bệnh nhân
→ Nếu criterion nào loại quá nhiều → xem lại logic

4. Generate & Execute Cohort

4.1 Generate

ATLAS → Cohort Definition → [▶ Generate]
  → Chọn CDM Source: Hospital XYZ Vietnam
  → WebAPI tạo SQL → Execute trên CDM database
  → Kết quả ghi vào Results schema: COHORT table

COHORT table:
┌──────────────────┬───────────┬────────────────┬──────────────┐
│ cohort_definition│ subject_id│ cohort_start   │ cohort_end   │
│ _id              │           │ _date          │ _date        │
├──────────────────┼───────────┼────────────────┼──────────────┤
│ 1                │ 12345     │ 2020-03-15     │ 2024-06-30   │
│ 1                │ 23456     │ 2019-11-20     │ 2024-12-31   │
│ 1                │ 34567     │ 2021-07-08     │ 2023-04-15   │
└──────────────────┴───────────┴────────────────┴──────────────┘

4.2 View Generated SQL

ATLAS → Cohort Definition → Tab "SQL"
→ Xem SQL được generate, có thể copy và chạy trực tiếp

Hữu ích cho:
- Debug logic cohort
- Chạy cohort trên database không có WebAPI
- Optimize SQL performance

5. Cohort Design Best Practices

1. Bắt đầu đơn giản, thêm complexity dần
   → Initial event + 1 criterion → verify → thêm criteria

2. Kiểm tra Attrition Report
   → Mỗi criterion nên loại < 50% (nếu loại quá nhiều → xem lại)

3. Dùng Concept Sets (không hardcode concept IDs)
   → Dễ maintain, tái sử dụng, chia sẻ

4. Include Descendants cho ancestor concepts
   → Tránh miss descendants mới khi vocabulary update

5. Washout period cho "new-onset" cohorts
   → Ít nhất 365 ngày trước index date không có event
   → Đảm bảo thực sự là "new onset"

6. Peer review cohort definitions
   → Clinician review clinical logic
   → Data engineer review technical logic

7. Test trên demo data trước
   → atlas-demo.ohdsi.org có synthetic data
   → Verify cohort logic hoạt động đúng

Tóm tắt

Khái niệmGiải thích
Concept SetTập hợp concepts tái sử dụng (include/exclude descendants)
Cohort DefinitionĐịnh nghĩa nhóm bệnh nhân (initial event + criteria + exit)
Initial EventSự kiện đưa bệnh nhân vào cohort (first occurrence)
Inclusion CriteriaĐiều kiện lọc thêm (prior obs, age, no prior event...)
Cohort ExitKhi nào bệnh nhân ra khỏi cohort
Attrition ReportBáo cáo số bệnh nhân bị loại sau mỗi criterion
Washout PeriodKhoảng thời gian "clean" trước index date

Bài tiếp theo: ATLAS — Characterization, Incidence Rates & Pathways