@xdev-asia/xdev-knowledge-mcp 1.0.56 → 1.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/01-phan-1-tong-quan-nen-tang/lessons/bai-1-omop-cdm-la-gi-tai-sao-can-chuan-hoa-du-lieu-y-te.md +339 -0
  2. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/01-phan-1-tong-quan-nen-tang/lessons/bai-2-kien-truc-tong-the-omop-cdm-5-4-nhom-bang-nguyen-ly-thiet-ke.md +440 -0
  3. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/01-phan-1-tong-quan-nen-tang/lessons/bai-3-hieu-concept-trai-tim-cua-omop-cdm.md +441 -0
  4. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/02-phan-2-person-visit-nen-tang/lessons/bai-4-bang-person-quan-ly-danh-tinh-benh-nhan.md +323 -0
  5. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/02-phan-2-person-visit-nen-tang/lessons/bai-5-observation-period-khoang-thoi-gian-theo-doi-benh-nhan.md +308 -0
  6. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/02-phan-2-person-visit-nen-tang/lessons/bai-6-visit-occurrence-visit-detail-luot-kham-chi-tiet.md +353 -0
  7. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/03-phan-3-su-kien-lam-sang-chinh/lessons/bai-10-measurement-xet-nghiem-do-luong.md +409 -0
  8. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/03-phan-3-su-kien-lam-sang-chinh/lessons/bai-7-condition-occurrence-chan-doan-benh-ly.md +285 -0
  9. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/03-phan-3-su-kien-lam-sang-chinh/lessons/bai-8-drug-exposure-thuoc-dieu-tri.md +354 -0
  10. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/03-phan-3-su-kien-lam-sang-chinh/lessons/bai-9-procedure-occurrence-thu-thuat-phau-thuat.md +291 -0
  11. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/04-phan-4-bang-lam-sang-mo-rong/lessons/bai-11-observation-su-kien-lam-sang-tong-hop.md +289 -0
  12. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/04-phan-4-bang-lam-sang-mo-rong/lessons/bai-12-device-exposure-specimen-note.md +313 -0
  13. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/04-phan-4-bang-lam-sang-mo-rong/lessons/bai-13-death-episode-episode-event.md +346 -0
  14. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/05-phan-5-standardized-vocabularies/lessons/bai-14-concept-vocabulary-nen-tang-tu-dien-chuan.md +298 -0
  15. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/05-phan-5-standardized-vocabularies/lessons/bai-15-concept-relationship-concept-ancestor.md +336 -0
  16. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/05-phan-5-standardized-vocabularies/lessons/bai-16-drug-strength-cac-bang-vocabulary-con-lai.md +295 -0
  17. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/06-phan-6-health-system-economics-derived/lessons/bai-17-location-care-site-provider.md +334 -0
  18. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/06-phan-6-health-system-economics-derived/lessons/bai-18-payer-plan-period-cost.md +343 -0
  19. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/06-phan-6-health-system-economics-derived/lessons/bai-19-condition-era-drug-era-dose-era.md +418 -0
  20. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/chapters/07-phan-7-metadata-cohort-tong-ket/lessons/bai-20-cdm-source-metadata-cohort-tong-ket.md +517 -0
  21. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/index.md +385 -0
  22. package/package.json +1 -1
@@ -0,0 +1,517 @@
1
+ ---
2
+ id: 019f1a00-a120-7b01-e001-omopcdm54020
3
+ title: "Bài 20: CDM_SOURCE, METADATA, COHORT & Tổng kết toàn bộ OMOP CDM 5.4"
4
+ slug: bai-20-cdm-source-metadata-cohort-tong-ket
5
+ description: >-
6
+ Bảng CDM_SOURCE mô tả nguồn dữ liệu, METADATA lưu thông tin bổ sung,
7
+ COHORT quản lý nhóm nghiên cứu. Tổng kết toàn bộ 37 bảng OMOP CDM 5.4
8
+ và lộ trình tiếp theo.
9
+ duration_minutes: 55
10
+ is_free: true
11
+ video_url: null
12
+ sort_order: 20
13
+ section_title: "Phần 7: Metadata, Cohort & Tổng kết"
14
+ course:
15
+ id: 019f1a00-a100-7b01-e001-omopcdm54001
16
+ title: "OMOP CDM 5.4 cho Người mới — Hiểu từ A đến Z"
17
+ slug: omop-cdm-5-4-cho-nguoi-moi-bat-dau
18
+ ---
19
+
20
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 340" style="max-width: 100%; height: auto; border-radius: 12px; margin-bottom: 1.5rem;">
21
+ <defs>
22
+ <linearGradient id="bg-omop20" x1="0%" y1="0%" x2="100%" y2="100%">
23
+ <stop offset="0%" style="stop-color:#0c1222"/>
24
+ <stop offset="100%" style="stop-color:#1e293b"/>
25
+ </linearGradient>
26
+ </defs>
27
+ <rect width="1200" height="340" rx="12" fill="url(#bg-omop20)"/>
28
+ <g>
29
+ <circle cx="700" cy="90" r="24" fill="#818cf8" opacity="0.12"/>
30
+ <circle cx="800" cy="120" r="20" fill="#818cf8" opacity="0.08"/>
31
+ <circle cx="880" cy="80" r="18" fill="#818cf8" opacity="0.07"/>
32
+ <circle cx="950" cy="140" r="16" fill="#818cf8" opacity="0.06"/>
33
+ <line x1="640" y1="160" x2="1100" y2="250" stroke="#818cf8" stroke-width="0.5" opacity="0.1"/>
34
+ </g>
35
+ <rect x="60" y="50" width="4" height="60" rx="2" fill="#818cf8"/>
36
+ <rect x="80" y="50" width="130" height="28" rx="14" fill="#818cf8" opacity="0.15"/>
37
+ <text x="92" y="69" font-family="system-ui,-apple-system,sans-serif" font-size="13" font-weight="600" fill="#818cf8">🏗️ Kiến trúc — Bài 20</text>
38
+ <text x="60" y="140" font-family="system-ui,-apple-system,sans-serif" font-size="34" font-weight="700" fill="#f1f5f9">
39
+ <tspan x="60" dy="0">CDM_SOURCE, METADATA,</tspan>
40
+ <tspan x="60" dy="42">COHORT &amp; Tổng kết OMOP 5.4</tspan>
41
+ </text>
42
+ <text x="60" y="244" font-family="system-ui,-apple-system,sans-serif" font-size="15" fill="#94a3b8" opacity="0.8">OMOP CDM 5.4 cho Người mới — Hiểu từ A đến Z</text>
43
+ <text x="60" y="268" font-family="system-ui,-apple-system,sans-serif" font-size="13" fill="#64748b" opacity="0.6">Phần 7: Metadata, Cohort &amp; Tổng kết</text>
44
+ <text x="1140" y="320" font-family="system-ui,-apple-system,sans-serif" font-size="12" fill="#475569" text-anchor="end" opacity="0.4">xdev.asia</text>
45
+ </svg>
46
+
47
+ ![Tổng quan toàn bộ OMOP CDM 5.4 — 37 bảng, 7 nhóm](/storage/uploads/2026/04/omop-cdm-bai20-complete-overview.png)
48
+
49
+ ## Giới thiệu
50
+
51
+ Bài cuối cùng của series! Chúng ta sẽ tìm hiểu nhóm **Metadata** (CDM_SOURCE, METADATA) và **COHORT** — bảng quản lý nhóm nghiên cứu. Sau đó tổng kết toàn bộ 37+ bảng OMOP CDM 5.4 và lộ trình học tiếp.
52
+
53
+ ---
54
+
55
+ ## 1. CDM_SOURCE — Thông tin nguồn dữ liệu
56
+
57
+ ### 1.1. Cấu trúc bảng
58
+
59
+ | Cột | Kiểu | Bắt buộc | Mô tả |
60
+ |-----|------|----------|-------|
61
+ | `cdm_source_name` | VARCHAR(255) | ✅ | Tên nguồn dữ liệu |
62
+ | `cdm_source_abbreviation` | VARCHAR(25) | ✅ | Tên viết tắt |
63
+ | `cdm_holder` | VARCHAR(255) | | Tổ chức sở hữu |
64
+ | `source_description` | CLOB | | Mô tả chi tiết |
65
+ | `source_documentation_reference` | VARCHAR(255) | | URL tài liệu |
66
+ | `cdm_etl_reference` | VARCHAR(255) | | URL ETL documentation |
67
+ | `source_release_date` | DATE | | Ngày release dữ liệu |
68
+ | `cdm_release_date` | DATE | | Ngày chuyển đổi CDM |
69
+ | `cdm_version` | VARCHAR(10) | | Phiên bản CDM (v5.4) |
70
+ | `cdm_version_concept_id` | INTEGER | | FK → CONCEPT |
71
+ | `vocabulary_version` | VARCHAR(20) | | Phiên bản vocabulary |
72
+
73
+ ### 1.2. Ví dụ dữ liệu VN
74
+
75
+ ```sql
76
+ INSERT INTO cdm_source (
77
+ cdm_source_name,
78
+ cdm_source_abbreviation,
79
+ cdm_holder,
80
+ source_description,
81
+ cdm_etl_reference,
82
+ source_release_date,
83
+ cdm_release_date,
84
+ cdm_version,
85
+ cdm_version_concept_id,
86
+ vocabulary_version
87
+ ) VALUES (
88
+ 'Bệnh viện Bạch Mai - Hệ thống HIS',
89
+ 'BACHMAI_HIS',
90
+ 'Bệnh viện Bạch Mai',
91
+ 'Dữ liệu EMR từ hệ thống HIS Bệnh viện Bạch Mai, '
92
+ || 'bao gồm khám ngoại trú và nội trú từ 2020-2024. '
93
+ || 'Chuyển đổi theo OMOP CDM 5.4 phục vụ nghiên cứu '
94
+ || 'dịch tễ học lâm sàng.',
95
+ 'https://github.com/bachmai-etl/omop-cdm',
96
+ '2024-06-30', -- Ngày xuất dữ liệu nguồn
97
+ '2024-09-15', -- Ngày hoàn tất ETL
98
+ 'v5.4',
99
+ 756265, -- CDM v5.4 concept_id
100
+ 'v5.0 30-AUG-24' -- Vocabulary version từ Athena
101
+ );
102
+ ```
103
+
104
+ ### 1.3. Tại sao CDM_SOURCE quan trọng?
105
+
106
+ - **Traceability**: biết dữ liệu từ đâu, ETL khi nào
107
+ - **Network studies**: so sánh kết quả giữa các site
108
+ - **Reproducibility**: tái tạo kết quả nghiên cứu
109
+ - **Compliance**: kiểm toán tuân thủ
110
+
111
+ ---
112
+
113
+ ## 2. METADATA — Thông tin bổ sung
114
+
115
+ ### 2.1. Cấu trúc bảng
116
+
117
+ | Cột | Kiểu | Bắt buộc | Mô tả |
118
+ |-----|------|----------|-------|
119
+ | `metadata_id` | INTEGER | ✅ PK | ID duy nhất |
120
+ | `metadata_concept_id` | INTEGER | ✅ | Loại metadata (FK → CONCEPT) |
121
+ | `metadata_type_concept_id` | INTEGER | ✅ | Kiểu metadata |
122
+ | `name` | VARCHAR(250) | ✅ | Tên key |
123
+ | `value_as_string` | VARCHAR(250) | | Giá trị text |
124
+ | `value_as_concept_id` | INTEGER | | Giá trị concept |
125
+ | `value_as_number` | FLOAT | | Giá trị số |
126
+ | `metadata_date` | DATE | | Ngày ghi nhận |
127
+ | `metadata_datetime` | DATETIME | | Datetime ghi nhận |
128
+
129
+ ### 2.2. Ví dụ sử dụng
130
+
131
+ ```sql
132
+ -- Ghi nhận thông tin ETL
133
+ INSERT INTO metadata VALUES (1, 0, 0, 'ETL_TOOL', 'WhiteRabbit + RabbitInAHat', NULL, NULL, '2024-09-15', NULL);
134
+ INSERT INTO metadata VALUES (2, 0, 0, 'ETL_VERSION', '1.2.0', NULL, NULL, '2024-09-15', NULL);
135
+ INSERT INTO metadata VALUES (3, 0, 0, 'SOURCE_PATIENT_COUNT', NULL, NULL, 125000, '2024-09-15', NULL);
136
+ INSERT INTO metadata VALUES (4, 0, 0, 'CDM_PATIENT_COUNT', NULL, NULL, 118500, '2024-09-15', NULL);
137
+ INSERT INTO metadata VALUES (5, 0, 0, 'MAPPING_COVERAGE_PCT', NULL, NULL, 94.8, '2024-09-15', NULL);
138
+ INSERT INTO metadata VALUES (6, 0, 0, 'COUNTRY', 'Vietnam', NULL, NULL, '2024-09-15', NULL);
139
+ ```
140
+
141
+ > METADATA là bảng key-value linh hoạt — dùng để lưu bất kỳ thông tin nào không fit vào CDM_SOURCE.
142
+
143
+ ---
144
+
145
+ ## 3. COHORT — Nhóm nghiên cứu
146
+
147
+ ### 3.1. Cấu trúc bảng
148
+
149
+ | Cột | Kiểu | Bắt buộc | Mô tả |
150
+ |-----|------|----------|-------|
151
+ | `cohort_definition_id` | INTEGER | ✅ | FK → COHORT_DEFINITION |
152
+ | `subject_id` | INTEGER | ✅ | ID đối tượng (thường = person_id) |
153
+ | `cohort_start_date` | DATE | ✅ | Ngày vào cohort |
154
+ | `cohort_end_date` | DATE | ✅ | Ngày ra cohort |
155
+
156
+ ### 3.2. COHORT_DEFINITION (nhắc lại từ Bài 16)
157
+
158
+ | Cột | Kiểu | Mô tả |
159
+ |-----|------|-------|
160
+ | `cohort_definition_id` | INTEGER PK | ID định nghĩa |
161
+ | `cohort_definition_name` | VARCHAR(255) | Tên cohort |
162
+ | `cohort_definition_description` | CLOB | Mô tả |
163
+ | `definition_type_concept_id` | INTEGER | Loại |
164
+ | `cohort_definition_syntax` | CLOB | Logic tạo cohort |
165
+ | `subject_concept_id` | INTEGER | Đối tượng |
166
+ | `cohort_initiation_date` | DATE | Ngày tạo |
167
+
168
+ ### 3.3. Cách sử dụng: Tạo cohort tiểu đường type 2
169
+
170
+ ```sql
171
+ -- Bước 1: Định nghĩa cohort
172
+ INSERT INTO cohort_definition (
173
+ cohort_definition_id,
174
+ cohort_definition_name,
175
+ cohort_definition_description,
176
+ definition_type_concept_id,
177
+ cohort_definition_syntax,
178
+ subject_concept_id,
179
+ cohort_initiation_date
180
+ ) VALUES (
181
+ 101,
182
+ 'Tiểu đường Type 2 mới phát hiện 2023',
183
+ 'BN có chẩn đoán T2DM lần đầu trong 2023, '
184
+ || 'có ít nhất 365 ngày observation trước đó, '
185
+ || 'không có T1DM.',
186
+ 0,
187
+ '{
188
+ "PrimaryCriteria": {
189
+ "CriteriaList": [{
190
+ "ConditionOccurrence": {
191
+ "CodesetId": 201826
192
+ }
193
+ }],
194
+ "ObservationWindow": {"PriorDays": 365}
195
+ },
196
+ "ExclusionCriteria": [{
197
+ "ConditionOccurrence": {
198
+ "CodesetId": 201254
199
+ }
200
+ }]
201
+ }',
202
+ 0,
203
+ '2024-09-15'
204
+ );
205
+
206
+ -- Bước 2: Populate cohort
207
+ INSERT INTO cohort (
208
+ cohort_definition_id,
209
+ subject_id,
210
+ cohort_start_date,
211
+ cohort_end_date
212
+ )
213
+ SELECT
214
+ 101 AS cohort_definition_id,
215
+ co.person_id AS subject_id,
216
+ MIN(co.condition_start_date) AS cohort_start_date,
217
+ COALESCE(
218
+ (SELECT MAX(op.observation_period_end_date)
219
+ FROM observation_period op
220
+ WHERE op.person_id = co.person_id),
221
+ MIN(co.condition_start_date)
222
+ ) AS cohort_end_date
223
+ FROM condition_occurrence co
224
+ JOIN concept_ancestor ca
225
+ ON co.condition_concept_id = ca.descendant_concept_id
226
+ WHERE ca.ancestor_concept_id = 201826 -- Type 2 DM
227
+ AND co.condition_start_date BETWEEN '2023-01-01' AND '2023-12-31'
228
+ -- Phải có 365 ngày observation trước
229
+ AND EXISTS (
230
+ SELECT 1 FROM observation_period op
231
+ WHERE op.person_id = co.person_id
232
+ AND op.observation_period_start_date
233
+ <= co.condition_start_date - INTERVAL '365 days'
234
+ )
235
+ -- Loại trừ T1DM
236
+ AND NOT EXISTS (
237
+ SELECT 1 FROM condition_occurrence co2
238
+ JOIN concept_ancestor ca2
239
+ ON co2.condition_concept_id = ca2.descendant_concept_id
240
+ WHERE ca2.ancestor_concept_id = 201254 -- Type 1 DM
241
+ AND co2.person_id = co.person_id
242
+ AND co2.condition_start_date <= co.condition_start_date
243
+ )
244
+ GROUP BY co.person_id;
245
+ ```
246
+
247
+ ### 3.4. Phân tích trên cohort
248
+
249
+ ```sql
250
+ -- Tổng quan cohort T2DM 2023
251
+ SELECT
252
+ cd.cohort_definition_name,
253
+ COUNT(DISTINCT c.subject_id) AS patient_count,
254
+ AVG(p.year_of_birth) AS avg_birth_year,
255
+ ROUND(
256
+ SUM(CASE WHEN p.gender_concept_id = 8507 THEN 1 ELSE 0 END)
257
+ * 100.0 / COUNT(*), 1
258
+ ) AS male_pct
259
+ FROM cohort c
260
+ JOIN cohort_definition cd
261
+ ON c.cohort_definition_id = cd.cohort_definition_id
262
+ JOIN person p ON c.subject_id = p.person_id
263
+ WHERE c.cohort_definition_id = 101
264
+ GROUP BY cd.cohort_definition_name;
265
+ ```
266
+
267
+ ---
268
+
269
+ ## 4. Tổng kết toàn bộ OMOP CDM 5.4
270
+
271
+ ### 4.1. Danh sách 37+ bảng theo nhóm
272
+
273
+ ```
274
+ ╔═══════════════════════════════════════════════════╗
275
+ ║ OMOP CDM 5.4 — 37+ Bảng ║
276
+ ╠═══════════════════════════════════════════════════╣
277
+ ║ ║
278
+ ║ ▎ CLINICAL DATA (16 bảng) ║
279
+ ║ ├── PERSON Bài 4 ║
280
+ ║ ├── OBSERVATION_PERIOD Bài 5 ║
281
+ ║ ├── VISIT_OCCURRENCE Bài 6 ║
282
+ ║ ├── VISIT_DETAIL Bài 6 ║
283
+ ║ ├── CONDITION_OCCURRENCE Bài 7 ║
284
+ ║ ├── DRUG_EXPOSURE Bài 8 ║
285
+ ║ ├── PROCEDURE_OCCURRENCE Bài 9 ║
286
+ ║ ├── MEASUREMENT Bài 10 ║
287
+ ║ ├── OBSERVATION Bài 11 ║
288
+ ║ ├── DEVICE_EXPOSURE Bài 12 ║
289
+ ║ ├── SPECIMEN Bài 12 ║
290
+ ║ ├── NOTE Bài 12 ║
291
+ ║ ├── NOTE_NLP Bài 12 ║
292
+ ║ ├── DEATH Bài 13 ║
293
+ ║ ├── EPISODE Bài 13 (CDM 5.4) ║
294
+ ║ └── EPISODE_EVENT Bài 13 (CDM 5.4) ║
295
+ ║ ║
296
+ ║ ▎ HEALTH SYSTEM DATA (3 bảng) ║
297
+ ║ ├── LOCATION Bài 17 ║
298
+ ║ ├── CARE_SITE Bài 17 ║
299
+ ║ └── PROVIDER Bài 17 ║
300
+ ║ ║
301
+ ║ ▎ HEALTH ECONOMICS DATA (2 bảng) ║
302
+ ║ ├── PAYER_PLAN_PERIOD Bài 18 ║
303
+ ║ └── COST Bài 18 ║
304
+ ║ ║
305
+ ║ ▎ STANDARDIZED VOCABULARIES (12 bảng) ║
306
+ ║ ├── CONCEPT Bài 3, 14 ║
307
+ ║ ├── VOCABULARY Bài 14 ║
308
+ ║ ├── DOMAIN Bài 14 ║
309
+ ║ ├── CONCEPT_CLASS Bài 14 ║
310
+ ║ ├── CONCEPT_RELATIONSHIP Bài 15 ║
311
+ ║ ├── RELATIONSHIP Bài 15 ║
312
+ ║ ├── CONCEPT_SYNONYM Bài 15 ║
313
+ ║ ├── CONCEPT_ANCESTOR Bài 15 ║
314
+ ║ ├── SOURCE_TO_CONCEPT_MAP Bài 15 ║
315
+ ║ ├── DRUG_STRENGTH Bài 16 ║
316
+ ║ ├── COHORT_DEFINITION Bài 16, 20 ║
317
+ ║ └── ATTRIBUTE_DEFINITION Bài 16 ║
318
+ ║ ║
319
+ ║ ▎ DERIVED ELEMENTS (3 bảng) ║
320
+ ║ ├── CONDITION_ERA Bài 19 ║
321
+ ║ ├── DRUG_ERA Bài 19 ║
322
+ ║ └── DOSE_ERA Bài 19 ║
323
+ ║ ║
324
+ ║ ▎ METADATA (2 bảng) ║
325
+ ║ ├── CDM_SOURCE Bài 20 ║
326
+ ║ └── METADATA Bài 20 ║
327
+ ║ ║
328
+ ║ ▎ COHORT (1 bảng) ║
329
+ ║ └── COHORT Bài 20 ║
330
+ ║ ║
331
+ ╚═══════════════════════════════════════════════════╝
332
+ ```
333
+
334
+ ### 4.2. 5 nguyên lý thiết kế (nhắc lại)
335
+
336
+ | # | Nguyên lý | Ý nghĩa |
337
+ |---|-----------|---------|
338
+ | 1 | **Person-centric** | Mọi dữ liệu xoay quanh PERSON |
339
+ | 2 | **Observation period** | Chỉ phân tích trong thời gian theo dõi |
340
+ | 3 | **Standard Concepts** | Mã chuẩn hóa qua Vocabulary |
341
+ | 4 | **Domain routing** | Dữ liệu đi vào bảng theo domain |
342
+ | 5 | **Source values preserved** | Giữ nguyên mã nguồn gốc |
343
+
344
+ ### 4.3. CDM 5.4 — Các thay đổi quan trọng (so với 5.3)
345
+
346
+ | Thay đổi | Chi tiết |
347
+ |----------|---------|
348
+ | **EPISODE / EPISODE_EVENT** | Bảng mới cho oncology |
349
+ | **measurement_event_id** | Polymorphic FK trong MEASUREMENT |
350
+ | **observation_event_id** | Polymorphic FK trong OBSERVATION |
351
+ | **procedure_end_date/datetime** | Thêm ngày kết thúc cho Procedure |
352
+ | **unit_source_concept_id** | Thêm vào MEASUREMENT |
353
+ | **production_id** | Thêm vào DEVICE_EXPOSURE (UDI) |
354
+
355
+ ---
356
+
357
+ ## 5. Kiểm tra chất lượng dữ liệu (DQD)
358
+
359
+ ### 5.1. OHDSI Data Quality Dashboard
360
+
361
+ ```
362
+ ┌──────────────────────────────────────────┐
363
+ │ Data Quality Dashboard (DQD) │
364
+ │ │
365
+ │ Kiểm tra 3500+ rules: │
366
+ │ │
367
+ │ 1. Completeness — Đầy đủ │
368
+ │ Bao nhiêu % records có concept != 0? │
369
+ │ │
370
+ │ 2. Conformance — Tuân thủ │
371
+ │ Giá trị có hợp lệ? (date, range) │
372
+ │ │
373
+ │ 3. Plausibility — Hợp lý │
374
+ │ Trẻ 5 tuổi có chẩn đoán Alzheimer? │
375
+ │ │
376
+ │ Output: Bảng báo cáo PASS/FAIL │
377
+ │ cho từng rule │
378
+ └──────────────────────────────────────────┘
379
+ ```
380
+
381
+ ### 5.2. Kiểm tra nhanh bằng SQL
382
+
383
+ ```sql
384
+ -- Mapping completeness: % records có concept_id != 0
385
+ SELECT
386
+ 'condition_occurrence' AS table_name,
387
+ COUNT(*) AS total,
388
+ SUM(CASE WHEN condition_concept_id = 0 THEN 1 ELSE 0 END) AS unmapped,
389
+ ROUND(
390
+ SUM(CASE WHEN condition_concept_id != 0 THEN 1 ELSE 0 END)
391
+ * 100.0 / COUNT(*), 1
392
+ ) AS mapped_pct
393
+ FROM condition_occurrence
394
+
395
+ UNION ALL
396
+
397
+ SELECT 'drug_exposure', COUNT(*),
398
+ SUM(CASE WHEN drug_concept_id = 0 THEN 1 ELSE 0 END),
399
+ ROUND(SUM(CASE WHEN drug_concept_id != 0 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 1)
400
+ FROM drug_exposure
401
+
402
+ UNION ALL
403
+
404
+ SELECT 'procedure_occurrence', COUNT(*),
405
+ SUM(CASE WHEN procedure_concept_id = 0 THEN 1 ELSE 0 END),
406
+ ROUND(SUM(CASE WHEN procedure_concept_id != 0 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 1)
407
+ FROM procedure_occurrence
408
+
409
+ UNION ALL
410
+
411
+ SELECT 'measurement', COUNT(*),
412
+ SUM(CASE WHEN measurement_concept_id = 0 THEN 1 ELSE 0 END),
413
+ ROUND(SUM(CASE WHEN measurement_concept_id != 0 THEN 1 ELSE 0 END) * 100.0 / COUNT(*), 1)
414
+ FROM measurement;
415
+ ```
416
+
417
+ ```sql
418
+ -- Kiểm tra orphan records
419
+ -- (records không có observation_period tương ứng)
420
+ SELECT 'condition_occurrence' AS src, COUNT(*) AS orphan_count
421
+ FROM condition_occurrence co
422
+ WHERE NOT EXISTS (
423
+ SELECT 1 FROM observation_period op
424
+ WHERE op.person_id = co.person_id
425
+ AND co.condition_start_date BETWEEN
426
+ op.observation_period_start_date
427
+ AND op.observation_period_end_date
428
+ )
429
+
430
+ UNION ALL
431
+
432
+ SELECT 'drug_exposure', COUNT(*)
433
+ FROM drug_exposure de
434
+ WHERE NOT EXISTS (
435
+ SELECT 1 FROM observation_period op
436
+ WHERE op.person_id = de.person_id
437
+ AND de.drug_exposure_start_date BETWEEN
438
+ op.observation_period_start_date
439
+ AND op.observation_period_end_date
440
+ );
441
+ ```
442
+
443
+ ---
444
+
445
+ ## 6. Hệ sinh thái công cụ OHDSI
446
+
447
+ | Công cụ | Vai trò |
448
+ |---------|---------|
449
+ | **WhiteRabbit** | Scan dữ liệu nguồn |
450
+ | **RabbitInAHat** | Thiết kế ETL mapping |
451
+ | **Usagi** | Map mã nguồn → Standard Concept |
452
+ | **Athena** | Tải/tìm kiếm Vocabulary |
453
+ | **ATLAS** | Tạo cohort, phân tích, characterization |
454
+ | **WebAPI** | Backend API cho ATLAS |
455
+ | **Achilles** | Database profiling & DQD |
456
+ | **HADES** | R packages cho nghiên cứu (PLE, PLP) |
457
+ | **DataQualityDashboard** | Kiểm tra chất lượng dữ liệu |
458
+
459
+ ---
460
+
461
+ ## 7. Lộ trình tiếp theo
462
+
463
+ ```
464
+ Bạn đã hoàn thành ✅
465
+ ──────────────────────────────────
466
+ OMOP CDM 5.4 — 37+ bảng, 7 nhóm
467
+ ETL concepts, Vocabulary system
468
+ VN-specific mapping patterns
469
+
470
+ Bước tiếp theo 📘
471
+ ──────────────────────────────────
472
+ 1. Thực hành ETL
473
+ → Dùng WhiteRabbit + RabbitInAHat
474
+ → Chuyển 1 bộ dữ liệu nhỏ sang OMOP
475
+
476
+ 2. ATLAS & Cohort Building
477
+ → Cài ATLAS + WebAPI
478
+ → Tạo cohort definitions UI
479
+
480
+ 3. Achilles + DQD
481
+ → Chạy database profiling
482
+ → Kiểm tra chất lượng dữ liệu
483
+
484
+ 4. Nghiên cứu với HADES
485
+ → Population Level Estimation
486
+ → Patient Level Prediction
487
+ → Characterization
488
+
489
+ 5. Tham gia cộng đồng OHDSI
490
+ → forums.ohdsi.org
491
+ → OHDSI Symposium hàng năm
492
+ → Study-a-thon
493
+ ```
494
+
495
+ ---
496
+
497
+ ## Tổng kết
498
+
499
+ 1. **CDM_SOURCE**: metadata về nguồn dữ liệu, phiên bản CDM & Vocabulary
500
+ 2. **METADATA**: bảng key-value lưu thông tin bổ sung (ETL tool, coverage...)
501
+ 3. **COHORT + COHORT_DEFINITION**: quản lý nhóm nghiên cứu, nền tảng cho ATLAS
502
+ 4. **OMOP CDM 5.4** gồm **37+ bảng** trong **7 nhóm** — tất cả xoay quanh PERSON
503
+ 5. **CDM 5.4 mới**: EPISODE/EPISODE_EVENT, polymorphic FK, procedure_end_date
504
+
505
+ Chúc mừng bạn đã hoàn thành series **OMOP CDM 5.4 cho Người mới**! Từ đây bạn đã có nền tảng vững chắc để bắt tay vào ETL dữ liệu y tế Việt Nam theo chuẩn quốc tế.
506
+
507
+ ---
508
+
509
+ ## Tài liệu tham khảo
510
+
511
+ - [OMOP CDM 5.4 — CDM_SOURCE](https://ohdsi.github.io/CommonDataModel/cdm54.html#CDM_SOURCE)
512
+ - [OMOP CDM 5.4 — METADATA](https://ohdsi.github.io/CommonDataModel/cdm54.html#METADATA)
513
+ - [OMOP CDM 5.4 — COHORT](https://ohdsi.github.io/CommonDataModel/cdm54.html#COHORT)
514
+ - [Book of OHDSI](https://ohdsi.github.io/TheBookOfOhdsi/)
515
+ - [OHDSI Data Quality Dashboard](https://github.com/OHDSI/DataQualityDashboard)
516
+ - [OHDSI Tools](https://www.ohdsi.org/software-tools/)
517
+ - [OHDSI Forums](https://forums.ohdsi.org/)