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

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 (24) hide show
  1. package/content/blog/ai/minimax-danh-gia-chi-tiet-nen-tang-ai-full-stack-trung-quoc.md +450 -0
  2. package/content/metadata/authors/duy-tran.md +2 -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-1-omop-cdm-la-gi-tai-sao-can-chuan-hoa-du-lieu-y-te.md +339 -0
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  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-10-measurement-xet-nghiem-do-luong.md +409 -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-7-condition-occurrence-chan-doan-benh-ly.md +285 -0
  11. 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
  12. 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
  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-11-observation-su-kien-lam-sang-tong-hop.md +289 -0
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. package/content/series/architecture/omop-cdm-5-4-cho-nguoi-moi-bat-dau/index.md +385 -0
  24. package/package.json +1 -1
@@ -0,0 +1,336 @@
1
+ ---
2
+ id: 019f1a00-a115-7b01-e001-omopcdm54015
3
+ title: "Bài 15: CONCEPT_RELATIONSHIP & CONCEPT_ANCESTOR"
4
+ slug: bai-15-concept-relationship-concept-ancestor
5
+ description: >-
6
+ Mối quan hệ giữa Concepts (Maps to, Is a, RxNorm has ingredient...)
7
+ và cây phân cấp Ancestor-Descendant. Bảng quan trọng nhất
8
+ cho ETL mapping và phân tích hierarchical.
9
+ duration_minutes: 60
10
+ is_free: true
11
+ video_url: null
12
+ sort_order: 15
13
+ section_title: "Phần 5: Standardized Vocabularies"
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-omop15" 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-omop15)"/>
28
+ <g>
29
+ <circle cx="680" cy="85" r="24" fill="#818cf8" opacity="0.12"/>
30
+ <circle cx="760" cy="105" r="20" fill="#818cf8" opacity="0.09"/>
31
+ <circle cx="840" cy="125" r="30" fill="#818cf8" opacity="0.06"/>
32
+ <circle cx="920" cy="150" r="18" fill="#818cf8" opacity="0.10"/>
33
+ <line x1="620" y1="155" x2="1100" y2="235" 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 15</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">CONCEPT_RELATIONSHIP</tspan>
40
+ <tspan x="60" dy="42">&amp; CONCEPT_ANCESTOR</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 5: Standardized Vocabularies</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
+ ## Giới thiệu
48
+
49
+ Nếu CONCEPT là "từ điển", thì **CONCEPT_RELATIONSHIP** là "bản đồ" kết nối các từ lại với nhau, và **CONCEPT_ANCESTOR** là "cây gia phả" thể hiện quan hệ tổ tiên-hậu duệ. Hai bảng này cực kỳ quan trọng: CONCEPT_RELATIONSHIP dùng cho ETL (mapping ICD-10 → SNOMED), CONCEPT_ANCESTOR dùng cho phân tích (tìm tất cả mã "tiểu đường" bao gồm type 1, type 2, gestational...).
50
+
51
+ ---
52
+
53
+ ## 1. CONCEPT_RELATIONSHIP
54
+
55
+ ### 1.1. Cấu trúc bảng
56
+
57
+ | Cột | Kiểu | Mô tả |
58
+ |-----|------|-------|
59
+ | `concept_id_1` | INTEGER | FK → CONCEPT (nguồn) |
60
+ | `concept_id_2` | INTEGER | FK → CONCEPT (đích) |
61
+ | `relationship_id` | VARCHAR(20) | FK → RELATIONSHIP |
62
+ | `valid_start_date` | DATE | Ngày bắt đầu |
63
+ | `valid_end_date` | DATE | Ngày hết hạn |
64
+ | `invalid_reason` | VARCHAR(1) | NULL/U/D |
65
+
66
+ ### 1.2. Relationship quan trọng nhất
67
+
68
+ | relationship_id | Ý nghĩa | Use case |
69
+ |----------------|---------|----------|
70
+ | **Maps to** | Source → Standard | ETL mapping (cốt lõi!) |
71
+ | **Mapped from** | Standard → Source | Ngược lại Maps to |
72
+ | **Is a** | Con → Cha | Phân cấp SNOMED |
73
+ | **Subsumes** | Cha → Con | Ngược lại Is a |
74
+ | **RxNorm has ingredient** | Drug → Ingredient | Tìm hoạt chất |
75
+ | **Has tradename** | Generic → Brand | Drug mapping |
76
+
77
+ ### 1.3. "Maps to" — Quan trọng nhất cho ETL
78
+
79
+ ```
80
+ ICD10CM: E11 "Type 2 diabetes mellitus"
81
+ concept_id = 45591837
82
+ standard_concept = NULL (Non-standard)
83
+
84
+ │ relationship_id = 'Maps to'
85
+
86
+ SNOMED: "Type 2 diabetes mellitus"
87
+ concept_id = 201826
88
+ standard_concept = 'S' (Standard)
89
+ ```
90
+
91
+ ```sql
92
+ -- Tìm Standard Concept từ ICD-10 code
93
+ SELECT
94
+ c1.concept_code AS source_code,
95
+ c1.concept_name AS source_name,
96
+ c1.vocabulary_id AS source_vocab,
97
+ cr.relationship_id,
98
+ c2.concept_id AS standard_concept_id,
99
+ c2.concept_name AS standard_name,
100
+ c2.vocabulary_id AS standard_vocab,
101
+ c2.domain_id
102
+ FROM concept c1
103
+ JOIN concept_relationship cr
104
+ ON c1.concept_id = cr.concept_id_1
105
+ AND cr.relationship_id = 'Maps to'
106
+ AND cr.invalid_reason IS NULL
107
+ JOIN concept c2
108
+ ON cr.concept_id_2 = c2.concept_id
109
+ AND c2.standard_concept = 'S'
110
+ AND c2.invalid_reason IS NULL
111
+ WHERE c1.concept_code = 'E11'
112
+ AND c1.vocabulary_id = 'ICD10CM';
113
+ ```
114
+
115
+ ### 1.4. "Is a" — Phân cấp SNOMED
116
+
117
+ ```
118
+ Diabetes mellitus (concept_id = 201820)
119
+ ↑ Is a
120
+ ├── Type 1 diabetes mellitus (201254)
121
+ │ ↑ Is a
122
+ │ ├── Type 1 DM without complication (435216)
123
+ │ └── Type 1 DM with ketoacidosis (443727)
124
+
125
+ ├── Type 2 diabetes mellitus (201826)
126
+ │ ↑ Is a
127
+ │ ├── Type 2 DM without complication (443732)
128
+ │ └── Type 2 DM with peripheral angiopathy (318712)
129
+
130
+ └── Gestational diabetes (4058243)
131
+ ```
132
+
133
+ ```sql
134
+ -- Tìm concept cha trực tiếp
135
+ SELECT
136
+ c_parent.concept_id,
137
+ c_parent.concept_name
138
+ FROM concept_relationship cr
139
+ JOIN concept c_parent ON cr.concept_id_2 = c_parent.concept_id
140
+ WHERE cr.concept_id_1 = 201826 -- Type 2 DM
141
+ AND cr.relationship_id = 'Is a'
142
+ AND cr.invalid_reason IS NULL;
143
+
144
+ -- Tìm concept con trực tiếp
145
+ SELECT
146
+ c_child.concept_id,
147
+ c_child.concept_name
148
+ FROM concept_relationship cr
149
+ JOIN concept c_child ON cr.concept_id_1 = c_child.concept_id
150
+ WHERE cr.concept_id_2 = 201826 -- Type 2 DM
151
+ AND cr.relationship_id = 'Is a'
152
+ AND cr.invalid_reason IS NULL;
153
+ ```
154
+
155
+ ---
156
+
157
+ ## 2. Bảng RELATIONSHIP
158
+
159
+ | Cột | Kiểu | Mô tả |
160
+ |-----|------|-------|
161
+ | `relationship_id` | VARCHAR(20) | PK |
162
+ | `relationship_name` | VARCHAR(255) | Tên quan hệ |
163
+ | `is_hierarchical` | VARCHAR(1) | 1 = phân cấp |
164
+ | `defines_ancestry` | VARCHAR(1) | 1 = tạo ancestor |
165
+ | `reverse_relationship_id` | VARCHAR(20) | Quan hệ ngược |
166
+ | `relationship_concept_id` | INTEGER | FK → concept |
167
+
168
+ ---
169
+
170
+ ## 3. CONCEPT_ANCESTOR — Cây phân cấp đầy đủ
171
+
172
+ ### 3.1. Cấu trúc bảng
173
+
174
+ | Cột | Kiểu | Mô tả |
175
+ |-----|------|-------|
176
+ | `ancestor_concept_id` | INTEGER | FK → CONCEPT (tổ tiên) |
177
+ | `descendant_concept_id` | INTEGER | FK → CONCEPT (hậu duệ) |
178
+ | `min_levels_of_separation` | INTEGER | Khoảng cách tối thiểu |
179
+ | `max_levels_of_separation` | INTEGER | Khoảng cách tối đa |
180
+
181
+ ### 3.2. So sánh CONCEPT_RELATIONSHIP vs CONCEPT_ANCESTOR
182
+
183
+ | | CONCEPT_RELATIONSHIP | CONCEPT_ANCESTOR |
184
+ |--|---------------------|-----------------|
185
+ | **Nội dung** | Quan hệ trực tiếp | Tất cả tổ tiên-hậu duệ |
186
+ | **Ví dụ** | Type 2 DM → Is a → DM | Type 2 DM → mọi ancestor |
187
+ | **Levels** | Chỉ 1 bậc | Bao gồm n bậc |
188
+ | **Dùng cho** | ETL mapping | Phân tích hierarchical |
189
+ | **Includes self** | Không | ✅ (min_level = 0) |
190
+
191
+ ### 3.3. Tại sao cần CONCEPT_ANCESTOR?
192
+
193
+ CONCEPT_RELATIONSHIP chỉ có quan hệ "1 bậc". Muốn tìm **tất cả** loại tiểu đường (type 1, type 2, gestational, neonatal...), phải duyệt cây nhiều lần. CONCEPT_ANCESTOR đã tính sẵn (pre-computed transitive closure).
194
+
195
+ ```sql
196
+ -- Tìm TẤT CẢ concept thuộc nhóm "Diabetes mellitus"
197
+ -- Bao gồm bản thân + mọi hậu duệ
198
+ SELECT
199
+ ca.descendant_concept_id,
200
+ c.concept_name,
201
+ ca.min_levels_of_separation AS levels
202
+ FROM concept_ancestor ca
203
+ JOIN concept c ON ca.descendant_concept_id = c.concept_id
204
+ WHERE ca.ancestor_concept_id = 201820 -- Diabetes mellitus
205
+ AND c.standard_concept = 'S'
206
+ ORDER BY ca.min_levels_of_separation, c.concept_name;
207
+ -- Kết quả: ~300+ concepts bao gồm mọi loại & biến chứng
208
+ ```
209
+
210
+ ### 3.4. Ứng dụng phân tích
211
+
212
+ ```sql
213
+ -- Đếm BN có BẤT KỲ loại tiểu đường nào
214
+ SELECT COUNT(DISTINCT co.person_id) AS dm_patients
215
+ FROM condition_occurrence co
216
+ WHERE co.condition_concept_id IN (
217
+ SELECT descendant_concept_id
218
+ FROM concept_ancestor
219
+ WHERE ancestor_concept_id = 201820 -- Diabetes mellitus
220
+ );
221
+
222
+ -- So sánh: KHÔNG dùng ancestor (chỉ bắt 1 loại)
223
+ SELECT COUNT(DISTINCT co.person_id) AS dm_type2_only
224
+ FROM condition_occurrence co
225
+ WHERE co.condition_concept_id = 201826; -- Chỉ Type 2 DM
226
+ -- → Bỏ sót Type 1, gestational, neonatal, with complications...!
227
+ ```
228
+
229
+ ---
230
+
231
+ ## 4. SOURCE_TO_CONCEPT_MAP — Mapping tùy chỉnh
232
+
233
+ Dùng khi vocabulary chưa có mapping (VD: mã nội bộ BV Việt Nam).
234
+
235
+ | Cột | Kiểu | Mô tả |
236
+ |-----|------|-------|
237
+ | `source_code` | VARCHAR(50) | Mã nguồn |
238
+ | `source_concept_id` | INTEGER | Concept nguồn (0 nếu chưa có) |
239
+ | `source_vocabulary_id` | VARCHAR(20) | ID vocabulary tùy chỉnh |
240
+ | `source_code_description` | VARCHAR(255) | Mô tả |
241
+ | `target_concept_id` | INTEGER | FK → Standard Concept |
242
+ | `target_vocabulary_id` | VARCHAR(20) | Vocabulary đích |
243
+ | `valid_start_date` | DATE | |
244
+ | `valid_end_date` | DATE | |
245
+ | `invalid_reason` | VARCHAR(1) | |
246
+
247
+ ```sql
248
+ -- Tạo mapping cho mã ICD-10-VN nội bộ
249
+ INSERT INTO source_to_concept_map (
250
+ source_code, source_concept_id,
251
+ source_vocabulary_id, source_code_description,
252
+ target_concept_id, target_vocabulary_id,
253
+ valid_start_date, valid_end_date
254
+ ) VALUES
255
+ ('E11', 0, 'VN_ICD10',
256
+ 'Đái tháo đường type 2',
257
+ 201826, 'SNOMED',
258
+ '2024-01-01', '2099-12-31'),
259
+ ('METFORMIN500', 0, 'VN_DRUG',
260
+ 'Metformin 500mg viên nén',
261
+ 1503328, 'RxNorm',
262
+ '2024-01-01', '2099-12-31');
263
+ ```
264
+
265
+ ---
266
+
267
+ ## 5. CONCEPT_SYNONYM — Tên đồng nghĩa
268
+
269
+ | Cột | Kiểu | Mô tả |
270
+ |-----|------|-------|
271
+ | `concept_id` | INTEGER | FK → CONCEPT |
272
+ | `concept_synonym_name` | VARCHAR(1000) | Tên đồng nghĩa |
273
+ | `language_concept_id` | INTEGER | Ngôn ngữ (4180186 = English) |
274
+
275
+ ```sql
276
+ -- Tìm concept qua tên đồng nghĩa
277
+ SELECT DISTINCT c.concept_id, c.concept_name
278
+ FROM concept_synonym cs
279
+ JOIN concept c ON cs.concept_id = c.concept_id
280
+ WHERE LOWER(cs.concept_synonym_name) LIKE '%heart attack%'
281
+ AND c.standard_concept = 'S';
282
+ -- Tìm được: Acute myocardial infarction
283
+ ```
284
+
285
+ ---
286
+
287
+ ## 6. Quy trình ETL Mapping hoàn chỉnh
288
+
289
+ ```
290
+ Bước 1: Lấy mã nguồn
291
+ HIS: ma_benh = 'E11.65'
292
+
293
+ Bước 2: Tìm Source Concept
294
+ │ SELECT * FROM concept
295
+ │ WHERE concept_code = 'E11.65'
296
+ │ AND vocabulary_id = 'ICD10CM'
297
+
298
+ Source: concept_id = 45591837
299
+
300
+ Bước 3: Tìm Maps to
301
+ │ SELECT * FROM concept_relationship
302
+ │ WHERE concept_id_1 = 45591837
303
+ │ AND relationship_id = 'Maps to'
304
+
305
+ Standard: concept_id = 201826
306
+ domain_id = 'Condition'
307
+
308
+ Bước 4: Domain routing
309
+ │ domain_id = 'Condition'
310
+
311
+ Lưu vào: CONDITION_OCCURRENCE
312
+ condition_concept_id = 201826
313
+ condition_source_concept_id = 45591837
314
+ condition_source_value = 'E11.65'
315
+ ```
316
+
317
+ ---
318
+
319
+ ## Tổng kết
320
+
321
+ 1. **CONCEPT_RELATIONSHIP**: quan hệ trực tiếp giữa 2 concepts
322
+ 2. **"Maps to"** = quan hệ quan trọng nhất cho ETL (Source → Standard)
323
+ 3. **"Is a"** = phân cấp SNOMED (con → cha)
324
+ 4. **CONCEPT_ANCESTOR**: pre-computed tất cả ancestor/descendant
325
+ 5. **SOURCE_TO_CONCEPT_MAP**: mapping tùy chỉnh cho mã nội bộ
326
+ 6. Luôn dùng CONCEPT_ANCESTOR khi phân tích hierarchical
327
+
328
+ **Bài tiếp theo:** DRUG_STRENGTH & các bảng Vocabulary còn lại.
329
+
330
+ ---
331
+
332
+ ## Tài liệu tham khảo
333
+
334
+ - [OMOP CDM 5.4 — CONCEPT_RELATIONSHIP](https://ohdsi.github.io/CommonDataModel/cdm54.html#CONCEPT_RELATIONSHIP)
335
+ - [OMOP CDM 5.4 — CONCEPT_ANCESTOR](https://ohdsi.github.io/CommonDataModel/cdm54.html#CONCEPT_ANCESTOR)
336
+ - [OMOP CDM 5.4 — SOURCE_TO_CONCEPT_MAP](https://ohdsi.github.io/CommonDataModel/cdm54.html#SOURCE_TO_CONCEPT_MAP)
@@ -0,0 +1,295 @@
1
+ ---
2
+ id: 019f1a00-a116-7b01-e001-omopcdm54016
3
+ title: "Bài 16: DRUG_STRENGTH & Các bảng Vocabulary còn lại"
4
+ slug: bai-16-drug-strength-cac-bang-vocabulary-con-lai
5
+ description: >-
6
+ DRUG_STRENGTH cho thông tin liều lượng thuốc,
7
+ CONCEPT_SYNONYM, bảng RELATIONSHIP, và tổng hợp
8
+ toàn bộ 12 bảng Standardized Vocabularies.
9
+ duration_minutes: 50
10
+ is_free: true
11
+ video_url: null
12
+ sort_order: 16
13
+ section_title: "Phần 5: Standardized Vocabularies"
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-omop16" 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-omop16)"/>
28
+ <g>
29
+ <circle cx="700" cy="90" r="22" fill="#818cf8" opacity="0.12"/>
30
+ <circle cx="790" cy="110" r="26" fill="#818cf8" opacity="0.08"/>
31
+ <circle cx="870" cy="140" r="20" fill="#818cf8" opacity="0.07"/>
32
+ <line x1="640" y1="160" x2="1100" y2="240" stroke="#818cf8" stroke-width="0.5" opacity="0.1"/>
33
+ </g>
34
+ <rect x="60" y="50" width="4" height="60" rx="2" fill="#818cf8"/>
35
+ <rect x="80" y="50" width="130" height="28" rx="14" fill="#818cf8" opacity="0.15"/>
36
+ <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 16</text>
37
+ <text x="60" y="140" font-family="system-ui,-apple-system,sans-serif" font-size="34" font-weight="700" fill="#f1f5f9">
38
+ <tspan x="60" dy="0">DRUG_STRENGTH &amp; Các bảng</tspan>
39
+ <tspan x="60" dy="42">Vocabulary còn lại</tspan>
40
+ </text>
41
+ <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>
42
+ <text x="60" y="268" font-family="system-ui,-apple-system,sans-serif" font-size="13" fill="#64748b" opacity="0.6">Phần 5: Standardized Vocabularies</text>
43
+ <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>
44
+ </svg>
45
+
46
+ ## Giới thiệu
47
+
48
+ Bài cuối của phần Vocabulary cover bảng **DRUG_STRENGTH** (thông tin liều lượng chiết xuất từ RxNorm) và tổng hợp toàn bộ 12 bảng trong nhóm Standardized Vocabularies. Sau bài này bạn sẽ có bức tranh hoàn chỉnh về hệ thống từ điển OMOP.
49
+
50
+ ---
51
+
52
+ ## 1. DRUG_STRENGTH — Liều lượng thuốc
53
+
54
+ ### 1.1. Cấu trúc bảng
55
+
56
+ | Cột | Kiểu | Mô tả |
57
+ |-----|------|-------|
58
+ | `drug_concept_id` | INTEGER | FK → CONCEPT (thuốc) |
59
+ | `ingredient_concept_id` | INTEGER | FK → CONCEPT (hoạt chất) |
60
+ | `amount_value` | FLOAT | Hàm lượng (viên nén, capsule) |
61
+ | `amount_unit_concept_id` | INTEGER | Đơn vị (mg, g, IU) |
62
+ | `numerator_value` | FLOAT | Tử số (dung dịch) |
63
+ | `numerator_unit_concept_id` | INTEGER | Đơn vị tử số |
64
+ | `denominator_value` | FLOAT | Mẫu số |
65
+ | `denominator_unit_concept_id` | INTEGER | Đơn vị mẫu số |
66
+ | `box_size` | INTEGER | Số viên/hộp |
67
+ | `valid_start_date` | DATE | |
68
+ | `valid_end_date` | DATE | |
69
+ | `invalid_reason` | VARCHAR(1) | |
70
+
71
+ ### 1.2. Hai loại biểu diễn liều
72
+
73
+ **Loại 1: Solid (viên nén, capsule) → amount_value**
74
+
75
+ ```sql
76
+ -- Metformin 500mg Oral Tablet
77
+ SELECT
78
+ c_drug.concept_name AS drug_name,
79
+ c_ing.concept_name AS ingredient,
80
+ ds.amount_value,
81
+ c_unit.concept_name AS unit
82
+ FROM drug_strength ds
83
+ JOIN concept c_drug ON ds.drug_concept_id = c_drug.concept_id
84
+ JOIN concept c_ing ON ds.ingredient_concept_id = c_ing.concept_id
85
+ LEFT JOIN concept c_unit ON ds.amount_unit_concept_id = c_unit.concept_id
86
+ WHERE ds.drug_concept_id = 1503328;
87
+ -- Kết quả: Metformin | 500 | milligram
88
+ ```
89
+
90
+ **Loại 2: Liquid (dung dịch, tiêm) → numerator/denominator**
91
+
92
+ ```sql
93
+ -- Amoxicillin 250mg/5mL Oral Suspension
94
+ SELECT
95
+ c_drug.concept_name,
96
+ ds.numerator_value,
97
+ c_num.concept_name AS num_unit,
98
+ ds.denominator_value,
99
+ c_den.concept_name AS den_unit
100
+ FROM drug_strength ds
101
+ JOIN concept c_drug ON ds.drug_concept_id = c_drug.concept_id
102
+ LEFT JOIN concept c_num ON ds.numerator_unit_concept_id = c_num.concept_id
103
+ LEFT JOIN concept c_den ON ds.denominator_unit_concept_id = c_den.concept_id
104
+ WHERE ds.drug_concept_id = 19077795;
105
+ -- Kết quả: 250 mg / 5 mL
106
+ ```
107
+
108
+ ### 1.3. Ứng dụng: Tính liều thực tế
109
+
110
+ ```sql
111
+ -- Tính tổng mg Metformin BN đã dùng
112
+ SELECT
113
+ de.person_id,
114
+ SUM(
115
+ de.quantity *
116
+ COALESCE(ds.amount_value, ds.numerator_value)
117
+ ) AS total_mg,
118
+ SUM(de.days_supply) AS total_days
119
+ FROM drug_exposure de
120
+ JOIN drug_strength ds
121
+ ON de.drug_concept_id = ds.drug_concept_id
122
+ WHERE ds.ingredient_concept_id = 1503297 -- Metformin ingredient
123
+ AND de.person_id = 100001
124
+ GROUP BY de.person_id;
125
+ ```
126
+
127
+ ### 1.4. Tìm tất cả formulations của 1 hoạt chất
128
+
129
+ ```sql
130
+ -- Tất cả dạng bào chế chứa Metformin
131
+ SELECT DISTINCT
132
+ c_drug.concept_id,
133
+ c_drug.concept_name,
134
+ c_drug.concept_class_id,
135
+ ds.amount_value,
136
+ c_unit.concept_name AS unit
137
+ FROM drug_strength ds
138
+ JOIN concept c_drug ON ds.drug_concept_id = c_drug.concept_id
139
+ JOIN concept c_unit ON ds.amount_unit_concept_id = c_unit.concept_id
140
+ WHERE ds.ingredient_concept_id = 1503297 -- Metformin
141
+ AND c_drug.standard_concept = 'S'
142
+ ORDER BY c_drug.concept_class_id, ds.amount_value;
143
+ ```
144
+
145
+ ---
146
+
147
+ ## 2. Tổng hợp 12 bảng Standardized Vocabularies
148
+
149
+ | # | Bảng | Records (~) | Vai trò |
150
+ |---|------|------------|---------|
151
+ | 1 | **CONCEPT** | ~10M | Từ điển tất cả khái niệm y tế |
152
+ | 2 | **VOCABULARY** | ~70 | Danh sách nguồn vocabulary |
153
+ | 3 | **DOMAIN** | ~50 | Danh sách domain (Condition, Drug...) |
154
+ | 4 | **CONCEPT_CLASS** | ~400 | Phân loại trong vocabulary |
155
+ | 5 | **CONCEPT_RELATIONSHIP** | ~60M | Quan hệ giữa concepts |
156
+ | 6 | **RELATIONSHIP** | ~600 | Định nghĩa loại quan hệ |
157
+ | 7 | **CONCEPT_SYNONYM** | ~10M | Tên đồng nghĩa |
158
+ | 8 | **CONCEPT_ANCESTOR** | ~80M | Phân cấp pre-computed |
159
+ | 9 | **SOURCE_TO_CONCEPT_MAP** | Custom | Mapping tùy chỉnh |
160
+ | 10 | **DRUG_STRENGTH** | ~1.5M | Liều lượng thuốc |
161
+ | 11 | **COHORT_DEFINITION** | Custom | Định nghĩa cohort |
162
+ | 12 | **ATTRIBUTE_DEFINITION** | Custom | Định nghĩa attribute (ít dùng) |
163
+
164
+ ---
165
+
166
+ ## 3. COHORT_DEFINITION
167
+
168
+ | Cột | Kiểu | Mô tả |
169
+ |-----|------|-------|
170
+ | `cohort_definition_id` | INTEGER | PK |
171
+ | `cohort_definition_name` | VARCHAR(255) | Tên cohort |
172
+ | `cohort_definition_description` | CLOB | Mô tả chi tiết |
173
+ | `definition_type_concept_id` | INTEGER | Loại definition |
174
+ | `cohort_definition_syntax` | CLOB | JSON/SQL query tạo cohort |
175
+ | `subject_concept_id` | INTEGER | Đối tượng (thường = person) |
176
+ | `cohort_initiation_date` | DATE | Ngày tạo |
177
+
178
+ Dùng kết hợp với bảng **COHORT** (trong Derived Elements) — Bài 20 sẽ chi tiết.
179
+
180
+ ---
181
+
182
+ ## 4. ER Diagram — Vocabularies
183
+
184
+ ```
185
+ ┌──────────┐ ┌──────────────────┐
186
+ │ VOCABULARY│────→│ CONCEPT │←─── DOMAIN
187
+ └──────────┘ │ │←─── CONCEPT_CLASS
188
+ │ concept_id (PK) │
189
+ │ concept_name │
190
+ │ domain_id │
191
+ │ vocabulary_id │
192
+ │ concept_class_id │
193
+ │ standard_concept │
194
+ └─────────┬────────┘
195
+
196
+ ┌──────────────┼──────────────┐
197
+ │ │ │
198
+ ↓ ↓ ↓
199
+ ┌────────────────┐ ┌──────────────┐ ┌──────────────┐
200
+ │CONCEPT_ │ │CONCEPT_ │ │CONCEPT_ │
201
+ │RELATIONSHIP │ │ANCESTOR │ │SYNONYM │
202
+ │ │ │ │ │ │
203
+ │concept_id_1 → │ │ancestor → │ │concept_id → │
204
+ │concept_id_2 → │ │descendant → │ │synonym_name │
205
+ │relationship_id │ │min_levels │ │language │
206
+ └────────────────┘ │max_levels │ └──────────────┘
207
+ │ └──────────────┘
208
+
209
+ ┌──────────────┐
210
+ │ RELATIONSHIP │ ┌──────────────┐
211
+ └──────────────┘ │DRUG_STRENGTH │
212
+ │ │
213
+ │drug_concept→ │
214
+ │ingredient → │
215
+ │amount_value │
216
+ │numerator │
217
+ │denominator │
218
+ └──────────────┘
219
+ ┌─────────────────────┐
220
+ │SOURCE_TO_CONCEPT_MAP│ (custom mapping)
221
+ │source_code │
222
+ │target_concept_id → │
223
+ └─────────────────────┘
224
+ ```
225
+
226
+ ---
227
+
228
+ ## 5. Best practices quản lý Vocabulary
229
+
230
+ ### 5.1. Cập nhật Vocabulary
231
+
232
+ ```
233
+ 1. Download từ athena.ohdsi.org (CPT4 cần license)
234
+ 2. Load vào schema vocabulary riêng
235
+ 3. Chạy script consistency check
236
+ 4. KHÔNG tự modify bảng CONCEPT / CONCEPT_RELATIONSHIP
237
+ 5. Dùng SOURCE_TO_CONCEPT_MAP cho mã tùy chỉnh
238
+ ```
239
+
240
+ ### 5.2. Kiểm tra chất lượng Vocabulary
241
+
242
+ ```sql
243
+ -- Kiểm tra concepts hết hạn đang được dùng
244
+ SELECT
245
+ 'condition_occurrence' AS source_table,
246
+ COUNT(*) AS invalid_concept_count
247
+ FROM condition_occurrence co
248
+ JOIN concept c ON co.condition_concept_id = c.concept_id
249
+ WHERE c.invalid_reason IS NOT NULL
250
+
251
+ UNION ALL
252
+
253
+ SELECT 'drug_exposure', COUNT(*)
254
+ FROM drug_exposure de
255
+ JOIN concept c ON de.drug_concept_id = c.concept_id
256
+ WHERE c.invalid_reason IS NOT NULL;
257
+
258
+ -- Kiểm tra mapping completeness
259
+ SELECT
260
+ c.vocabulary_id,
261
+ COUNT(*) AS total_concepts,
262
+ SUM(CASE WHEN cr.concept_id_2 IS NOT NULL THEN 1 ELSE 0 END) AS mapped,
263
+ ROUND(
264
+ SUM(CASE WHEN cr.concept_id_2 IS NOT NULL THEN 1 ELSE 0 END) * 100.0
265
+ / COUNT(*), 1
266
+ ) AS mapped_pct
267
+ FROM concept c
268
+ LEFT JOIN concept_relationship cr
269
+ ON c.concept_id = cr.concept_id_1
270
+ AND cr.relationship_id = 'Maps to'
271
+ AND cr.invalid_reason IS NULL
272
+ WHERE c.vocabulary_id IN ('ICD10CM', 'ICD10', 'CPT4')
273
+ AND c.invalid_reason IS NULL
274
+ GROUP BY c.vocabulary_id;
275
+ ```
276
+
277
+ ---
278
+
279
+ ## Tổng kết
280
+
281
+ 1. **DRUG_STRENGTH**: liều thuốc solid (amount) và liquid (numerator/denominator)
282
+ 2. **12 bảng Vocabulary** hợp thành hệ thống quản lý ~10 triệu khái niệm y tế
283
+ 3. **SOURCE_TO_CONCEPT_MAP** cho mã nội bộ VN → Standard Concept
284
+ 4. Vocabulary cần cập nhật định kỳ từ Athena, KHÔNG tự sửa
285
+ 5. DRUG_STRENGTH kết hợp DRUG_EXPOSURE để tính liều thực tế
286
+
287
+ **Bài tiếp theo:** Phần 6 — LOCATION, CARE_SITE, PROVIDER và nhóm Health System.
288
+
289
+ ---
290
+
291
+ ## Tài liệu tham khảo
292
+
293
+ - [OMOP CDM 5.4 — DRUG_STRENGTH](https://ohdsi.github.io/CommonDataModel/cdm54.html#DRUG_STRENGTH)
294
+ - [OMOP CDM 5.4 — Full table list](https://ohdsi.github.io/CommonDataModel/cdm54.html)
295
+ - [Athena Vocabulary Download](https://athena.ohdsi.org/vocabulary/list)