190 likes | 329 Views
XML: Basics. Paul V. Biron Permanente Clinical Systems Development Kaiser Permanente, Southern California Paul.V.Biron@kp.org. Outline. HTML, SGML and XML The World Wide Web Consortium (W3C) HTML as an application of SGML XML: define your own tag set XML vs. "standard" HL7 encoding
E N D
XML: Basics Paul V. Biron Permanente Clinical Systems Development Kaiser Permanente, Southern California Paul.V.Biron@kp.org
Outline • HTML, SGML and XML • The World Wide Web Consortium (W3C) • HTML as an application of SGML • XML: define your own tag set • XML vs. "standard" HL7 encoding • Document Type Definitions (DTDs) • Well-formed vs. valid • Elements • Attributes • Entities
Outline (cont.) • The "XML Family" of Standards • XSL • XLL • Namespaces • Next generation schema definition languge • Benefits to be gained • Representational expansion • Wide availability of toolsets • Wide availability of trained personnel
HTML, SGML, XML • HTML: HyperText Markup Language • “Recommendation” of the World Wide Web Consortium (W3C) • an application of SGML (the “HTML DTD”) • SGML: Standard Generalized Markup Language • ISO 8879:1986(E) • XML is a proper subset of SGML • XML and SGML are “metalanguages” • Language for defining other languages • Recommendation of the W3C • Formally Adopted on 10-February-1998
HTML is SGML (although not XML) • Radiology Report - Chest X-Ray • Patient Information • Name: Henry Levin, the 7th • MRN: 123456789 • DOB: May 13, 1923 • Clinical Data • History of smoking for 40 years. • Procedure • Chest X-Ray • Findings • Comparison is made with a chest x-ray ... • Impressions • RLL nodule, suggestive of malignancy. Compared with a prior CXR from 6 months ago, nodule size has increased. • Recommendations • I notified the ordering physician of this finding by phone. <h2>Patient Information</h2> <ul> <li><b>Name:</b>Henry Levin, the 7th</li> <li><b>MRN:</b> 123456789</li> <li><b>DOB:</b> May 13, 1923</li> </ul> <h2>Clinical Data</h2> <p>History of smoking for 40 years.</p> <h2>Procedure</h2> <p>Chest X-ray</p> <h2>Findings</h2> <p>Comparison is made with a chest-x-ray … </p> <h2>Impressions</h2> <p>RLL nodule, suggestive of malignancy. Compared with a prior CXR from 6 months ago, nodule size has increased.</p> <h2>Recommendations</h2> <p>I notified the ordering physician of this finding by phone.</p>
XML - Define your own tags • Radiology Report - Chest X-Ray • Patient Information • Name: Henry Levin, the 7th • MRN: 123456789 • DOB: May 13, 1923 • Clinical Data • History of smoking for 40 years. • Procedure • Chest X-Ray • Findings • Comparison is made with a chest x-ray ... • Impressions • RLL nodule, suggestive of malignancy. Compared with a prior CXR from 6 months ago, nodule size has increased. • Recommendations • I notified the ordering physician of this finding by phone. <RadiologyReport> <PatientInfo> <Name>Henry Levin, the 7th</Name> <MRN>123456789</MRN> <DOB>May 13, 1923</DOB> </PatientInfo> <ClinicalData>History of smoking for 40 years.</ClinicalData> <Procedure>Chest X-ray</Procedure> <Findings> Comparison is made with a chest-x-ray … </Findings> <Impressions> RLL nodule, suggestive of malignancy. Compared with a prior CXR from 6 months ago, nodule size has increased. </Impressions> <Recommendations> I notified the ordering physician of this finding by phone. </Recommendations> </RadiologyReports>
XML - Define your tag arrangement <!ELEMENT RadiologyReport (PatientInfo, ClinicalData, Procedure, Findings, Impressions, Recommendations)> <!ELEMENT PatientInfo (Name, MRN, DOB)> <!ELEMENT Name (#PCDATA)> <!ELEMENT MRN (#PCDATA)> <!ELEMENT DOB (#PCDATA)> <!ELEMENT ClinicalData (#PCDATA)> <!ELEMENT Procedure (#PCDATA)> <!ELEMENT Findings (#PCDATA)> <!ELEMENT Impressions (#PCDATA)> <!ELEMENT Recommendations (#PCDATA)> <RadiologyReport> <PatientInfo> <Name>Henry Levin, the 7th</Name> <MRN>123456789</MRN> <DOB>May 13, 1923</DOB> </PatientInfo> <ClinicalData>History of smoking for 40 years. </ClinicalData> <Procedure>Chest X-ray</Procedure> <Findings> Comparison is made with a chest-x-ray … </Findings> <Impressions> RLL nodule, suggestive of malignancy. Compared with a prior CXR from 6 months ago, nodule size has increased. </Impressions> <Recommendations> I notified the ordering physician of this finding by phone. </Recommendations> </RadiologyReports>
XML vs. Standard Encoding HL7 Message <RadiologyReport> <PatientInfo> <Name>Henry Levin, the 7th</Name> <MRN>123456789</MRN> <DOB>May 13, 1923</DOB> </PatientInfo> <ClinicalData>History of smoking for 40 years.</ClinicalData> <Procedure>Chest X-ray</Procedure> <Findings> Comparison is made with a chest-x-ray … </Findings> <Impressions> RLL nodule, suggestive of malignancy. Compared with a prior CXR from 6 months ago, nodule size has increased. </Impressions> <Recommendations> I notified the ordering physician of this finding by phone. </Recommendations> </RadiologyReports> MSH…<cr> PID|1||123456789||Levin^Henry^^the 7th||19230513<cr> OBR|1|||^Chest X-ray<cr> OBX|1|TX|71020&GDT||Clinical data: History of smoking for 40 years.<cr> OBX|2|TX|71020&GDT||Findings: Comparison is made with a chest-x-ray … <cr> OBX|3|CE|71020&IMP||^RLL nodule, suggestive of malignancy. Compared with a prior CXR from 6 months ago, nodule size has increased.<cr> OBX|4|CE|71020&REC||^I notified the ordering physician of this finding by phone. <cr>
XML vs. Standard Encoding <?xml version="1.0" ?> <!DOCTYPE ORU.R01 SYSTEM "hl7_v23.dtd"> <ORU.R01> <MSH>…</MSH> <PID PID.1="1"> <PID.3 CX.1="123456789"/> <PID.5 XPN.1="Levin" XPN.2="Henry" XPN.3="the 7th"/> <PID.7 TS.1="19230513"/> </PID> <OBR OBR.1="1"> <OBR.4 CE.2"Chest X-ray"/> </OBR> <OBX OBX.1="1" OBX.2="TX"> <OBX.3 CE.1="71020" SUB="GDT"/> <OBX.5 TX.1="Clinical data: History of..."/> </OBX> <OBX OBX.1="2" OBX.2="TX"> <OBX.3 CE.1="71020" SUB="GDT"/> <OBX.5 TX.1="Findings: Comparison is made…"/> </OBX> <OBX OBX.1="3" OBX.2="CE"> <OBX.3 CE.1="71020" SUB="IMP"/> <OBX.5 CE.2="RLL nodule, suggestive of ..."/> </OBX> <OBX OBX.1="4" OBX.2="CE"> <OBX.3 CE.1="71020" SUB="REC"/> <OBX.5 CE.2="I notified the ordering physician..."/> </OBX> </ORU.R01> HL7 Message MSH…<cr> PID|1||123456789||Levin^Henry^^the 7th||19230513<cr> OBR|1|||^Chest X-ray<cr> OBX|1|TX|71020&GDT||Clinical data: History of... <cr> OBX|2|TX|71020&GDT||Findings: Comparison is made … <cr> OBX|3|CE|71020&IMP||^RLL nodule, suggestive of... <cr> OBX|4|CE|71020&REC||^I notified the ordering physician... <cr>
Document Type Definitions • Document Type Definitions • also referred to as DTD’s • Provide a "schema" for a class of documents • A "schema" defines certain semantic and structural constraints, including • A set of element declarations • Documentation • Optional supporting specifications, such as style sheets • DTDs are one language for writing schemas for both SGML and XML documents • Recent proposals (e.g., Document Content Descriptors, submission to W3C) have been made
“Well-Formed” vs. “Valid” • A well-formed document must match the production labeled ‘document’ • In common usage, this often translates to: The elements, delimited by start- and end-tags, nest properly within each other • An XML document is valid if it has an associated document type declaration and if the document complies with the constraints expressed in it XML Document prolog element Misc*
Elements • Element • Only other elements may be present in the element’s content • You can control the order of these sub-elements XML Document … <!ELEMENT ORU (OBR, OBX*)> ... • <ORU> • <OBR OBR.1="1"> • <OBR.4 CE.1="80004" CE.2="ELECTROLYTES"/> • </OBR> • <OBX OBX.1="1" OBX.5="150" OBX.11="F"> • <OBX.3 CE.1="84295" CE.2="NA"/> • <OBX.6 CE.1="mmol/l"/> • </OBX> • </ORU>
Attributes String (CDATA) String (or CDATA) attributes may take any literal string as a value, including whitespace characters CDATA (character data) XML Document … <!ATTLIST OBX.3 CE.1CDATA #IMPLIED CE.2CDATA #IMPLIED CE.3CDATA #IMPLIED> ... • <ORU> • <OBR OBR.1="1"> • <OBR.4 CE.1="80004" CE.2="ELECTROLYTES"/> • </OBR> • <OBX OBX.1="1" OBX.5="150" OBX.11="F"> • <OBX.3 CE.1="84295" CE.2="NA"/> • <OBX.6 CE.1="mmol/l"/> • </OBX> • </ORU>
Entities General and Parameter Entity Definitions Parameter Entity References General Entity References XML Document prolog element
The "XML Family" of Standards • XSL: Extensible Style Language • Declarative language for "screen rendering" and transformation • Will allow a single XML file to be "rendered" in multiple formats • viewing HL7 messages in a standard web browser • W3C V1.0 "working draft" released August 18, 1998 • XLL: Extensible Link Language • Inter/Intra document linking specifications • HTML's <a href="…"> on steroids • Xlink W3C working draft released March 3, 1998 • Xpointer W3C working draft released March 3, 1998
The "XML Family" of Standards • Namespaces • Mechanism for avoiding element/attribute name collisions • W3C working draft released August 2, 1998 • To be incorporated into a future revision of the XML Specification • Next generation "schema" definition languages • DTD's on steroids • More extensive datatyping • Inheritance mechanism(s) • W3C working group recently formed • Working draft(s)/recommendation(s) at least 1 year away • "Document Content Description" W3C submission acknowledged August 10, 1998
The Benefits to be Gained • Representational expansion • Recursive (segment-less) encodings • "self-documenting" structures • Wide availability of toolsets • XML parsers and parser SDKs • Stylesheet editors and processors • Transformation (conversion) engines • Wide availability of trained personnel • XML programmers
Questions XML Document prolog element <?QUESTIONS ?>