Presentation is loading. Please wait.

Presentation is loading. Please wait.

台灣健康資訊交換第七層協定協會 版權所有 1 HL7 教育訓練課程教材 訊息結構與規則說明 教育訓練委員會 Education Technical Committees 秘書長 范士展 改編自總會教材.

Similar presentations


Presentation on theme: "台灣健康資訊交換第七層協定協會 版權所有 1 HL7 教育訓練課程教材 訊息結構與規則說明 教育訓練委員會 Education Technical Committees 秘書長 范士展 改編自總會教材."— Presentation transcript:

1 台灣健康資訊交換第七層協定協會 版權所有 1 HL7 教育訓練課程教材 訊息結構與規則說明 教育訓練委員會 Education Technical Committees 秘書長 范士展 改編自總會教材

2 2 講授大綱 Control Formatting Processing Rules Data Type Conformance

3 3 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

4 台灣健康資訊交換第七層協定協會 版權所有 4 Control Chapter 2 of the HL7 V2.x Standard

5 5 Appendix A - Data definition tables Appendix B - Lower layer protocols Appendix C - BNF message descriptions management Appendix D - Glossary HL7 Chapters (Version 2.5) CHAPTER 1. Introduction 2. Control 2a. Data type 3. Patient administration 4. Order entry 5. Query 6. Financial management 7. Observation reporting 8. Master files 9. Medical records/Information 10. Scheduling 11. Patient referral 12. Patient care 13. Laboratory automation 14. Application management 15. Personnel management

6 6 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

7 7 Conceptual Approach Critical Care Unit ADT System Response Message Initiating Message Clinical Data Repository Initiating Message

8 8 V2 Message Definition MESSAGE (Admission Message) SENDING APPLICATION (Patient Administration) RECEIVING APPLICATION (Lab System) TRIGGER EVENT (Admit)

9 9 HL7 CONTROL Framework – Trigger Event – Message – Segment – Field (Data Type) – Component – Sub-Component Message Segment …… Field Component ………. Field

10 10 以火車系統為例 台北站高雄站 車 站: System 時刻表: Trigger Event 火 車: Message 車 廂: Segment 座 位: Field 車 票: Data Type 乘 客: Component

11 11 HL7 Has Two Transaction Flows Unsolicited Update Patient is admitted AdmitAck Query / Request MD request QueryReport Trigger Event

12 12 Trigger Event A real world event that necessitates an exchange of information.

13 13 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.

14 14 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.

15 15 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.

16 16 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?

17 17 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

18 18 Message An atomic unit of data transferred between systems. A Message Type defines its domain. A Trigger Event defines the reason for the exchange. HL7 Message ADT Message A01 Admit HL7 Message A03 Discharge ADT Message HL7 Message A02 Transfer ADT Message

19 19 Message Type A 3-character code contained within each message that identifies its type or domain.

20 20 Trigger Events and Message Types One message type can have many different trigger event codes. A trigger event code may not be associated with more than one message type.

21 21 Message A message is comprised of a group of segments in a defined sequence.

22 22 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 { … }

23 23 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}]}}

24 24 Fields An HL7 field is a set of characters defined by an HL7 data type. For example, marital status. PID.15 (data type CE) |M| User Defined Table 0002 (suggested values)

25 25 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.

26 26 HL7 CONTROL review Framework – Trigger Event – Message – Segment – Field (Data Type) – Component – Sub-Component Message Segment …… Field Component ………. Field

27 27 Message Header (MSH) Segment SEQLEN DT OPTRP/# TBL# ITEM # ELEMENT NAME 11STR 00001Field Separator 24STR 00002Encoding Characters 3227HDO Sending Application 4227HDO Sending Facility 5227HDO Receiving Application 6227HDO Receiving Facility 726TSR 00007Date/Time Of Message 840STO 00008Security 915 MSG R 00009Message Type 1020STR 00010Message Control ID 113PTR 00011Processing ID 1260VIDR 00012Version ID

28 28 Message Header (MSH) Segment SEQLEN DT OPT RP#TBL# ITEM # ELEMENT NAME 1315NMO 00013Sequence Number 14180STO 00014Continuation Pointer 152IDO Accept Acknowledgment Type 162IDO Application Acknowledgment Type 173IDO Country Code 1816IDOY Character Set 19250CEO 00693Principal Language Of Message 20 IDO Alternate Character Set Handling Scheme EIOY 01598Message Profile Identifier

29 29 Field Attributes: SEQ SEQuenc 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

30 30 Field Attributes: LEN Max 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

31 31 Field Attributes: DT Data 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.

32 32 Field Attributes: OPT OPTionality 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

33 33 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

34 34 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.

35 35 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”

36 台灣健康資訊交換第七層協定協會 版權所有 36 Formatting

37 37 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). MSH|^~\&|ADTSYS|LABSYS|... HL7 Message ADT Message A01 Admit

38 38 Example Transaction 住院病人 范士展 男性 生於 10/31/1965 於 8/5/ :30 PM 住進了 WARD NO 8B 住院病人 范士展 男性 生於 10/31/1965 於 8/5/ :30 PM 住進了 WARD NO 8B |^~\& MSH|^~\&|REGAMT|MCM|NURCAR|| ||ADT^A01|00001|P|2.3 EVN|A01| ||01|| PID|||191919^^^GENHOSP|253763| 范 ^ 士展 || |M|||407^ 台中港路 ^ ISHPEMING^ 台中市 ^49849^””^||(900) |(900) ||S|C| PV1||I|8B^06^01^ 某醫院 ||||0200^JONES,GEORGE|0148^ADDISON,JAMES||8B ||||||||0148^ANDERSON,CARL||| 真實世界 電腦世界 HL7 訊息參考結構 HL7 國際認證分析師

39 39 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. ^ | & ~ \

40 40 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|^~\&|...

41 41 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| |||SJT3C |

42 42 Component Separator Used to separate adjacent components within a field. The data type defines whether a field has components. ^ |Anderson^Hans^Christian|

43 43 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| ~

44 44 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& &ISO|

45 45 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\

46 46 Escape Sequences

47 47 Segment Terminator Is the last character of EVERY segment. Is ALWAYS the ASCII CR character (hex 0D). Is NEVER omitted. Can NEVER be changed. OBX||CE|organism^413^L|1|^E. Coli||||||F

48 48 Sending Rules 1/4 For Encoding HL7 Messages Encode each segment in the order specified in the abstract message format The segment ID is required to identify the segment Precede each data field with the field separator Admit Message MSH EVN PID [ { PD1 } ] [ { ROL } ] [ { NK1 } ] PV1 [ PV2 ] [ { ROL } ] [ { DB1 } ] [ { OBX } ] [ { AL1 } ] [ { DG1 } ] [ DRG ] [ { PR1 [ { ROL } ] } ] [ { GT1 } ] [ { IN1 [ IN2 ] [ { IN3 } ] [ { ROL } ] } ] [ ACC ] [ UB1 ] [ UB2 ] [ PDA ] PID||| |253763|COX^JAMES...

49 49 Sending Rules 2/4 For Encoding HL7 Messages Data fields ‘ present but null ’ are encoded with ”” (double quotes) Data fields that are ‘not present’ require no characters Encode the data fields in the order specified in the segment definition table PID attributes SqLnDTO#TblItemElement Name 14SI00104Set ID - Patient 220CXB00105Patient ID 3250CXRY00106Patient Identifier 420CXBY00107Alternate Patient 5250XPNR00108Patient Name 6250XPNOY00109Mother’s Maide PID||| ||COX^JAMES|””|...

50 50 Sending Rules 3/4 For 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|||||||| PID|...|Last Field Padding doesn’t violate the rules, it’s just not good practice!

51 51 Sending Rules 4/4 For Encoding HL7 Messages End each segment with the REQUIRED segment terminator PID|...|Last Field

52 52 Receiving Rules 1 For Decoding HL7 Messages Rule 1: Ignore the unexpected Rule 2: If it ’ s not there, assume it ’ s not present.

53 53 Receiving Rule 1 2 Ignore the unexpected Ignore segments, fields, components, subcomponents, and repetitions of a field that are present but not expected. SEG|A|B|C|New1|New2|New3

54 54 Receiving Rule 2 3 Not there = Not present Treat segments that were expected but are not present as consisting entirely of fields that are not present. – Example: If the PR1 procedure segment is not sent on a discharge, assume that procedure info is not present - do NOT assume it ’ s NULL. Treat fields and components that are expected but were not included in a segment as not present. – DON ’ T break the interface – DO return an ERR segment in the acknowledgment message for each required field that is missing

55 55 Backwards Compatibility (2.x) What the HL7 Standard Can Do New messages may be introduced in subsequent versions. New segments may be introduced and placed anywhere in an existing message structure in subsequent versions. In subsequent versions new F/C/S/R - can only be introduced at the end of a segment, field, component, or repetition list. Data types can only be extended in subsequent versions by adding components to the end. Non-repeating field can become repeating, but first repetition meaning should remain the same. “ Retained for backwards compatibility only ” designates fields no longer recommended for use, but retained as place holders. These fields may need to be valued to support prior versions.

56 56 How would you encode the following in an HL7 message? Outpatient Registration (Patient Class - O): Patient Name: Alice E. Smith. MRN: , Assigning Authority “ ABC ” Address: 123 Meridian Street (street address 2 deleted) Philadelphia, PA County Code: 12 Primary Home Phone: (215) Secondary Home Phone: (215) Allergy Description: “ Cheap Cologne ” Allergies on record: Cologne Penicillin This suggests ?

57 57 Finish the Message: MSH|^~\&|ADT|MF|ADT|HL7SYS| || ADT^A04^ADT_A04| |P|2.5 EVN|A04|

58 58 Possible Answer: MSH|^~\&|ADT|MF|ADT|HL7SYS| || ADT^A04^ADT_A04| |P|2.5 EVN|A04| PID|||123456^^^ABC||Smith^Alice^E||||||123 Meridian Street^””^Philadelphia^PA^ ^^^^12|| (215) ~(215) PV1||O AL1|1||^Cologne AL1|2||^Penicillin AL1|3||^Cheap Cologne

59 59 Apply to receiving system Message MSH EVN PID [ { NK1 } ] PV1 [ { AL1 } ] PATIENT DEMOGRAPHICS: Name: Dr. Alice Smythe MRN: DOB: 10/10/1962 Address: 456 John Street Apt. 6B Philadelphia, PA Phone: (215) NEXT OF KIN: Name: Jeff Smith Relationship: Spouse ALLERGIES:cologne penicillin

60 60 Possible Answer Message MSH EVN PID [ { NK1 } ] PV1 [ { AL1 } ] PATIENT DEMOGRAPHICS: Name: Dr. Alice E. Smith MRN: DOB: 10/10/1962 Address: 123 Meridian Street Philadelphia, PA Phone: (215) (215) NEXT OF KIN: Name: Jeff Smith Relationship: Spouse ALLERGIES:Cologne Penicillin Cheap Cologne

61 台灣健康資訊交換第七層協定協會 版權所有 61 Processing Rules

62 62 Acknowledgment of Messages Original Mode – Application Level Acknowledgements – Version 2.1 Enhanced Mode – Accept and Application Level Acknowledgements – Version 2.2+ ACK !

63 63 Original Acknowledgment Original Mode ( only mode in V2.1 ) – Application acknowledgment only System A 1. ORM message System B 2. ORR message Application ACK

64 64 Enhanced Acknowledgment Enhanced Mode ( available in V2.2 and later ) – Allows accept/commit and application acknowledgments System B 3. ORR (optional) (Application ACK) 2. Accept ACK System A 1. ORM message (optional) 4. Accept ACK

65 65 Original Acknowledgement Receiver gets message: – Sends a reject message if it fails syntactically – Otherwise the message is passed to the application which creates either an: accept response (the good) reject response (the bad) reject with error response (the ugly) – Response message is sent back to the initiating application

66 66 Original Syntactic Validation The value in MSH-9 (message type) is acceptable to the receiving system. The value in MSH-12 (version ID) is acceptable to the receiving system. The value in MSH-11 (processing ID) is appropriate for the application process handling the message. HL7 Message ACK Message MSA|AR|...

67 67 ACK General Acknowledgement Message Used to respond to a message when – the application does not define a special message type (example ORR) for the response or – there has been an error that precludes application processing. All acknowledgements contain MSH and MSA segments. ACK Message MSH MSA [ERR]

68 68 Original Mode Responses Processed successfully ( AA ) Process failure (reject) unrelated to content or format ( AR ) Reject with Error response ( AE ) HL7 Message ACK Message MSA|AA|... HL7 Message ACK Message MSA|AE|... HL7 Message ACK Message MSA|AR|...

69 69 MSA Segment MSA 1-Acknowledgment Code:

70 70 Acknowledgement Processing

71 71 Enhanced Acknowledgement Supports two levels of acknowledgement 1. Accept Level 2. Application Level

72 72 1. Accept Level The receiving system commits the message to safe storage in a manner that releases the sending system from any obligation to resend the message. A response is returned to the sender indicating successful receipt and secure storage of the message.

73 73 2. Application Level The appropriate application on the receiving system accepts and processes the transaction. The receiving system returns an application- dependent response to the sender.

74 74 Acknowledgement Types MSH-15-Accept Acknowledgement Type MSH-16-Application Acknowledgement Type Data Type is ID Table # is 155 Table 155 AL - Always NE - Never ER - Error/Reject Conditions Only SU - Successful Completion Only

75 75 MSH

76 Special Protocols

77 77 Sequence Number Protocol: When keeping data bases synchronized is critical Normal acknowledgement protocol prevents out of sequence transactions BUT … Only sequence number processing prevents duplicate transactions

78 78 I send One; You get One I ’ m at one. You ’ re at one. Sender increments the sequence number, receiver echoes it back. Restarting the Link (Where was I?) Sender wants to start up where it left off; asks receiver for next expected sequence number. Re-synchronizing the link! Sender wants to restart with an arbitrary number - tells receiver to forget expected sequence number and reset counter with next sequence number sent.

79 79 Normal Operation Sender increments the sequence number Receiver echoes it back Sending sequence 7 Got sequence 7

80 80 Starting/Restarting the Link Sender uses sequence number 0 to start or restart the link. The receiving system returns a general acknowledgment message with a sequence number one greater than the last received successfully. If the link is starting for the first time, the receiving system returns a sequence of -1 meaning: I ’ ll accept the next positive integer sequence number as the starting sequence. I say 0 I’m expecting 8

81 81 Forcing Synchronization A sequence number of -1 is sent when the initiating system wishes to synchronize the link. The receiving system will return a general acknowledgment message with a -1 in the expected sequence number field. The receiving system will reset its sequence number to the sequence number of the next transaction it receives. Let’s reset the sequence number! You’re the Boss.

82 82 Normal Operation of the Link MSH|^~\&|NeoReg|MGH|Lab-R-Us|MGH| ||ADT^A01|NR12345|P|2.3.1| 4321||AL|NE| MSH|^~\&|Labs-R-Us|MGH|NeoReg|MGH| ||ACK^A01|ZZ4364|P|2.3.1 MSA|AA|NR12345|4321

83 83 Starting/Restarting the Link MSH|^~\&|NeoReg|MGH|Lab-R-Us|MGH| |||NR22346|P|2.3.1|0 MSH|^~\&|Labs-R-Us|MGH|NeoReg|MGH| ||ACK^|ZZ6365|P|2.3.1 MSA|AA|NR22346|4322

84 84 Re-synchronizing the Link MSH|^~\&|NeoReg|MGH|Lab-R-Us|MGH| |||NR22646|P|2.3.1|-1 MSH|^~\&|Labs-R-Us|MGH|NeoReg|MGH| ||ACK^|ZZ6665|P|2.3.1 MSA|AA|NR22646|-1

85 85 HL7 Continuation Protocol A protocol for breaking long messages into a series of transactions. DSC: Continuation Pointer Segment – Message fragmentation; breaks the message on segment boundary. ADD:Addendum Segment – Segment Fragmentation; breaks the message on field boundary within a segment. For Unsolicited Updates and Queries

86 86 Use DSC for Message Fragmentation MSH|… (no CP) PID|… PV1|… ORC|… OBR|… OBX|… DSC| CP 1 MSH|… CP 1 … OBX|… DSC | CP 2 MSH|… CP 2 … OBX|… (no DSC) CP is MSH-14 Continuation Pointer DSC-1 Continuation Pointer

87 87 Use ADD for Segment Fragmentation MSH|… (no CP) PID|… PV1|… ORC|… OBR|… OBX|… OBX|…|This is a very very very very ADD DSC| CP 1 MSH| … CP 1 … ADD|very long segment OBX|… DSC| CP 2 MSH|… CP 2 … OBX|… (no DSC)

88 88 HL7 Batch Protocol To transfer a batch of HL7 messages Example: Charges sent from an ancillary system to a billing system. [FHS](file header segment) {--- BATCH begin [BHS](batch header segment) { [ --- MESSAGE begin MSH (zero or more HL7 messages).... ] } --- MESSAGE end [BTS](batch trailer segment) }--- Batch end [FTS](file trailer segment)

89 89 Updating Repetitions Snapshot mode – Sender always sends all repetitions – Receiver deletes all existing repetitions and replaces with new list of repetitions. – Primarily relevant to: IN1, NK1, DG1, PR1, AL1 Action Code/Unique Key – Sender sends each changed repetition with a unique id and with an action code (add, update, delete, etc.). – Receiver finds each repetition using the unique key and applies the appropriate action

90 90 When the standard is not enough … Locally defined – Message Types – Segments – Trigger Events – Escape Sequences All must begin with ‘ Z ’. The Big Z Don’t use as a substitute for reading the specification

91 91 Z Message Messages may be locally extended as follows: – Users may develop local Z messages to cover areas not already covered by existing HL7 messages. These should be composed of HL7 segments where possible. – A local Z message may consist entirely of Z segments except that it must begin with a MSH segment. – A local Z Acknowledgement message must begin with an MSH segment followed by an MSA segment, an optional SFT segment and a conditional ERR segment. – Users may develop Z segments and add them to Z messages. – Users may develop Z segments and add them to HL7 messages. The trigger event may remain the same if the intent of the message has remained unchanged. – The practice of adding additional HL7 segments, like NTE, to existing HL7 messages locally is ill-advised. HL7 may move or change the segment in a future release; this will render the message unparsible.

92 台灣健康資訊交換第七層協定協會 版權所有 92 感謝聆聽 HL7 教育訓練課程教材 ─ 訊息結構與規則說明 下一場: HL7 資料型態


Download ppt "台灣健康資訊交換第七層協定協會 版權所有 1 HL7 教育訓練課程教材 訊息結構與規則說明 教育訓練委員會 Education Technical Committees 秘書長 范士展 改編自總會教材."

Similar presentations


Ads by Google