Skip to content
Ivan William Harsono edited this page Nov 19, 2026 · 1 revision

HL7 CDA R2

Bahasa / Language: English · Bahasa Indonesia

CDA R2 is the document format that accompanies HL7 v2 messages in Indonesian hospital exchange: v2 carries the transaction, CDA carries the signed document. CDA R2 adalah format dokumen yang menyertai pesan HL7 v2 di pertukaran rumah sakit Indonesia: v2 membawa transaksi, CDA membawa dokumen yang ditandatangani.

English

Scope, stated honestly

CDA R2 is hundreds of pages of optional structure. This SDK models the part that is used in practice:

  • Header — id, code, title, effectiveTime, confidentialityCode, recordTarget/patientRole (identifiers with their root, name, sex, birth date), author, custodian.
  • Body — structuredBody sections with LOINC codes, titles, and narrative text, including nested sections.
  • Validation — the header rules that matter for exchange. An empty validate() means the document is exchangeable, not that it is clinically correct.

What it refuses to do

  • It does not rebuild the document from its own model. toXml() writes the DOM it parsed, so componentOf, participant, legalAuthenticator and vendor extensions survive a round trip. A parser that regenerates the XML deletes everything it did not understand.
  • It does not ship the HL7 schemas. They are licensed; validation here is structural, based on the rules in the specification, not an XSD run.

Reading a document

$doc = Document::parse($xml);
$doc->title();
$doc->patient()->identifier('2.16.840.1.113883.3.3157.1003.1');
$doc->authors();
$doc->section('10164-2')->title;
$doc->sectionText('10164-2');   // narrative as text, paragraphs kept
$doc->validate();               // [] when the header is complete

Writing one

$doc = Document::build([
    'id' => 'DOC-1', 'title' => 'Resume Medis',
    'custodian' => 'RS Contoh', 'author' => 'Dokter Contoh',
    'patientId' => '3171234567890001', 'patientName' => 'ANGGRAENI',
    'gender' => 'F', 'birthTime' => '19850312',
    'sections' => [['loinc' => '10164-2', 'title' => 'Riwayat', 'text' => '<paragraph>Demam.</paragraph>']],
]);

Not implemented

Signatures (ds:Signature verification), templates beyond the generic POCD_MT000040 header, nonXMLBody attachments, and CDA → FHIR mapping. The other four SDKs do not have CDA yet.

Bahasa Indonesia

Cakupan, dinyatakan jujur

CDA R2 adalah ratusan halaman struktur opsional. SDK ini memodelkan bagian yang dipakai sehari-hari:

  • Header — id, code, title, effectiveTime, confidentialityCode, recordTarget/patientRole (identifier beserta root-nya, nama, jenis kelamin, tanggal lahir), author, custodian.
  • Body — section structuredBody dengan kode LOINC, judul, dan text naratif, termasuk section bersarang.
  • Validasi — aturan header yang penting untuk pertukaran. validate() kosong berarti dokumen layak dipertukarkan, bukan berarti benar secara klinis.

Yang sengaja tidak dilakukan

  • Tidak membangun ulang dokumen dari modelnya sendiri. toXml() menulis DOM yang tadi diparsing, sehingga componentOf, participant, legalAuthenticator, dan ekstensi vendor selamat melewati round trip. Parser yang meregenerasi XML akan menghapus semua yang tidak ia pahami.
  • Tidak menyertakan skema HL7. Skemanya berlisensi; validasi di sini bersifat struktural berdasarkan aturan spesifikasi, bukan menjalankan XSD.

Membaca dokumen

$doc = Document::parse($xml);
$doc->patient()->identifier('2.16.840.1.113883.3.3157.1003.1');
$doc->sectionText('10164-2');

Menulis dokumen

$doc = Document::build([...]);   // header + sections, lihat README
echo $doc->toXml();

Yang belum ada

Tanda tangan (ds:Signature), template selain header generik POCD_MT00040, lampiran nonXMLBody, dan pemetaan CDA → FHIR. Empat SDK lain belum memiliki CDA.

Node specifics / Khusus Node

import { Document } from '@ivanwilliammd/satusehat-integration';
const doc = Document.parse(xml);
doc.sectionText('10164-2');

Parsing uses fast-xml-parser with preserveOrder, so toXml() writes back the tree it read — including structures this SDK does not model. Parsing memakai fast-xml-parser dengan preserveOrder, sehingga toXml() menulis kembali pohon yang dibaca — termasuk struktur yang tidak dimodelkan SDK ini.

See also / Lihat juga

Clone this wiki locally