@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

<http://fhir.hl7.org.vn/core/ValueSet/vn-imaging-report-code-vs> a fhir:ValueSet ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:Resource.id [ fhir:value "vn-imaging-report-code-vs"] ;
  fhir:Resource.language [ fhir:value "vi"] ;
  fhir:DomainResource.text [
     fhir:Narrative.status [ fhir:value "generated" ] ;
     fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: ValueSet vn-imaging-report-code-vs</b></p><a name=\"vn-imaging-report-code-vs\"> </a><a name=\"hcvn-imaging-report-code-vs\"> </a><p>This value set includes codes based on the following rules:</p><ul><li>Include codes from<a href=\"http://loinc.org\"><code>http://loinc.org</code></a><span title=\"Version is not explicitly stated. No matching Code System found\"> version Not Stated (use latest from terminology server)</span> where CLASS  matches (by regex) ^(RAD|OB[.]US|CARD[.]US|GEN[.]US|EYE[.]US)$ and STATUS  in ACTIVE,TRIAL</li><li>Include codes from<a href=\"CodeSystem-vn-cls-cs.html\"><code>http://fhir.hl7.org.vn/core/CodeSystem/vn-cls-cs</code></a><span title=\"Version is not explicitly stated, which means it is fixed to the version provided in this specification\"> version ?0.10.0</span> where appendix  = 05</li></ul></div>"
  ] ;
  fhir:DomainResource.extension [
     fhir:index -1 ;
     fhir:Extension.url [ fhir:value "http://fhir.hl7.org.vn/core/StructureDefinition/vn-ext-legal-basis" ] ;
     fhir:Extension.valueCoding [
       fhir:Coding.system [ fhir:value "http://fhir.hl7.org.vn/core/CodeSystem/vn-legal-document-ref-cs" ] ;
       fhir:Coding.code [ fhir:value "QD-1227-2025" ]
     ]
  ] ;
  fhir:ValueSet.url [ fhir:value "http://fhir.hl7.org.vn/core/ValueSet/vn-imaging-report-code-vs"] ;
  fhir:ValueSet.identifier [
     fhir:index -1 ;
     fhir:Identifier.system [ fhir:value "urn:ietf:rfc:3986" ] ;
     fhir:Identifier.value [ fhir:value "urn:oid:2.25.161089673617632664299011809196868855799.48.73" ]
  ] ;
  fhir:ValueSet.version [ fhir:value "0.10.0"] ;
  fhir:ValueSet.name [ fhir:value "VNImagingReportCodeVS"] ;
  fhir:ValueSet.title [ fhir:value "Mã báo cáo chẩn đoán hình ảnh — VN Imaging Report Code ValueSet"] ;
  fhir:ValueSet.status [ fhir:value "draft"] ;
  fhir:ValueSet.experimental [ fhir:value "false"^^xsd:boolean] ;
  fhir:ValueSet.date [ fhir:value "2026-08-12"^^xsd:date] ;
  fhir:ValueSet.publisher [ fhir:value "Omi HealthTech / VN Core FHIR Community Initiative"] ;
  fhir:ValueSet.contact [
     fhir:index -1 ;
     fhir:ContactDetail.name [ fhir:value "Omi HealthTech / VN Core FHIR Community Initiative" ] ;
     fhir:ContactDetail.telecom [
       fhir:index -1 ;
       fhir:ContactPoint.system [ fhir:value "url" ] ;
       fhir:ContactPoint.value [ fhir:value "https://hl7.org.vn" ]
     ], [
       fhir:index -1 ;
       fhir:ContactPoint.system [ fhir:value "email" ] ;
       fhir:ContactPoint.value [ fhir:value "info@hl7.org.vn" ]
     ]
  ], [
     fhir:index -1 ;
     fhir:ContactDetail.name [ fhir:value "Omi HealthTech (OmiGroup)" ] ;
     fhir:ContactDetail.telecom [
       fhir:index -1 ;
       fhir:ContactPoint.system [ fhir:value "url" ] ;
       fhir:ContactPoint.value [ fhir:value "https://omihealthtech.vn" ]
     ], [
       fhir:index -1 ;
       fhir:ContactPoint.system [ fhir:value "url" ] ;
       fhir:ContactPoint.value [ fhir:value "https://omigroup.vn" ]
     ], [
       fhir:index -1 ;
       fhir:ContactPoint.system [ fhir:value "email" ] ;
       fhir:ContactPoint.value [ fhir:value "info@hl7.org.vn" ]
     ]
  ] ;
  fhir:ValueSet.description [ fhir:value "Tập giá trị cho `DiagnosticReport.code` của báo cáo CHẨN ĐOÁN HÌNH ẢNH:\n\n- **LOINC** (`http://loinc.org`) — mã báo cáo hình ảnh quốc tế (vd 36643-5 XR Chest 2 Views).\n- **Miền chẩn đoán hình ảnh của danh mục CLS** (`vn-cls-cs` Phụ lục 05, QĐ 1227/QĐ-BYT — 1.240 chỉ số).\n\nTrước 0.10.0 child profile Imaging chỉ fix `category` mà kế thừa binding toàn danh mục\n`vn-cls-vs` của base — báo cáo hình ảnh nhận được cả mã xét nghiệm/giải phẫu bệnh, và example\nLOINC nằm ngoài declared VS (CORE-P1-03/T-03, review 97). Từ 0.10.0 phần LOINC ĐƯỢC lọc theo miền ngay ở tầng\ncompose bằng property chuẩn của chính LOINC: `CLASS regex ^(RAD|OB[.]US|CARD[.]US|GEN[.]US|EYE[.]US)$`\ncộng `STATUS in ACTIVE, TRIAL` (loại mã đã khai tử/không khuyến nghị). Hai tầng canh: filter VS khi\ncó máy chủ thuật ngữ, và graph gate `[LOINC-DOMAIN]` đối chiếu offline cho corpus ví dụ bằng\nbảng thuộc tính LOINC thu từ nguồn Bộ Y tế.\n\n**ĐÃ ĐO LẠI 03/09/2026: nhánh LOINC nay expand ĐÚNG.** `$expand` trên máy chủ thuật ngữ nội bộ trả\n**9.712** mã — **8.475** từ `http://loinc.org` cộng 1.237 từ `vn-cls-cs`. Con số LOINC khớp chính xác\nphép đếm độc lập trên bảng thuộc tính nguồn (`data/loinc/loinc_detail.jsonl`): 8.905 mã có `CLASS`\nkhớp biểu thức, còn 8.475 sau khi áp thêm `STATUS in ACTIVE,TRIAL`. Phân bố: RAD 7.295 · CARD.US 809\n· OB.US 793 · GEN.US 5 · EYE.US 3.\n\nVì sao lần đo 30/08/2026 ra rỗng, và vì sao KHÔNG cần Part file của Regenstrief như dự kiến ban đầu:\nlúc đó máy chủ chưa được nạp property `CLASS`, nên biểu thức không có gì để so. Ngày 02/09/2026\n`scripts/txserver-load.py` bổ sung `CLASS` (kiểu `string`, lấy từ trường `loinc_class`) và\n`ORDER_OBS` vào lô nạp LOINC; cổng txgw tự đánh giá `regex`/`in` cho hai property này vì tx.fhir.org\nkhông hiểu chúng. Chẩn đoán cũ — LOINC mô hình hoá CLASS như Coding nên phải ánh xạ sang `LP…` —\nđúng với máy chủ dùng bản LOINC gốc của Regenstrief, nhưng KHÔNG áp dụng cho bản do Bộ Y tế công bố:\nbản đó mang tên lớp ngắn ở dạng chuỗi, và khi nạp đúng kiểu thì filter khớp thẳng.\n\nĐã kiểm txgw dùng **so khớp toàn chuỗi**, không phải so khớp một phần: nếu dùng `search` thay\n`fullmatch`, cùng biểu thức sẽ khớp 9.096 mã thay vì 8.905 — số trả về chứng minh nó khớp chặt.\n\n**Hệ quả cho bên triển khai.** Hàng rào miền LOINC nay có HAI tầng đều hiệu lực: filter tập giá trị\nkhi có máy chủ thuật ngữ, và graph gate `[LOINC-DOMAIN]` đối chiếu offline cho bản dựng không có máy\nchủ. `$expand` của tập giá trị này dùng được để liệt kê mã hình ảnh hợp lệ."] ;
  fhir:ValueSet.jurisdiction [
     fhir:index -1 ;
     fhir:CodeableConcept.coding [
       fhir:index -1 ;
       fhir:Coding.system [ fhir:value "urn:iso:std:iso:3166" ] ;
       fhir:Coding.code [ fhir:value "VN" ] ;
       fhir:Coding.display [ fhir:value "Viet Nam" ]
     ]
  ] ;
  fhir:ValueSet.purpose [ fhir:value "Binding theo miền cho VNCoreDiagnosticReportImaging.code — báo cáo hình ảnh không mang mã xét nghiệm/giải phẫu bệnh của danh mục CLS."] ;
  fhir:ValueSet.copyright [ fhir:value "Bộ Y tế Việt Nam — QĐ 1227/QĐ-BYT ngày 11/4/2025. LOINC là tài sản của Regenstrief Institute, Inc., dùng theo LOINC License."] ;
  fhir:ValueSet.compose [
     fhir:ValueSet.compose.include [
       fhir:index -1 ;
       fhir:ValueSet.compose.include.system [ fhir:value "http://loinc.org" ] ;
       fhir:ValueSet.compose.include.filter [
         fhir:index -1 ;
         fhir:ValueSet.compose.include.filter.property [ fhir:value "CLASS" ] ;
         fhir:ValueSet.compose.include.filter.op [ fhir:value "regex" ] ;
         fhir:ValueSet.compose.include.filter.value [ fhir:value "^(RAD|OB[.]US|CARD[.]US|GEN[.]US|EYE[.]US)$" ]
       ], [
         fhir:index -1 ;
         fhir:ValueSet.compose.include.filter.property [ fhir:value "STATUS" ] ;
         fhir:ValueSet.compose.include.filter.op [ fhir:value "in" ] ;
         fhir:ValueSet.compose.include.filter.value [ fhir:value "ACTIVE,TRIAL" ]
       ]
     ], [
       fhir:index -1 ;
       fhir:ValueSet.compose.include.system [ fhir:value "http://fhir.hl7.org.vn/core/CodeSystem/vn-cls-cs" ] ;
       fhir:ValueSet.compose.include.filter [
         fhir:index -1 ;
         fhir:ValueSet.compose.include.filter.property [ fhir:value "appendix" ] ;
         fhir:ValueSet.compose.include.filter.op [ fhir:value "=" ] ;
         fhir:ValueSet.compose.include.filter.value [ fhir:value "05" ]
       ]
     ]
  ] .

# - ontology header ------------------------------------------------------------

<http://fhir.hl7.org.vn/core/ValueSet/vn-imaging-report-code-vs.ttl> a owl:Ontology ;
  owl:imports fhir:fhir.ttl .

# -------------------------------------------------------------------------------------

