920 likes | 1.24k Views
HL7 教育訓練課程教材 訊息結構與規則說明. 教育訓練委員會 Education Technical Committees. 秘書長 范士展 改編自總會教材. 講授大綱. Control Formatting Processing Rules Data Type Conformance. What is HL7 Standard?. Protocol for exchange of healthcare information Not an application Not a data structure or database specification
E N D
HL7教育訓練課程教材訊息結構與規則說明 教育訓練委員會 Education Technical Committees 秘書長 范士展 改編自總會教材
講授大綱 • Control • Formatting • Processing Rules • Data Type • Conformance
What is HL7 Standard? • Protocol for exchange of healthcare information • Not an application • Not a data structure or database specification • Not an architecture for designing health applications • Not a specification for a message router or Gateway
Control Chapter 2 of the HL7 V2.x Standard
HL7 Chapters (Version 2.5) Appendix A-Data definition tables Appendix B-Lower layer protocols Appendix C-BNF message descriptions management Appendix D-Glossary
What Control Covers… • Defines the generic rules that apply to all messages • The Key: How to read the rest of the specification • HL7 Encoding Rules: what the !@#$ are those |^&\ in my data stream? • The programming procedures required to exchange all messages • Standard conformance profiling rules for message specification
Conceptual Approach Response Message Initiating Message Critical Care Unit ADT System Initiating Message Clinical Data Repository
V2 Message Definition RECEIVING APPLICATION (Lab System) TRIGGER EVENT (Admit) MESSAGE (Admission Message) SENDING APPLICATION (Patient Administration)
HL7 CONTROL • Framework • Trigger Event • Message • Segment • Field (Data Type) • Component • Sub-Component Message Segment Segment …… Field Field Field Component Component ……….
台北站 高雄站 以火車系統為例 車 站:System 時刻表:Trigger Event 火 車:Message 車 廂:Segment 座 位:Field 車 票:Data Type 乘 客:Component
UnsolicitedUpdate Patient is admitted Admit Ack Query / Request MD request Report Query HL7 Has Two Transaction Flows Trigger Event Trigger Event
Trigger Event • A real world event that necessitates an exchange of information.
Unsolicited Update • When the transfer of information is initiated by the application system that deals with the trigger event, the transaction is termed an unsolicited update. Example: Patient is admitted. Glucose test is resulted.
Query and Response • When the transfer of information is initiated by an application requesting information from another system, the transaction is termed a query. Example: Request all lab results from a patient’s prior visit.
Recipe for an HL7 Message • Messages are made up of segments which are made up of fields which may have components which may have sub-components. HL7
Abstract Message • The information associated with the trigger event. Who came to the hospital? When did they arrive? What was wrong? What doctor did they see?
Abstract Message • The data fields that will be sent within a message • The valid response messages • The treatment of application level errors or the failure of the underlying communications system Abstract Message data responses errors
HL7 Message HL7 Message HL7 Message ADT Message ADT Message ADT Message A01 Admit A03 Discharge A02 Transfer Message • An atomic unit of data transferred between systems. • A Message Type defines its domain. • A Trigger Event defines the reason for the exchange.
Message Type • A 3-character code contained within each message that identifies its type or domain.
Trigger Events and Message Types • One message type can have many different trigger event codes. • A trigger event code may not be associated withmore than onemessage type.
Message • A message is comprised of a group of segments in a defined sequence.
Segment Characteristics • Segments of a message: • are identified by a unique three character code known as the Segment ID. • Can be required • MSH is ALWAYS required! • May be optional [..] • May repeat {…}
Segment Groups • Logical grouping of segments containing more than one type of segment • A segment group is assigned a name that represents a permanent identifier that may not be changed. • How many groups can you identify here? • {OBR, [NTE], {OBX, [{NTE}]}}
Fields • An HL7 field is a set of characters defined by an HL7 data type. For example, marital status.PID.15 (data type CE) User Defined Table 0002 |M| (suggested values)
Components • A field entry may also have parts called components. For example, the patient’s name has components such as • last name • first name • middle name or initial • Components may be further divided into sub-components.
HL7 CONTROL review • Framework • Trigger Event • Message • Segment • Field (Data Type) • Component • Sub-Component Message Segment Segment …… Field Field Field Component Component ……….
SEQ LEN DT OPT RP/# TBL# ITEM # ELEMENT NAME 1 1 ST R 00001 Field Separator 2 4 ST R 00002 Encoding Characters 3 227 HD O 0361 00003 Sending Application 4 227 HD O 0362 00004 Sending Facility 5 227 HD O 0361 00005 Receiving Application 6 227 HD O 0362 00006 Receiving Facility 7 26 TS R 00007 Date/Time Of Message 8 40 ST O 00008 Security 9 15 MSG R 00009 Message Type 10 20 ST R 00010 Message Control ID 11 3 PT R 00011 Processing ID 12 60 VID R 00012 Version ID Message Header (MSH) Segment
SEQ LEN DT OPT RP# TBL# ITEM # ELEMENT NAME 13 15 NM O 00013 Sequence Number 14 180 ST O 00014 Continuation Pointer 15 2 ID O 0155 00015 Accept Acknowledgment Type 16 2 ID O 0155 00016 Application Acknowledgment Type 17 3 ID O 0399 00017 Country Code 18 16 ID O Y 0211 00692 Character Set 19 250 CE O 00693 Principal Language Of Message 20 20 ID O 0356 01317 Alternate Character Set Handling Scheme 21 427 EI O Y 01598 Message Profile Identifier Message Header (MSH) Segment
Field Attributes: SEQSEQuenc • Definition: Ordinal position of the data field within the segment. This number is used to refer to the data field in the text comments that follow the segment definition table. • In the segment attribute tables this information is provided in the column labeled SEQ
Field Attributes: LENMax LENgth • Definition: Maximum number of characters that one occurrence of the data field may occupy. • “65536” replaces 64K to express a very large field • “99999” indicates that the length may vary • Normative, but can be changed on a site specific basis • Includes components and sub-components • Does not include repetitions
Field Attributes: DTData Type • Definition: Restrictions on the contents of the data field. • In the segment attribute tables this information is provided in the column labeled DT. If the data type of the field is variable, the notation “varies” will be displayed. • There are a number of data types defined by HL7.
Field Attributes: OPTOPTionality • Definition: Whether the field is required, optional, or conditional in a segment. • The designations for optionality are: R-required O-optional C-conditional on trigger event or other field(s). X-not used with this trigger event B- left in for backward compatibility with previous versions
Field Attributes: RP#REPetition • Definition: Indicates whether the field may repeat. • The designations for Repetition are: • N or blank-no repetition • Y-the field may repeat an indefinite or site-determined number of times • (integer)-the field may repeat up to the number of times specified by the integer • Each occurrence may contain the number of characters specified by the field’s maximum length
Field Attributes: TBL#Table Number - 1 • Definition: The table attribute of the data field definition specifies the HL7 identifier for a set of coded values. • An entry in the table number column means that the table name and the element name are equivalent. • If this attribute is not valued or blank, there is not a table of values defined for the field.
Field Attributes: TBL#Table Number - 2 • If more than one table is applicable, the format xxxx/yyyy • ID or IS a table number will be allocated even if, in the case of IS, there may be a notation "No Suggested values”
HL7 Message ADT Message MSH|^~\&|ADTSYS|LABSYS|... A01 Admit Encoding Rules • To determine the exact representation of an abstract message, one applies the HL7 encoding rules defined in Chapter 2 to the abstract definition from the functional chapter (example - Chapter 3, Patient Administration).
Example Transaction 住院病人 范士展 男性 生於 10/31/1965 於 8/5/2000 12:30 PM 住進了WARD NO 8B 真實世界 HL7 訊息參考結構 HL7 國際認證分析師 MSH|^~\&|REGAMT|MCM|NURCAR||200005081232||ADT^A01|00001|P|2.3<CR> EVN|A01|200005081230||01||200005081230<CR> PID|||191919^^^GENHOSP|253763|范^士展||19651031|M|||407^台中港路^ ISHPEMING^台中市^49849^””^||(900)4855344|(900)4855344||S|C|10199925<CR> PV1||I|8B^06^01^某醫院||||0200^JONES,GEORGE|0148^ADDISON,JAMES||8B ||||||||0148^ANDERSON,CARL|||<CR> 電腦世界
Message Delimiters • In a message certain encoding characters delimit the constructs. • The Segment Terminator • The Field Separator • The Component Separator • The Sub-Component Separator • The Repetition Character • The Escape Character. <CR> | ^ & ~ \
Selection of Delimiters • The Encoding Characters are specified immediately following the segment ID in the MSH Segment. • With the exception of the segment terminator, delimiter values are at the discretion of the sender. • Most senders use the suggested values. MSH|^~\&|...
Field Separator • The HL7 field separator marks the beginning of a data field within an HL7 segment. • It always follows the segment ID to indicate the first data field in the segment. | EVN|A04|200502082159|||SJT3C<CR>
Component Separator • Used to separate adjacent components within a field. • The data type defines whether a field has components. ^ |Anderson^Hans^Christian|
Repetition Separator • Used to separate occurrences of a repeating field. • The “repetitions” are of a common structure (like rows in a database) defined by the data type. The content of each repetition may be (and usually is) different. ~ |.61^RUL^ACR~.212^Bronchopneumonia^ACR|
Subcomponent Separator • Used to separate adjacent subcomponents. • The data type defines whether the components of a field have subcomponents. • When a component of a data type is itself a data type with components, its parts will be expressed as subcomponents of the full data type. |2E^215^B^General Hospital&123.11.154.1.8&ISO| &
Escape Character • Used in alphanumeric fields defined by data types ST, TX or FT • Used for highlighting • Used to escape the other delimiters • Used for hex character representation • Must both precede and follow the character(s) being escaped \H\Low\N\ \T\ \X0FA3\ \
Is the last character of EVERY segment. Is ALWAYS the ASCII CR character (hex 0D). Is NEVER omitted. Can NEVER be changed. Segment Terminator OBX||CE|organism^413^L|1|^E. Coli||||||F<CR> <CR>
Sending Rules 1/4For Encoding HL7 Messages Admit MessageMSHEVNPID[ { PD1 } ] [ { ROL } ] [ { NK1 } ]PV1[ PV2 ][ { ROL } ] [ { DB1 } ] [ { OBX } ] [ { AL1 } ][ { DG1 } ] [ DRG ][ { PR1 [ { ROL } ] } ][ { GT1 } ][ { IN1 [ IN2 ] [ { IN3 } ] [ { ROL } ] } ][ ACC ][ UB1 ] [ UB2 ] [ PDA ] Encode each segment in the order specified in the abstract message format The segment ID is required to identify the segment PID|||2-68708-5|253763|COX^JAMES... Precede each data field with the field separator
Sending Rules 2/4For Encoding HL7 Messages Encode the data fields in the order specified in the segment definition table Data fields ‘present but null’ are encoded with ”” (double quotes) PID attributesSq Ln DT O # Tbl Item Element Name1 4 SI 00104 Set ID - Patient2 20 CX B 00105 Patient ID3 250 CX R Y 00106 Patient Identifier4 20 CX B Y 00107 Alternate Patient5 250 XPN R 00108 Patient Name6 250 XPN O Y 00109 Mother’s Maide Data fields that are ‘not present’ require no characters PID|||2-68708||COX^JAMES|””|...
Sending Rules 3/4For Encoding HL7 Messages • If components, subcomponents, or repetitions at the end of a data field are ‘not present’, their separators may be omitted • If no more fields are present in a segment, the data field separators may be omitted |Anderson^Hans^Christian^^^| |Anderson^Hans^Christian| PID|...|Last Field||||||||<CR> PID|...|Last Field<CR> Padding doesn’t violate the rules, it’s just not good practice!