540 likes | 690 Views
HL7 version 3. Data types. Scope: data type support for in-memory object processing purposes. Slide contents published under the Creative Commons / Attribute-Share Alike license Source: www.ringholm.de/download/HL7v3_implementation.zip. Agenda.
E N D
HL7 version 3 Data types Scope: data type support for in-memory object processing purposes. Slide contents published under the Creative Commons / Attribute-Share Alike license Source: www.ringholm.de/download/HL7v3_implementation.zip
Agenda • Relationship between abstract/XML/ISO data type specifications • NullFlavor • Data types with implementation aspects • CD, ED, PQ, IVL • Vocabulary aspects • Implementation experiences
Context • In-memory processing of ‘data type instances’ • Classes / methods • Guidance for development of a reusable data types library • Mostly based on ISO data types, with additional tweaks for Data Types R1 support
Data Types Architecture Slide contents published under the Creative Commons / Attribute-Share Alike license Source: www.ringholm.de/download/implementation_mechanics.ppt
Architecture Datatypes R1 Datatypes R2 Abstract Data Type Specification Abstract Data Type Specification Abstract Data Type Specification R2 ISO Data Type Specification ITS XML Data Types ITS XML Data Types R2
R2 Abstract Data Types ISO DT • HL7 v3 aspects unique to the Abstract Datatype specification (not in ISO) • Literal forms • Not all data types have literal forms • Substitution rules • Model-time data type constraints
Data Types NullFlavors Slide contents published under the Creative Commons / Attribute-Share Alike license Source: www.ringholm.de/download/implementation_mechanics.ppt
Null Flavors • Definition: • An exceptional value expressing missing information and possibly the reason why the information is missing. • attribute • nullFlavor, multiple possible values • Difficult for implementations: a value was expected (e.g. for a required attribute) – and one receives a nullFlavor. This can happen at ANY time – except if the attribute was mandatory...
Null Flavors: values ISO DT
nullFlavor != null • Types or classes that have a nullFlavor may also have other information:<CD nullFlavor=“OTH” codeSystem=“SNOMED”> <originalText>Burnt Ear</originalText></CD> • null in implementation technologies (SQL null, OCL null, pointers) mean that no extra information is found • nullFlavor is not the same as null! Slide created by Grahame Grieve; used by permission
Data Types Implementation aspects Slide contents published under the Creative Commons / Attribute-Share Alike license Source: www.ringholm.de/download/implementation_mechanics.ppt
PQ ISO DT
PQ – Attributes ISO DT Slide created by Grahame Grieve; used by permission
PQ : unity ISO DT However for some measurements that arise in healthcare, the scheme is not so obvious: 5drinks of Beer 3Acetominophentablets. UCUM does not support units of "beer", "tablets" or "scoops". UCUM provides a unit called unity for use in these cases: • The proper way to understand these measurements as 31Acetominophentablets, where 1 is the UCUM unit for unity. • The context of use will need to provide the extra qualifying information. Slide created by Grahame Grieve; used by permission
Translations ISO DT • CD, PQ, and ED all contain translations • All contain translations for different reasons • Slightly different design and implementation patterns • All present similar challenges • Specifying Translations • Choosing Root / Conformance Slide created by Grahame Grieve; used by permission
Specifying Translations ISO DT • What is a translation? • ED: same content, different language or mediaType (e.g. English / Spanish, PDF/HTML, Video / Document) • CD: different code/codeSystem • PQ: non-UCUM units • Do you need to know what is translated from what? • It depends - controversial Slide created by Grahame Grieve; used by permission
Tracing Translations ISO DT • Source : X : allow sender to specify which was the source • codingRationale : allow sender to specify why translation is provided Slide created by Grahame Grieve; used by permission
Which is Root? • Root is the one to which conformance expectations apply • CD – the code (if one exists) that is in the specified domain • PQ – the one with the UCUM code • ED – no guidance • In the past, root was the first so tracing was possible (introduced source instead) Slide created by Grahame Grieve; used by permission
PQ Examples ISO DT Simple Case: <example value="1.1" unit="mg/mL"/> With translation: <example value="1.1" unit="mg/mL" codingRationale="R"> <translation codingRationale="O" value="5"> <unit codeSystem="2.16.840.1.113883.6.8" code="mM"/> </translation> </example> Slide created by Grahame Grieve; used by permission
IVL(T) – Attributes ISO DT Slide created by Grahame Grieve; used by permission
IVL Examples ISO DT <example xsi:type='IVL_INT'> <low value='2'/> <high value='4'/> </example> <example xsi:type='IVL_PQ' lowClosed='true' highClosed='false'> <low value='2.8' unit='m'/> <high value='4.6' unit='m'/> </example> <example xsi:type='IVL_TS'> <low value='200012041000'/> <high value='200012041030'/> </example> Slide created by Grahame Grieve; used by permission
IVL_TS ISO DT • Interval forms • Literal form is extended by nullFlavors
IVL Examples, boundary issues ISO DT <example xsi:type='IVL_INT'> <low value='2'/> <high value='4'/> </example> <example xsi:type='IVL_TS'> <low value='20100802'/> <high value='20100803'/> </example> <example xsi:type='IVL_TS‘ highClosed=‘true'> <low value='20100802'/> <high value='20100803'/> </example>
IVL_TS: boundary issue ISO DT • Promotion of (TS) 20100803 to IVL<TS>: [20100803000000;20100804000000[ • For TS ‘precision’ is relevant; for IVL_TS boundaries it is not.
CD – Attributes (1) ISO DT Slide created by Grahame Grieve; used by permission
CD Examples ISO DT <example code="784.0" codeSystem="2.16.840.1.113883.6.42" codeSystemName="ICD-9"> <displayName value="Headache"/> <originalText value="general headache"/> </example> • CD lacks a literal form, 784.0:2.16.480.1.113883.6.42 is a generic solution Slide created by Grahame Grieve; used by permission
Equality for CD • The equality of two CD values is determined solely based upon code and codeSystem. • codeSystemVersion is excluded from the equality test. • displayName is excluded from the equality test • Translations are not included in the equality test. • Exceptional CD values are not equal even if they have the same NULL-flavor or the same original text. Slide created by Grahame Grieve; used by permission
CD – Attributes (2) ISO DT • Systems SHALL NOT be required to interpret the code in light of the valueSet, and they SHALL NOT reject an instance because of the presence or absence of any or a particular value set Slide created by Grahame Grieve; used by permission
CD – Attributes (3) ISO DT Slide created by Grahame Grieve; used by permission
CD - Operations ISO DT • If codeSystems define subsumption heirarchies, synonyms, or syntaxes, then one CD may imply the same meaning as different CD • in SNOMED, for example, two isomorphic forms of the same expression will imply each other. • A terminology service may be used to make this determination Slide created by Grahame Grieve; used by permission
Coding Failure Cases Simplest Case: <value nullFlavor="NI"/> More useful - say SNOMED: <value nullFlavor="OTH" codeSystem="2.16.840.1.113883.6.96"/> More useful again?: <value nullFlavor="OTH" valueSet="2.16.840.1.113883.19.11.1" valueSetVersion="20070711""/> Better to give originalText: <value nullFlavor="OTH" codeSystem="2.16.840.1.113883.6.96"> <originalText value="Burnt ear with iron. Burnt other ear calling for ambulance"/> </value> Slide created by Grahame Grieve; used by permission
ED Data ISO DT • There is four different ways to provide the data portion: • A sequence of characters • A sequence of bytes • XML • A reference to some URL • Provide a reference and/or (one of 1,2,3) Slide created by Grahame Grieve; used by permission
ED – Attributes (1) ISO DT Slide created by Grahame Grieve; used by permission
ED Examples ISO DT <example value="this is plain text” mediaType="text/plain"/> <example value="this is plain text"/> <example flavorId="ED.TEXT" value="this is plain text" language="en" mediaType="text/plain"/> <example flavorId="ED.TEXT" value="dieses istnormaler Text" language="de" mediaType="text/plain"/> <example value="this is plain text" language="en"> <translation value="dieses istnormaler Text" language="de"/> </example> Slide created by Grahame Grieve; used by permission
ED Examples ISO DT <example mediaType="text/xml" charset="ASCII"> <data>PHBhcmVudD4NCiAgPGNoaWxkPlRoaXMgaXMgc29tZSB0ZXh0IGluI HRoZSBjaGlsZDwvY2hpbGQ+ DQogIFRoaXMgaXMgc29tZSB0ZXh0IGluIHRoZSBwYXJlbnQNCjwvcG FyZW50Pg==</data> </example> <example mediaType="text/xml"> <xml> <parent> <child>This is some text in the child</child> This is some text in the parent </parent> </xml> </example> Slide created by Grahame Grieve; used by permission
ED Examples ISO DT <example mediaType="image/png"> <reference value="http://example.org/xrays/128s8d9ej229se32s.png"> <useablePeriodxsi:type="IVL_TS"> <low value="200007200845"/> <high value="200008200845"/> </useablePeriod> </reference> <integrityCheck>EQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsB AAMBAQEBAQEBAQEAAAAAAAABAgME</integrityCheck> <thumbnail mediaType="image/jpeg"> <data>/9j/4AAQSkZJRgABAgEAgACAAAD/2wCEAAICAgIC AQICAgICAgICAwQDAwMDAwUEBAMEBgYHBgYG ... gAooAKKACigAooAKKACigAooAKKACigAooAKKACigAooAKKACigA ooAKKACigAooAKKAP//Z </data> </thumbnail> </example> Slide created by Grahame Grieve; used by permission
ED – Attributes (2) ISO DT Slide created by Grahame Grieve; used by permission
ED – Attributes (3) ISO DT Slide created by Grahame Grieve; used by permission
Data Types Run time data type substitution Slide contents published under the Creative Commons / Attribute-Share Alike license Source: www.ringholm.de/download/implementation_mechanics.ppt
Run-time Data Type substitution • ANY – any data type • Requires an xsi:type override • QTY – any quantity • Requires an xsi:type override • GTS – any SET<TS> thing • Requires an xsi:type override • IVL<T> - T • This is build into the XML Schema and doesn’t require an xsi:type override
Data Type: ANY • abstract data type: no XML representation • all data types are specialisations of ANY • used during modelling, if no data type can be assigned • e.g. observations Observation classCode* <= OBS moodCode* <= EVN id*: II [1..1] code: CE CWE [1..1] effectiveTime: <IVL>TS [0..1] value: ANY To populate an attribute of type ANY in an XML instance, the xsi:type declaration must be used
Run-time data-type substitution DT R1 • Run-time demotion is limited by the specification. • Many things allowed by the schema are actually not valid HL7 v3 instances. • Recommendation: Don't ever use xsi:type overrides unless you're dealing with ANY, with GTS or with ED, and in those cases the set of allowable data types is defined by the implementation guide. <administrativeGenderCode code="F" codeSystem="1.2.3"/> <administrativeGenderCode xsi:type="CS" code="7"/> <administrativeGenderCode xsi:type="PQR" value="1" code="[f]" codeSystem="1.2.5"/> Disallowed demotions:
Data Types Data type flavors Slide contents published under the Creative Commons / Attribute-Share Alike license Source: www.ringholm.de/download/implementation_mechanics.ppt
Implementation Guides for Data Types • Various HL7 organizations (e.g. UK, NL, CA, DE) and organizations (e.g. EN NHS) have created implementation guides for data types • The US realm has no such implementation guide • These take into account the local circumstances and contain a constraint profile on the HL7 data types
Flavors • No new semantics • But some extra rules • Purposeful limitations • No need to know the rules to process correctly • Only one at once • May always be ignored flavor BooleanNonNull alias BN constrains BL; invariant (BN x) { x.isNull.not; }; Slide created by Grahame Grieve; used by permission
Data Types Vocabulary Aspects Slide contents published under the Creative Commons / Attribute-Share Alike license Source: www.ringholm.de/download/implementation_mechanics.ppt
Vocabulary Binding • Attributes with C* data types are bound to a value set (or: to a fixed value) • Coding strength (CNE, CWE) • Extensional (enumeration) and intentional defined value sets (rules-based subset of a coding system - by reference) • Value sets may be designated as being “Immutable”