Top Banner
90

HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Jun 07, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.
Page 2: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

HL7forBusyProfessionals

YourNoSweatGuidetoUnderstandingHL7

RahulBhagatIllustrationByCalvinHui

Anchiove

2015

Page 3: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Copyright©2015byRahulBhagat

All rights reserved. This book or any portion thereofmay not be reproduced or used in anymannerwhatsoeverwithout the express written permission of the publisher except for the use of brief quotations in a book review orscholarlyjournal.

FirstPrinting:2015

ISBN978-0-9939945-1-7

AnchioveInc.

135WynfordDr.,Toronto,ON,CanadaM3COJ4

www.HL7Book.com

Althoughtheauthorandpublisherhavemadeeveryefforttoensurethattheinformationinthisbookwascorrectatpresstime,theauthorandpublisherdonotassumeandherebydisclaimanyliabilitytoanypartyforanyloss,damage,ordisruptioncausedbyerrorsoromissions,whethersucherrorsoromissionsresultfromnegligence,accident,oranyothercause

Page 4: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

ToNeelamBhagat,

whoknewthisbookwasforrealbeforeIdid.

Thankyouma.

Page 5: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

TableofContentsPreface

PartIScratchingthesurface

1.Introduction

2.WhatisHL7?

3.IntegrationConcepts

4.EvolutionofHL7

PartIIDiggingDeeper

5.BasicConcepts

6.MessageBuildingBlocks

7.WorkingwithaMessage

8.ControlSegments

9.DataSegments

10.OtherImportantTopics

Page 6: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

PrefaceAfteruniversity,Igotajobwithabusy,Torontobased,healthcareconsultingcompany.

Ondaytwoatwork,Iwashandedaprintoutwithcryptictextonit,andadocumentcalledinterfacespec,toreadandunderstand.

Thiswasmy introduction toHL7.At that time, I did not realize that this obscuremessagingprotocolwouldbecomemytickettofaroffplaces,andthereasontomeetandworkwithalotofpeople.

It didn’t takeme long to learnHL7,myprogrammingbackgroundhelped.Later, IrealizedthatmyskillisinhighdemandandIbecameaconsultant.ItraveledtodifferentcitiesandworkedonvariousHL7projects.

Ialsostartedrunningintopeoplefromnon-technicalbackgroundwhowantedmetoexplain HL7 in the elevator or while chatting in their cubicle. There wasn’t anyintroductorybookIcouldsuggest,sotheideaofwritingonemyself.

I’mgladIcollaboratedwithCalvinHuiinwritingthisbook.HenotonlytookcareofillustrationanddesignbutalsonudgedmewhenIwasslackingafter the firstdraft.MyfriendErikWestermannwasagreatsoundingboardandhelpedmerefinemyideas.Andthankstomanycolleagueswhohelpedmedevelopmyskills.Inparticular,DerrickLeung,whomentoredmewhenIwasjuststartingout.

Sohereitis.MyideaofanintroductorybookonHL7.Ihopeyouenjoyreadingit.

Page 7: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

PartIScratchingthesurface

Page 8: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

1.IntroductionAtechnicalbookusually impliesadrysubject.Soitsnosurpriseauthorshaveahard

timefiguringoutwaystomakethebookinterestingtothereader.HL7isonesuchsubject.Itisasubjectthatissohighonthescaleofdrynessandnoonecomestoitwillingly.TheonlyreasonsomeonewouldreadabookonHL7isbecauseofhisorherjob.Andifyouarehere,readingthisbook,thenIassumeyouworkinhealthcareITorintendtojointheindustrysoon.

Ihavemadeeveryeffort to takeout thedrynessof thesubjectandmake thisbookinteresting.Therearenoneedlessjargonsoresotericconceptsthrowncasuallytotripyou.Infact,youwillseeaheavyrelianceoneverydayexamplesandinclusionofbackgroundinformation to paint a complete picture.ButHL7 andhealthcare system integration arecomplex subjects so there will be topics that don’t make sense right away. Pleasepersevere.Tieaknotandhanginthere.Graduallythingswillmakesense.

ThisintroductorybookonHL7goesindetailtoexplainwhatHL7is.Itgivesyouthebasicconcepts, tellsyouabout theorganizationbehind it andhelpsyoucreateamentalmap of the voluminous HL7 specification document. And, it takes you through awhirlwindtourofsomeofthemostcommonlyusedHL7messages,allinashortspanoftime.

EarlyRailroadsHL7 was created to solve the problems of clinical system integration. But to truly

understandtheproblemsofsystemintegration,let’sstartwithanotherintegrationproblemwesolvedcenturiesago.

The1800’swere a timewhen railwayswere comingof age inAmerica– just likebatterydrivencars,dronesandothernewtechnologiesarecomingofagetoday.

Therewereliterallyhundredsofcompaniescompetingforapieceoftherailwaypie.Enterprisingcompanieswouldbuyup land, laydown tracksand runa transport servicebetweencitieswhichhadnoothermeansoftransportationexceptforhorse-drawnwagonsor,ifonewasfortunate,steamships.

By the timeAmericancivilwarstarted(1861),vaststretchesof thecontinentwerealready connected through rail andworkwaswell underwayon the construction of thetranscontinentalrailroadtoconnectCaliforniawiththerestofthecountry.

However, therewasoneproblem.You couldnot just hopon a train andget off atyour destination, like you can today. Because these railroads were built and run bydifferent companies, they used different track gauges (horizontal distance between tworails of the track).Thismeantyouhad toget off and change trainswheneveryouhit ajunction with two different gauge widths. There were well over twenty different trackgaugesbeingusedatthetimeofthecivilwar.Thearmyhadtoconstantlyloadandunloadcargoinitsefforttogetsuppliestothetroops.Thiswasaseriousproblem!

And itwas the reason that finallymade theAmerican government to push for theconversion of all railway tracks to a standard gauge—4 feet and 8.5 inches, the most

Page 9: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

commonlyusedgaugewidth.Morethanhalfoftheexistingtrackswerebuilttothiswidthsoitwaseasiesttoconverttheremainingtrackstothiswidthandachievestandardization.

Standardizationofrailtrackswasthefirststeptowardscreatinganintegratedsystemwheregoodsandpeoplecouldmovefreelyacrossthewholenetwork.Itwasfollowedbythedevelopmentofacommonsignalsystem,timezones,harmonizedtrainschedule,fixedcoachheight,astandardcoalandwatersupplysystemandonandon.

Itwasevidentthatanintegratedsystemneededastandardwayofdoingthings.

EvolutionofHealthcareITSystemsToday, we are in a (somewhat) similar situation with the movement of healthcare

information.Itcannotseamlesslyflowfromonesystemtothenext.Eachorganizationhasits ownway of storing and sharing information.Whenever health information needs tomove across organization boundaries, it hits the incompatible standards roadblock.Someonehastounloadandreloadtheinformation.

Healthcare IT systems have evolved similar to railroads. Initially, hardware costs(thinkmulti-million dollarmainframes)were the biggest factor, so only a few teachinghospitalswithdeeppocketshadthemeanstobuildasystem.Thesewereprimarilystand-alone systems meant to serve a specific purpose. For example, to manage patientpopulationinalargehospital.

Then the hardware cost came down and minicomputers arrived on the scene. Acomputer could be had for less than $25,000 and didn’t need a room to house it. Thisallowed smaller players and even departmentswithin a hospital to purchase systems oftheirown.Pharmacies installed systems to trackprescriptionsanddispensedmedicationwhilelaboratoriessetupsystemstotrackrequestsfortestsandtheirresults.

This led to dramatic improvement in productivity for these organizations but therewasno free flowof informationbetween theclinical systems.Theproblemwas lackofstandardization.Informationfromonesystemhadtobeunloadedtopaperandtransportedtowheretheothersystemwas.Thenahumanoperatorwouldreloadtheinformationtotheothersystembymanuallytypingitin.

Ofcourse thiswas theworsecasescenario. Improvementsweremade. Informationwasloadedonfloppydisksandelectronicallymovedtotheothersystem.Still,therewasno free flowof informationbetween systems.Thispreventedus from realizing the truepotentialofelectronicsystems.

ThensomeITvendorscameupwithasolution.Replacestand-alonesystemswithanintegratedproduct - anEHR (electronic health record). If you are familiarwithCerner,EpicorMeditechthenyouknowwhatIamtalkingabout.Alargesystemwithmodulesforeverydepartment.

Thiseliminated theneed forhealth information tocrosssystemboundaries.Withinthesystem,themoduleswoulduseastandardwayofstoringandsharinginformationandthiswouldallowtheinformationtoflowseamlesslywithintheorganization.

This approach worked well. EHRs have been very successful in eliminating theproblemofintegratingsystemswithinanorganizationandtheycontinuetobeoneofthe

Page 10: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

cornerstonesofthehealthcareITstructure.

But what about sharing information outside the organization? Healthcareorganizations don’t work in isolation. They need to share information with insurancecompaniesandsendpatientcareinformationtothegovernment.Theyhavetoconstantlycommunicatewiththeoutsideworld.

Touseourrailwayanalogy, thiswassimilar tothesituationwhereeachstatecouldset itsownstandardgauge.Youcould travel allovera statewithout theneed to switchtrainsbutwhenyouwantedtocrossthestateboundary,youwouldneedtodisembarkandgetonatrainthatranontheotherstate’sstandardgauge.

Clearly,EHRswereonlyalimitedsolution.

Therewasalsothequestionofwhattodowithexistingstandaloneclinicalsystems.Thesesystemswerebuiltovermanyyears throughsubstantialmonetary investment.Anorganizationwouldbeloathtoscrapallthatinvestment&hardworkandreplaceitwithanEHR.

Healthcare needed a better solution. It needed a standard gauge to connect theseEHRs, standalone systems, external systems and systems that were yet to be built. Itneededtomoveawayfromconstantlyloadingandunloadinginformation.

ThesolutionwasHL7.

Page 11: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

2.WhatisHL7?HL7 is an ANSI accredited, OSI level 7, application layer protocol for exchanging

clinicalandadministrativedatabetweenhealthcaresystems.

Chances are, if you arenot anetwork engineeror didnot studycomputer science,then“OSIlevel7,applicationlayerprotocol”probablymeansnothingtoyou.

Inlayterms,youcansaythatHL7isalanguagethatclinicalsystemsusetoexchangeinformationwitheachother.Buteventhatdoesn’ttellyouanything.WhenIwaslearningHL7,thedefinitionraiseditsownquestionsandleftmewithavaguesenseofunease.IttookafairbitofresearchtofigureoutwhatHL7is.

Soinsteadofleavingwithasenseofunease,whydon’twetakethetimeandfigureoutwhatHL7reallyis?

ApplicationLayerProtocolHL7isanapplicationlayerprotocol.Thismeansthatitdefinestherulesforexchanging

data(clinicalandadministrative)betweenapplications.

Weoftenusethewordsystemandapplicationinaninformalway,whichcloudsthedistinctionbetweenthetwo.Historicallyanapplicationwasthesameasasystem.Anoldaccounting system, with its hardware and printers and monitors had only one job orapplication–preparingandmaintainingfinancialrecords.

Thingschangedwhensystemsbecamemorepowerfulandstartedtakingonmultipleroles.Agreatexampleisyoursmartphone.It’snotjustaphoneanymore.Makingaphonecallisjustoneofthemanyfunctionsofthedevice.Ithasnumerous“apps”orapplicationsforallsortsofthings.

Similarly,moderncomputer systemsor servers runmultipleapplications, includingclinicalapplications.Whenapplicationscommunicatewitheachother,theyhavetodosothrough their system. Basically, applications create a message in a language that isunderstoodbytheircounterpartapplications–inourcaseHL7–andhanditovertotheirsystem for delivery. The system doesn’t understand the message. Its job is to reliablydeliverthemessagetothedestinationsystem.

HL7 is one such specialized application-to-application language/messaging rulebook/protocol–whateveryoucallit–forcommunicationbetweenclinicalapplications.

OSILevel7HL7 is also an OSI (Open System Interconnection) Level 7 protocol. This is just a

formalwayofsayingthatitisanapplicationlayerprotocol.

Now,wearegoing todiscussOSIand its levels and thatmeans splashing throughpacket based, network communication. If you are not interested in it, I would suggestskippingovertothenextchapter.

OSI is a referencemodel that networking guys use tomake sense of the networkcommunicationmodelandhowthingsreallyhappenatthebitandbytelevel.

Page 12: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

It is not difficult to understand the OSI model. The secret is proper backgroundknowledgeandanunderstandingofthekeyconcepts.Let’sseeifwecandothatinafewshortpageshere.

HistoricalBackgroundUsing electricity for communication started with SamuelMorse, the inventor of the

telegraph. He created a simple circuit with a battery, a bowl ofmercury and two longwiresgroundedatends.

If he dipped a wire in the bowl of mercury, it completed the circuit and currentflowedthroughit.Tosendashortburstofelectricity,hewoulddipthewireandpullitoutquickly.Thiswaslikesendingelectric“smokepuffs”totheotherend.

This basic ideawas refined into the telegraph andMorse code. The code had twoletters–adotandadash.Adotwasashortpuffofelectricityandadashwasalongerpuff(about3timesthedurationofadot).Dotsanddasheswerecombinedtorepresentlettersandvoila!Wehadelectroniccommunication.

SOS,theuniversaldistresssignal,owesitsorigintoMorsecode.InMorsecode,thepatternfortheletterSisthreedotsandfortheletterO,itisthreedashes-hencethefamiliarsoundofthreeshortbeeps,threelongbeepsand

threeshortbeepsforSOS.

Morse code evolved into Baudet code for Teletypes, which replaced the dots anddasheswithbits.Basically,insteadoflookingoutforpuffsofelectricity,systemscheckedifcurrentwasflowinginasliceoftime.Thissliceoftimewascalledabit.Eachbithadtwostates;eithercurrentwasflowingornotflowing.Theyused tocall themamarkingstateandaspacingstate.Todayweknowthemas1and0.

Thetimedurationofabitiscalledbittime.Tounderstandbittime,let’sassumeabittimeofonesecond.Ifelectricitywasflowingforonesecondthenthatmeansa1wassent.If theelectricitykept flowingduring thenext second then thatmeansanother1.But, iftherewasnoelectricityafterthefirstsecond,thenthatwasa0.Inreallife,bittimesareextremelysmall.Youcanpackmillionsofbitsinasecond.Thisisalsoknownasthebitrate(bitspersecond).

Thesuccessofelectroniccommunicationincreasedtheneedforcommunicationlinesfor transmission.Back in thedays, therewerevery few lines. Sodevices had to sharelinestotransmittheirbits.Theproblemwiththisapproachwasthatotherdeviceshadto

Page 13: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

waituntilthetransmittingdevicefinishedsendingitsmessage.

Togiveyouananalogy,considerwhenweonlyhad landlines.Peoplehadmultiplehandsetsinthehousebuttherewasjustoneline.Soifyourteenagedaughterwasonthephoneinherbedroomupstairs,youhadbettergetbusydoingwhateverelseyouhadtodo.Itwouldbealongtimebeforeitwasyourturntomakeacall.Devicesthathadtosharelineshadasimilarproblem.

PacketsThesolutionwastimesharing.Thelongstreamofbitsinamessagewasdividedinto

smallerpiecescalledpackets.Eachcomputeronthenetworkwasgivenitsshareoftime(say1/100thofasecond)onarotatingbasisandwhenitstimecame,itwouldtransmitasmany packets as it could. If all the packets were not sent in the allocated time, thecomputerwouldwaititsturntosendtheremainingpackets.Thiswaymultiplecomputerswere able to use the same transmission line without having to wait for an inordinateamountoftime.

Thismethod ofmessage transmission has been so successful that today almost allcommunicationisintheformofpackets,evenvoicecommunication.Ifyouhaveeverhada bad connection during a phone call, youmay have noticed a number of gaps in theconversation.Thosegapswerenothingbutmissingpackets.Theynevermadeitintime!

Foramessagetobesentaspacketsrequiresacoupleofthings.One,thepacketshavetobenumberedsequentially. If thepacketsarenotassembled in thesameorderas theywere sent, themessagewill becomegarbled.As a result, your thank you could end upbeforethehello.

Andsecond, inanetworkwithmanycomputers,eachpacketwillhave tohave theaddressofthedestinationcomputer.Otherwisewheredoesthepacketgetdelivered?

Thesedetails areattached toapacket in the formofaheader, asadditionalbits infrontofthepacket.

Page 14: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

When the packet reaches its destination, the headers are stripped and the data ispiecedtogetheronebyonetorebuildtheoriginalmessage.

EthernetThe Ethernet is the de-facto standard for connecting computers in a network. There

were others, SNA, AppleTalk etc. but they didn’t survive the Darwinian laws of freemarket.

TosetupanEthernet,youfirst laydown thecommunicationbackbone,which isasimple coaxial cable. The network is built by connecting individual devices to thisbackbone.Ifadevicewantstosendamessagetoanotherdevice(acomputer,printeretc.)on thenetwork, it transmits thepackets to thebackbone.Everydeviceconnected to thebackbonewillhearandreadtheheaderofthepacket.Ifthepacketisnotaddressedtoit,itwillbeignored.Onlythedevicewiththematchingaddresswillsavethepacket.

To assign a unique address to each device, an addressing system calledMAC ID(Media Access Control ID) has been developed. It is a six-byte number, which ispermanentlystampedoneveryNetworkInterfaceCard(partofthedevicethatconnectstothe network) by themanufacturer. That’swhy it is also called the hardware address orphysicaladdress.Youcannotchangeit.Itispermanentlyetchedinthechip.

Packets carry this MAC ID in their header. When a device receives a packet, itcomparestheMACIDofthepacketwithitsownMACID.Ifitmatches,itwillstorethepacket,otherwise, itwill ignoreit.Onceall thepacketsarereceived,thesystemstitchestogethertheoriginalmessageandsendsittotheapplicationforprocessing.

TCP/IPandtheInternetMACIDworksgreatforlocalnetworkswheretheadministratorknowsallthedevices

andtheiraddresses.Communicationbreaksdownwhenmessageshavetotravelbetweennetworks. How are you going to find out the MAC ID of a computer on a far awaynetwork?

Back in the days, for American armed forces, this was a serious problem. Army,NavyandAirForcenetworksdidn’thavethecapabilitytocommunicatewitheachother.Imaginetheconfusioninatheatreofwar!Butbelieveitornot,thiswasnottheprimaryreason for the inventionof the Internet. Itwasmuchmoremundane.Computer scienceresearcherswere looking for away to access supercomputers on other networks.TherewereonlyafewsupercomputersaroundandifyouwereinSanDiegoandwantedtousethesupercomputerat theUniversityofCalifornia,LosAngeles, thenyouronlyrecoursewastogetonI5anddrivetoLA.

Page 15: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

SotheresearchersatARPA(AdvancedResearchProjectsAgency)createdsomethingcalled TCP/IP and used it to successfully connect four research networks, three inCalifornia and one in Utah, to each other. This first network of networks was calledARPANET. Itwas the acorn that grew into themassiveoak treeweknow today as theInternet.

SohowdidthefolksatARPAdoit?

They created a system of virtual global addresses. Instead of using theMAC ID,whichisfixedandburnedonadevice,theydevelopedavirtualaddressingsystemoffournumberswhereeachnumbercanhaveavaluefrom0to255,forexample,125.0.200.75.Adevice was assigned a unique combination of these four numbers, which became itsglobal,uniqueIP(InternetProtocol)address.

IfyouarewonderinghoweachdeviceontheInternetgetsaglobaluniqueIPaddress,thenyoushouldknowthatthereisanentireorganizationalstructurededicatedtothetask.At the top is an organization called ICANN, based in LA, which does high-levelcoordinationanddecidesonbigthings,suchas,arewegoingtoallowthexxxdomain?UnderitarefiveregionalorganizationsthatmanagetheactualallocationandassignmentofIPnumbersfortheirregion.

The regional organizations are ARIN (North America), RIPE (Europe & MiddleEast), APNIC (Asia Pacific), LACNIC (Latin America & Caribbean) and AfriNIC(Africa).

If a networkwants to connect to the Internet, itmakes a request for a blockof IPnumbers to one of these organizations or their affiliates. Depending on the size of itsnetwork,itcangetoneofthreeclassesofIPaddresses:ClassA,ClassBorClassC.

ForalargecompanylikeAT&T,whichhasanetworkwithhundredsofthousandsofdevices and still needs room for more, a Class A block of addresses are assigned, forexample,12.x.x.x.AllpacketsstartingwiththeIPaddress12willgotoAT&T’snetwork,everythingfrom12.0.0.0to12.255.255.255.That’salmostseventeenmillionaddresses!

But if AT&T were smaller, it would receive a Class B block of addresses, forexample, 12.200.x.x. In this case, all IP addresses from 12.200.0.0 to 12.200.255.255wouldbelongtotheAT&Tnetwork.

ForClassCaddresses,thefirstthreenumbersarefixed,forexample12.200.50.x.AllIPaddressesbetween12.200.50.0and12.200.50.255belongtothenetwork.

Onceanetworkhas its listof IPaddresses, it creates anARP (AddressResolutionProtocol)table.AnARPtableisnothingbutalonglistofphysicaladdresses(MACID)ofallthedevicesonthenetworkandtheircorrespondingIPaddresses.WiththehelpofthisARP table, the network can easily translate the IP address of an incomingpacket to itscorrespondingMACIDandviceversa.

ThissetupdevisedbyARPAfreed thenetworks fromthe requirementofhaving toknoweachother’sMACIDs.Foradevicethatwantedtocommunicatewiththerestoftheworld,allithadtodowasshareitsIPaddress.WhenthelocalnetworkreceivedapacketwiththisIPaddress,itwouldusetheARPtabletofindouttheMACIDofthedeviceandattachittotheheaderofthepacketbeforereleasingitonitsnetwork.

Page 16: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Ifyouarethinkingwhydidn’ttheyjustusetheMACIDforaddresses,keepinmindthattherewerealreadymillionsofdevicesoutintheworldbeforetheystartedworkingonthe problem. Cataloguing existing ID’s and coordinating betweenmanufacturers wouldhavebeenanightmare.Itwaseasiertojuststartoverwithacleanslate.

Tousethisvirtualaddress,whenapacketisfirstcreated,aheaderwiththeIPaddressof the destination is attached to it. After that, another headerwith theMAC ID of thedestinationisaddedandthenthepacketisreleasedontheEthernetfortransmissiontothedestinationsystem.

IfthedestinationisonthesamenetworkthenthereisnoneedfortheIPaddress.ThedevicewiththematchingMACIDpicksupthepacketandstripawayboththephysicaladdress(MACID)andthevirtualaddress(IP)headersofthepackettoget totheactualcontent.

Thingsaredifferentwhenthemessageisforadevicethatisnotonthelocalnetwork.

AfterapacketiscreatedanddestinationIPheaderattached,thelocalsystemlooksuptheARPtabletogetthecorrespondingMACIDofthedestination.If thedeviceisonadifferentnetwork,thentherewillbenoentryforitintheARPtable.

In that case, the physical address of a special device called a router is used. Thepacket is sent to the router on the network. The router reads the IP address of thedestinationandconsultsanothertablecalledtheForwardingTable,todeterminewheretosendthepacketontheInternet.

Forwarding tables are similar toARP tables but instead of the physical address oflocal devices, they contain addressesof routers andgateways for other networks. If thedestinationnetworkisknownthenthepacketissentdirectlytoit,otherwiseitgetssenttothe gateway,which is like a central post office. From there it gets bounced around theworld,basedonahostoffactors,tillitreachesitsdestinationnetwork.

The router at the destination network uses the IP address of the packet to find thecorrespondingphysicaladdressinitsARPtable.It thenaddsthecorrespondingphysicaladdress header to the packet and releases it on its local network,where the destinationdevicewithmatchingMACIDpicksitupforprocessing.

ThisishowARPAwasabletoconnectdifferentnetworksandusherintheInternetage.

LayersIf you noticed, with Internet there were two headers added to every packet, which

allowed it to travel between networks.Onewas the virtual address header (IP) and thesecondwas the physical address header (MAC ID). In techie speak, the packets passedthroughtwolayerswheretheseheaderswereadded.Layerscanbeseenasprocessstepsthattransformapacket.

Page 17: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Ifyourecallthediscussionatthebeginningofthechapter,communicationbetweentwoapplicationsisindependentoftheunderlyingsystem.Thesystemdoesnotunderstandthemessage. It only facilitates themovement ofmessages from one application to theother.

Butthissystemlevelfacilitationisnotjusttakingamessage,choppingitintopacketsandpassingthemdownthewiretotheothersystem.Thereismoretoitandwesawsomeofthat.Thepacketshadtwoaddressheadersattachedtothem.Intherealworldtherearemanyotherthingsthatcanhappentoapacketbeforeitissentdownthewire.

Forexample,amessagecanbecompressedbefore it is sentor it canbeencryptedbeforeitistransmitted.

Forabetterunderstandingofthemessagetransformationprocesslet’scompareittoanautomobileassembly line.Beforeacar rollsoff theassembly line, its chassispassesthroughanumberofworkstationsor stops.Ateachstop, itundergoesa transformation.Firstthechassisiswelded,thenthepaintjobisdone,thenthedashboardisputinplace,theseatsareassembled,andsoon.

Similarly,beforeamessageistransmitteddownthewire,itpassesthroughanumberofstopsorwhattechnicalfolksliketocalllayers.Ateachlayerthemessageundergoesatransformation.

Veryoften therearemultiplewaysof transformation.At theweldingstop,youcanchoose between gaswelding or arcwelding or even laserwelding for something reallyprecise.Similarly, there aredifferentmethods for transformingamessageat each layer.Technicalfolkslikecallingthemprotocols.

Theseare the fundamental concepts innetworkcommunication.Packets that travelontheInternettodaygothroughmanylayersthatimplementallkindsoffunctionality.Ateach layer, there could be many different protocols to bring about the desiredtransformation.

To take an example, the researchers at ARPA also wanted to make sure that if apacketwaslostduringtransmission,therewasaprocesstoresendit.Toachievethis,theyaddedanotherlayerbeforethevirtualaddresslayertoensureguaranteeddeliveryofeachpacket.

This new layer was the transport layer. It added another header with a tracking

Page 18: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

numbertothepacket.Whenthedestinationsystemreceivedthepacket,itwasrequiredtosendbackashortacknowledgementwiththeoriginaltrackingnumberofthepacket.

Thiswaythesourcesystemwasable tofigureoutwhichpacketswerereceivedbythe destination. If a packet was lost, there would be no acknowledgement for it. Afterwaitingforacoupleofsecondsthesourcesystemwouldautomaticallyresendthatpacket.

But not every application wanted guaranteed delivery of packets. For someapplications, packets have to be delivered in real time. Think of video conferencing orstreaming radio. If a packet is lost, it’s lost. For these applications, techies developed adifferentprotocol,calledUDP,whichonlycaredaboutsendingthepacketsinsequence,inrealtime.Ifapacketdidn’tarriveontime,toobad,thatwillbeablip,wearemovingtothenextpacket.

Eventually,thisledtoaproliferationofprotocols.TherewereprotocolsforInternetchat,protocols forpeer-to-peer file sharing,protocols for Internet telephonyandonandon. Peoplewere building all kinds of crazy things and someone needed to step in andbringordertothesituation.

OpenSystemsInterconnection(OSI)ModelThe anarchy with the protocols prompted the international standards setting

organization to try andbring someorder to the chaos.Academicshuddled together andcame upwith a clean, seven level framework for network communication calledOpenSystemsInterconnection(OSI).Itdividedtheprocessofsendingandreceivingmessagesintosevenlevels(steps)anddefinedwhichactionscanbeperformedateachlevel.

Level7 -ApplicationLayer:At this layer,data tobe sent isorganized inamessageaccordingtothestructureandrulesoftheapplicationprotocol.(e.g.HL7)

Level6 -PresentationLayer:At this layer,work like encryptionand compressionofdataiscarriedout.Largefileslikevideoandimageusethislayer.

Level 5 - Session Layer: At this layer, functionality can be added to maintain anongoing conversation without having to confirm the identity of the system for everymessage.Otherfunctionalitieslikevoiceandvideosynchronizationcanalsobeadded.

Level 4 - Transport Layer: This is the layer where the sending system divides themessage into packets and the receiving system reassembles them. Tracking andacknowledgementofpacketsisalsodoneatthislevel.AcommonlyusedprotocolforthislayerisTCP.

Level3 -NetworkLayer:At this layer,avirtualaddress (IP) isadded to thepacket.TheIPprotocolisforthislayer.

Page 19: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Level2-DataLinkLayer:Thisisthelayerwhereaphysicaladdressisaddedtothepacket.ThisiswheretheMACIDisadded.

Level1-PhysicalLayer:This layer transmits the0sand1sof thepacketaselectricpulsesdownthewire.Forcellphonesthesignaltravelsasmicrowavesandforfiberopticcablesitisapulseoflight.

Themessagingprocessstartswiththeapplicationlayerorlevel7oftheOSImodel.Afterthetransformation,themessageispassedtolevel6,whichdoesitstransformationandpassesit furtherdownthelevelsuntil themessagereacheslevel1.At thispoint thepacketgetsconvertedto0’sand1’sandistransmitteddownthewire.

Atthereceivingend,thepacketundergoesareversetransformation.Itstartsatlevel1andmovestoupperlevelsuntilitreacheslevel7.Atthatpoint,themessageishandedtothereceivingapplication,whichprocessesandconsumesthemessage.

By creating this seven-level model of network communication, the standardscommitteeexpectedeveryonetoadoptOSIandestablishitasthestandard.Unfortunately,that’snothowitturnedoutinreallife.

By the time OSI was developed, TCP (for guaranteed delivery) and IP (virtualaddressesforcommunicationonInternet)werewellentrenchedinthenetworkingworld.Together the TCP/IP combo was sufficient to ensure transmission of packets over theInternet. As a result, organizations just added layers for application-to-applicationcommunication and other features as needed, and didn’t bother conforming to theOSImodel.

Still, OSI has survived as a good reference model for understanding networkcommunication.Manyprotocolshavebeendevelopedandcontinuetobedevelopedwhich

Page 20: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

implementthefunctionalitiesofaspecificlevel.Theprotocolcanjustsaythatitconformsto a particular level of the OSI model and everyone will know the functionality itimplements.

HealthLevel7(HL7)Health Level 7 is one such specialized protocol that conforms to level 7 of theOSI

model.Itisanapplicationlayerprotocol,specificallycreatedforcommunicationbetweenhealthcare applications. Sowhenever there is a need to exchange health data betweenapplications,guesswhichprotocolisgoingtobeused?HL7ofcourse!

Accepted,thenameHealthLevel7isnotexactlyafriendlyname.Butifyoulookatit from theperspectiveof thepeoplewhodeveloped it, youcan seewhy theynamed itHealthLevel7.Itisanapplicationlayerprotocol,whichcorrespondstolevel7oftheOSImodel.Andtheprotocolisfortheexchangeofhealthinformation,hencethename,HealthLevel7.Iwouldarguethatthenamemakesalotofsense.

HL7conformstotheOSImodelbutitonlydefinestheprotocolforseventhlevel.Forother levels, the implementer is free to choose any comboof protocols.UsuallyMLLP(Minimum Lower Layer Protocol) with TCP/IP is used to implement lower levelfunctionalities.

Page 21: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

3.IntegrationConceptsFromatechnicalperspective,thewordintegrationmeanstoconnectdifferentsystems

(andapplications)together.Whensystemsareintegrated,theycancommunicatewitheachotherandexchangeinformation.

Thisautomaticflowofinformationisthereasonweintegratesystems.Becausewhensystemsareabletoshareinformation,itleadstoalotofbenefits.Onesuchveryimportantbenefitismaintenanceofdataconsistencybetweendifferentsystems.Letmeelaborate.

Abig issuewith isolatedsystemsiscreationofdatasilos.Overaperiodof time,asystem will accumulate a mountain of clinical information in its database. But thatdatabase is only for its exclusive use. The information is locked away. This limits theusefulnessofthedata.Others,whoneedthatdata,havetocopyitandmaintainaseparatedatabase. Over time, the data becomes inconsistent in the copies, and this leads tounwantedheadache.

Consider a stand-alone lab system that keeps a perfect record of tests ordered andtheir corresponding results. Since the information is locked away in the lab system, aphysicianwho needs that informationwill receive a print out of the result. That paperresultwilleventuallygetfiledawayinthatpatient’sfolderforfuturereference.

So far so good. Both the lab system and the doctor’s office have the sameinformation.Butwhathappensifthereisacorrectiontothelabtest?Thelabsystemwillupdateitsdatabaseandalsosendapapercopytothedoctor’soffice.Whathappensifastaffmemberforgetstofileitorthereportismisplacedorendsupsomewhereelse?

Thepointis,thereareendlesswaysfordatatobecomeinconsistentbetweensystems.Anintegratedsystemavoidsthissituationbyautomaticallyexchanginginformationwithother systems whenever there is new data to be shared or an existing data elementchanges.

Anotherbenefitofintegrationistheabilitytoautomatebusinessprocesses.Systemsdon’tjusthavetotalkone-on-one.Theycanalsobepartofaninformationassemblylinewhereonesystemtakestheorder,anotherchecksthevalidityof thecreditcard,andyetanothercoordinatesshipmentoftheorder.Integrationallowsforautomaticmovementofrelevant information from one system to the next and this makes business processautomationverysimple.

HL7andthehealthcareindustryarelatetothegameofbusinessprocessautomation.ThegranddaddyprotocolisEDI(ElectronicDataInterchange),whichisoneoftheoldestand most widely used standard for data integration. It is now primarily used by theretail/manufacturingindustry.Banksandotherfinancialorganizationshaveastandardoftheirown,calledSWIFT,whichtakesintoaccounttheirneedforultra-highaccuracyandsecurity.

Andfinally, theabilitytointegratesystemsgivesusabettermethodtocreatelargeaggregatesystemswithouthavingtoworryaboutthedoomsdayscenario-thedaywhenalarge, monolithic system crashes down. By stringing together smaller, independentsystems through message-based integration, we can isolate them from each other and

Page 22: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

minimize the impact a particular system can have on the entire ecosystem. To use ourexamplefrombefore,iftheorderdeliverysystemgoesdown,itwilldelayordershipmentbut the organization is still open for business and accepting orders - probably with awarningthatshipmentscouldbedelayed.

SynchronousandAsynchronousCommunicationThere canbe two typesof communicationbetween integrated systems - synchronous

andasynchronous.

Synchronouscommunication takesplace just likeaconversation. Ithappens inrealtimeanduses therequest/responsemodel.Onesystemwillaskaquestionand theothersystemwillrespondwithananswer.Itislikemakingaphonecall.Youpickupthephone,dialthenumber,andsayhello.Thenyouwaitfortheotherendtorespond.

Asynchronous communication ismore like a textmessage.You type and send themessageandgetonwithwhateverelseyouweredoing.Youarenotwaitingfortheotherperson to respond.This isabetterandmoreefficientway todealwithsituationswherehavingtheinformationimmediatelyisnotnecessary.

Imagine a person showing up at the registration desk of a hospital. He has beenfeelingatinglingsensationinhisfeetthatkeepscomingbackandhewouldliketoseeadoctor. The registration clerk asks for the man’s information, including his insuranceinformation,andcreatesapatient record.Thenext step is confirmationwith the insurerbefore anappointment is scheduledwith thedoctor.This step is aperfect candidate forusing synchronous communication to integrate the hospital system with the insurancecompany’s system. It is necessary for the hospital system to confirm insurance detailsbeforeanappointmentisscheduled.

Well, finally the man gets to see the doctor. It could be nothing. But the doctornoticesthatheisoverweight.Healsohashighbloodpressure,andthereareblistersonhisfeet.ThisgetsthedoctorconcernedandsheordersabloodtestforsugarlevelandA1Ctocheckifthepatienthasdiabetes.

Here the synchronous communicationmethod to integrate thehospital systemwiththelabsystemwillnotwork.Bloodhastobedrawn,labeled,andshippedtothelab.Thiswill take time.Theordercanbesentelectronically immediatelybutneither thehospitalsystemnor the labsystemwill,orshould,keepwaitingtill the test resultsareavailable.Thisiswhereasynchronouscommunicationisusedtointegratesystems.

ConnectionHowsystemsarephysicallyconnectedisanotherimportanttopicinintegration.Ifthere

areonlytwosystems, thenthere isnoissue.Youcanconnect themdirectly-pointAtopointB.Thisisapoint-to-pointconnection.

Page 23: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

A point-to-point connection works fine as long as the number of systems to beconnected is low. And by low, we mean two or three. Anything higher and it startsbecomingaseriousissue.How?Readon.

Forasystemtobeabletosendmessagestoeveryothersystemonthenetwork,ithastohaveaconnectiontoeveryothersystem.Toconnecttwosystems,weonlyneedasingleconnection between them. With three systems (A, B, and C), we will need threeconnections-AtoB,BtoC,andCtoA.

For four systems, the number of connection jumps to six. For five it is ten, sixsystemsrequirefifteenconnectionsand…tensystemsrequireforty-fiveconnections!

Ididnothavetomanuallycountthenumberofconnectionsfortensystemsbecausethereisamathematicalformulaforit.Numberofconnections=[(n/2)*(n-1)]wherenisthe number of systems. No matter how much you hate them, formulas have theirusefulness.

Youcanseehowthisproblemseriouslylimitsthenumberofsystemswecanhaveinanetwork.

Well, itwasnot the first timewe faced thisproblem.Transportation systems facedthis issue long before computers and they solved itwith the help of the hub-and-spokemodel.

DeltaAirlinespioneered thehub-and-spokemodelback in the1950s.TheirmergerwithChicago andSouthernAirlinesmeant they had to create a network that integratedmanymorecities.TheydidthisbycomingupwiththeideaofanairlinehubinAtlanta.OnesetofplaneswouldferrypassengerstoAtlantaandanother tothefinaldestination.Today, almost all airlines operate on this model, although, there are exceptions like

Page 24: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

SouthWestAirlines,whichonlyfliespoint-to-point.

The company that really turned this model into an art was FedEx. To guaranteeovernightpackagedelivery,notonlybetweenSanFranciscoandNewYorkCitybutalsobetweenAlbanyandElPaso,theysetupacentralclearinghouseinMemphis(theirhub)andimplementedthehubandspokemodelforovernightpackagedelivery.

All overnight packages are flown from various destinations to Memphis whereincoming packages are sorted with the help of a high-tech conveyor belt system. Thesorting is donewithin a four-hourwindow according to the destination location and at2:50AM,thefirstplaneleavesMemphisforitsdestination.Forthenexthour(probablylongernow)aplanetakesoffeveryminutetoanotherdestination.Iwouldlovetowatchthissymphonyofmodernage.Someday,maybe.

The hub-and-spoke model solved the problem of exponentially increasingconnections incomputersystemsbyusingahub in thenetwork. IfAwanted tosendamessagetoZ,itsentthatmessagetothehub,whichinturnpasseditontoZ.Thisway,thenumberofconnectionswasequaltothenumberofsystems.Inotherwords,toconnecttensystems,weonlyneededtenconnections.

Publish-SubscribeModelUsing a hub to connect systems has other advantages. One such advantage is

optimizationofmessagegenerationfromthesourcesystemtothedestination.

Consider the casewhere systemAhas to sendmessages to systemsBandZ.OneoptionisthatsystemAcreatestwoidenticalcopiesofeachmessageandsendsonetoBandtheotheronetoZ.Underadifferentapproach,systemAcreatesonlyonemessageandsendsittothehub.OthersystemsthatwanttoreceivemessagesfromAletthehubknowthat.

So,whenthehubreceivesamessagefromA,itchecksitsinstructionsandnotesthatsystems B and Z want to receive messages from A. It then creates two copies of themessageandsendsthemtoboththedestinationsystems.

This is the publish-subscribe model of message routing. It not only reduces thenumberofmessagesandtrafficonthenetwork,italsofreesupsendingsystems(likeA)fromhavingtokeeptrackofwhowantstoreceivewhat.Thisbecomesthejobofthehub.

Thehub isvery important in integration.Youmusthavecomeacrosssoftware likeeGate, BizTalk, or Rhapsody. They are a class of software products called integrationengines.Attheirheart,theseproductsarehubswhichroutemessagesbetweensystemson

Page 25: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

thenetwork.

MessageTriggersMessagetriggersarereal-lifeeventsthattriggergenerationofamessagebyasystem.

Therearetwosituations.

One,itcanbeaservicerequest.Thisistherequest/responsemodelwediscussedinthe section on synchronous communication. For example, a doctor’s office makes aservice request to the lab system for an old test result.The lab system respondswith amessagethatcontainsdetailsoftheoldtestresult.

Thesecondsituationiseventnotification.Herearealworldeventtriggersautomaticgenerationofamessage.Forexample,thelabsystemwillgenerateanevent-notificationmessagewhentheresultofanewtestbecomesavailable.Orderingsystemsdon’thavetokeepaskingiftheresultisavailable.

ScopeofHL7Systemintegrationisavasttopic.HL7onlyoccupiesasmallnicheinhealthcaresystem

integrationandexchangeofhealthcaredata.

Even within healthcare system integration, HL7 doesn’t set the standard foreverything. If you divide it broadly, there are three standards that are required forintegration:amessage-transferstandard(howamessagewillbesent),amessage-formatstandard(whatamessagewilllooklike),andadatastandard(howhealthcareinformationwillbeorganizedinamessage).

WesawinthelastchapterhowtheInternetandTCP/IPprotocolcanbeusedtosendmessages between applications. HL7 does not reinvent the wheel. It leaves message-transfer standard to implementers. They can either use the Internet and TCP/IP or adedicatednetworkandtheirowncustomprotocol.HL7doesn’tcare.

What HL7 does care about and defines standards for, are the message-formatstandardsanddatastandards.

MessageFormatStandardThemessage-format standarddefines the structureof amessage so that the receiving

systemcanmakesenseofitscontent.Ifthedataisnotorganizedinastandardwaythenthesystemwon’tknowwhere to lookfor it in themessage. In thatcase,alongwith themessage, thesendingsystemwillalsohavetosendinformationaboutwhere to lookfordataandwhateachvaluemeans.Thatwillbeaveryinefficientwayofcommunicating.

Ifthesameweretrueinoureverydaylife,theneveryspeedlimitsignonthehighwaywill have tobe a largedescriptiveboard. Thiswill be requiredbecause insteadof justsaying “Max 100 km/hr.”, it will have to say, “The vehicle you are operating on thisstretchofthehighwayisnotallowedtoexceedthespeedlimitof100kmperhour.Thisisagainstthelawandifyouarecaughtyouwillbepenalized.”

The point is, with a standard message format, you can have a short, to-the-pointmessage,whichisunderstoodbyeveryone.

Page 26: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

By defining a standard-message format, HL7 allows clinical systems to exchangeshortmessageswithoutthemhavingtograpplewithexplainingthemeaningofeachfield,everytimetheysendamessage.

DataStandardDatastandardsdealwithhow information is represented inamessage. Itmight seem

likeasimplethingbutrealtragedieshaveoccurredbecausewemixedupthemeasuringunit(rememberMarsorbiter?).Bydefiningacomprehensivedatastandard,HL7ensuresthatthereisnoambiguityintheinformationthatissharedbetweensystems.

Toillustrate,let’sconsiderthesimpleexampleofthepatientnamefield.Ahospitalsystemstoresapatient’snameinthreedifferentfields:firstname,middlenameandlastname. In contrast, a lab system stores the patient’s name in just one field with spacebetweeneachpartofthename.

These two systems cannot be integrated unless they agree on a common datastandard.Ifthehospitalsendsthepatient’snameasis,thelabsystemwillneedanextralayerofsoftwaretostitchthenamefieldstogetherandthensaveittoitsdatabase.Andapatient’snameisjustonefield.Therecouldbethirtyorfortyfieldsinamessage.Canyouimagine the enormity of work involved in reconciling those fields? It would be anightmare.

HL7 solves the problem by defining standard data format. If two systemswant tointegrate, thenbothof themwillhave touse theHL7datastandardformessaging.Thiswaytherewillbenoambiguitywithfieldcontentandtherewillbenoneedtoundergothelaboriousprocessofreconcilingfieldseverytimetwosystemsareintegrated.

Page 27: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

4.EvolutionofHL7Weliveinaworldofstandards.Asnewtechnologiesemerge,anecessaryconditionfor

their wide adoption is standardization.We notice it when there is a problem with thestandard.Asmustbeevidenttoanyoneinaforeigncountrynotabletopluginalaptopbecausethepoweroutletisdifferent.

Standards emerge from different sources. A standard could be imposed by thegovernment,aswasthecasewiththeconversionfromtheimperialtothemetricsystemofmeasurement. Both the USA and Canada started the conversion but in the States, thegovernmentdefundedtheMetricBoard,stallingtheirconversion.InCanadahowever,theconversion was completed and we started measuring distance in kilometers andtemperatureinCelsius.

Anothersourceofstandardistheindustryitself.Companiesattheforefrontofanewtechnologyvieforcompetitiveadvantagebypromotingadoptionoftheirtechnology.Wehaveallheardabout the famousvideotape standardsbattlebetweenBetamaxandVHS.Sony’sBetamaxwas a superior technologybutVHSbecame the standardbecause JVCwasrelentlessinpromotingittoelectronicsmanufacturers.

Athirdsourceofstandardismarketforces,whichleadstoade-factostandard.Thiswas the case with TCP/IP. It became the dominant, and ultimately standard, network-communicationprotocolasaresultofgradualadoptionbyuniversitiesandbusinesses.Bythe time the ISO model was developed, it was too late for a switchover. TCP/IP wasalreadybakedin.

And finally, there is the deliberate approach where experts get together with thespecificintentofcreatingastandard.ThisishowtheHL7standardcameintobeing.

DevelopmentofHL7The story of HL7 started in 1987. An international group of experts got together to

workontheproblemandcreatedarudimentaryversionofwhatweknowtodayasHL7.Ithadmanygapsandwasnotdetailedenoughforpracticaluse,butitgottheballrolling.

Adedicated,notforprofitorganizationcalledHealthLevelSevenInternationalwasfoundedtomanageongoingdevelopmentofthestandard.

The organization is completely volunteer driven. It draws its members fromhealthcare providers, vendors, consultants, government groups and others who have aninterestinthedevelopmentofstandards.

Withinacoupleofyearsofitsformation,ithadthefirstusableversionofHL7(v2.1)ready,whichwasreleasedin1990.Thiswasfollowedbyarevisedversion(v2.2)in1994.

Industry adoption ofHL7was not very successful initially, but the user base keptgrowing slowly. The turning point came in 1997when version 2.3was released. ThisversionwasANSIapprovedwhichsignaled to the industry that thestandardwasrobustandmature.

ANSIapprovalwaslikeashotinthearmforHL7.Adoptionacceleratedandpickedupfurtherpacewiththereleaseofversion2.3.1in1999.Thisledtomuchbroadermarket

Page 28: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

recognition,widerindustryadoption,andeventuallytothecurrentstatusasthedominantindustrystandardfortheexchangeofclinicalandadministrativehealthinformation.

ANSI(AmericanNationalStandardsInstitute)ANSI is a private, not-for-profit organization in the United States, which facilitates,

coordinates and oversees standards development activities.ANSI itself doesn’t developanystandard,itonlydefinesguidelinesandaprocessforstandarddevelopment.Ifanotherorganization,likeHL7,followstheguidelinesandprocesstodevelopitsstandardthenitgetsANSIapproval.

TheANSIprocessisaconsensus-drivenstandarddevelopmentprocess.Theideaistoensurethatnosinglepartydominatesandeveryinterestedpartyhasanopportunitytovoice its opinion. It also requires standard development to be conducted in an openenvironmentunderpublicscrutiny.

ANSI approval is granted for five yearswith an additional five years extension ifrequested.At theendof theapprovalperiod, thestandard is reviewed todetermine if itshouldbereapproved,revised,orwithdrawn.

HL7OrganizationalStructureA board of directors, composed of elected and appointed members, oversees the

developmentofHL7standard.Theorganizationalsohasnumeroustechnicalcommitteesand special interest groups (SIG), made entirely of volunteers. They are the ones whodevelopandrevise thestandards.EachtechnicalcommitteeorSIGhas twoormoreco-chairswhomanage theworkwithin the group. Together, co-chairs from all the groupsformtheTechnicalSteeringCommittee,which is theclearinghouse fornewandrevisedstandards.OncetheTechnicalSteeringCommitteevotesandagreestoanewstandard,itissenttotheboardofdirectors,whichmakesthefinaldecisiononreleasingthestandardtogeneralaudience.

AnyonecanvolunteerandgetinvolvedinthedevelopmentofHL7standards.AlloneneedstodoisbecomeamemberofHL7.orgoritsaffiliate(ifoutsidetheUSA)andthenregisterwithoneoftheactiveworkgroups.

VersionsofHL7SincethereleaseofthefirstversionofHL7in1987,theorganizationhasmaderegular

revisionsofthestandard.

With each new version, the standard has been improved by adding new rules,modifyingexistingrules,orbyfindingsolutionstoissuesraisedbytheimplementers.Ithasalsobeennecessarytoensurethateachnewversionisbackwardcompatible.Inotherwords, a new version is able to communicatewith systems using older versions of thestandard.

Backwardcompatibilityaddsalotoflegacyburdenandmakesitmuchmoredifficultto improve a standard.We sawwhat aquirky task it iswith the releaseofWindows8.Users ofWindows operating system were used to the start button to run applications.WhenWindows 8 came outwith a revamped user interfacewhere instead of using thestartbutton,userswerepresentedwith tiles to run theapplications,allhellbroke loose.

Page 29: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Microsoft had to quickly release version8.1 andbringback the start button to keep itscustomerbasehappy.

Similarly,HL7hashad toensure thatwitheachnewversion, theoldstructureandformatisnotdisturbed.Version2.1ofHL7wasthefirstimplementableversionandsinceits release therehasbeeneight revisionsof the standard:v2.2,v2.3,v2.3.1,v2.4,v.2.5,v2.5.1,v2.6 andv2.7.Of these,HL7v2.3andv2.3.1 are themostwidely implementedversions.TheyaccountforoverthreequartersofallHL7messages.

Allversionsarecompatiblewitheachother.Ifanolder-versionmessageissenttoasystemusinganewversion,thesystemwillstillbeabletoreadthemessage.Similarly,asystemcompatiblewithanolderversionwillbeabletoreadanewerversionmessagebyignoringadditionalfeaturespresentinthemessage.

But there are serious problems with this approach. To maintain backwardcompatibility,HL7hashadtoleavemanyattributesoptionalandallowalotofroomforcustomization.This has prompted some to even callHL7 a non-standard standard.Theproblem is that you cannot just send an HL7message to any system. Every time twosystems need to communicate, a unique HL7 interface has to be created with all theoptionsandcustomizationinvolved.

HL7Version3Toaddresstheseissues,itbecamenecessarytobreakfromthepastandbuildastandard

fromthegroundup.TheresultisHL7v3.0,whichwasfirstreleasedin2005.TheversionnumbernolongerchangeswiththisnewformofHL7,butitisrevisedannually.HL7v3.0existsalongsideHL7v2.xbuttheyarenotcompatible.Incompatibilitybetweenv2.xandv3.0means that systems implementing v3.0 interfaceswill not be able to communicatewithsystemsimplementingv2.xmessages.Althoughnotimpossible,ittakesconsiderabletimeandefforttoconvertv2.xmessagestov3.0andbecauseofthat,theadoptionofv3.0isstillverylow.

HL7 v3.0 is being implemented in places where there are little or no existingsystems.GovernmentsinEuropehaveusedv3.0tocreatenewhealthcarenetworks,andinCanada, v3.0 adoption is being driven by the federal and provincial governments’initiativetocreatedrug-informationnetworksandregistriesofhealthcareproviders.IntheUnitedStates,theCDChasimplementedsomenetworkswithv3.0messaging,butoveralltheadoptionremainslow.

Giventhewidespreadadoptionofv2.xanditsincompatibilitywithv3.0,itwillbealongtimebeforev3.0replacesitasthedominantstandard.Andeventhen,v2.xwillexistlong into thefuture. If itain’tbroken,organizationsarenotgoing to fix it.Myfirst jobwas production support of an S/390 IBMmainframe. Its software code was written inCOBOLinthe60’s.Nooneisgoingtoreplacethatcodeaslongasitdoesitsjob.

OtherHealthcareStandardsPeopleworking inhealthcareITknowthatHL7isnot theonlystandard theyhave to

dealwith.X12,SNOMED,ICD-9/10,DICOM,therearealotofstandardsvyingfortheirattention.

Page 30: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Generallyspeaking,moststandardshavebeendevelopedforaparticularhealthcarearea such asmedical imagingor insurance or for somekindof classification.AlthoughHL7’sarea isclinicalandadministrativedata, itcanhandle themessagingrequirements(internalandexternal)ofanentireorganization.Thisdistinguishesitfromotherstandards,whichareprimarilyfocusedontheneedsofaparticulararea.

TaketheexampleofDICOM(DigitalImagingandCommunicationsinMedicine).Itis thestandardusedbyPACSandother imagingsystems to transmit, retrieve,andstoremedical images.ButDICOMcanonlybeusedbetween imaging systems. If adifferentsystemneedsanimage,itwillhavetobetranslatedorembeddedwithinanHL7message.

Similarly, the X12N standard is used only for transmitting patient insurance andfinancialdatatotheinsurancecompany.Ifadditionalpatientinformationhastobesent,anHL7 message containing the information will have to be embedded within the X12Nmessage.

Then there are standards just for classification, which have nothing to do withmessaging.

ICD-9/10(InternationalClassificationofDiseases)isastandardthatcliniciansusetoclassify diseases, injuries and causes of death.Revision 10 is themost current version,whichalsoincludescodesforclassifyinghealth-riskfactors(occupational,environmental,lifestyleetc.).ICDcodesareregularlysentasdataelementsinHL7messages.

LOINC (Logical Observation Identifier Names and Codes) is a standard forclassifyinglabordersandtests.Inthissystem,everypossiblelabtesthasaunique,threetosevendigitIDnumber.AnHL7ordermessagewillonlyneedtohavethisuniqueIDinits “ordered test” field for the receiving system to know which test has been ordered.Similarly,whentheresultissentback,LOINCcodesareusedtospecifythetestthattheresultisfor.

LOINChasmorethanseventythousandcodes.Eachcodecorrespondstoadifferentkindoflabtest.Forexample,thereisatestcalledSerumSodiumorBloodSodiumLevelorSodium-Blood,dependingonwhoyouaretalkingto.ItsLOINCcodeis2951-2.Whenthiscodeissentinanordermessage,thereceivingsystemknowsexactlythatthetestistomeasuretheconcentrationofsaltintheblood.Itisunambiguousanddoesawaywiththeconfusionofdifferentnames.Ifyouhavehadalotofsaltyfood,yourreadingfor2951-2willbenorthof140.(Thenormalrangeis135–145).

Then there is SNOMED-CT (Systematized Nomenclature of Medicine-ClinicalTerminology), which is like a thesaurus for medical terms, diseases, anatomy andprocedures. It uses ConceptID and DescriptionID to define codes, synonyms, anddescriptions of medical terms. For example, myocardial infarction is a concept(ConceptID 22298006), which refers to infraction (death of tissue) in the myocardium(muscularwalloftheheart).

Page 31: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

These standards take you deep into the clinical world. If you not queasy aboutsyringesandscalpelsandstitchesthenkeepwandering.FormethismuchinformationwasmorethanenoughandIneverhadanyissueswiththesestandards.Aslongasyouhavearough ideawhat the content of a field represents, therewon’t be any problemworkingwiththesestandards.

ThisbringsustotheendofpartI.Wehavecoveredthebackgroundinformationandnow it’s time to lookat the standard itself.Even ifyouonly read thenext twoor threechapters,itwillgiveyouafairlygoodideaofthestandard.

Page 32: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

PARTIIDiggingDeeper

Page 33: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

5.BasicConceptsSonowyouunderstandthatHL7isanapplicationlayer(level7)protocolthatclinical

systems use for sharing information. Also, because of a lot of optional elements andcustomization, HL7 is almost a non-standard standard. We can’t just send any HL7messagetoasystemandexpectittounderstandthemessage.

When twoormore systems are integrated, theyhave to first agreeon the typesofmessages that will be exchanged and triggers events that will be supported. All thisinformation(andmore)isthendocumentedinanInterfaceSpecificationdocumentbeforeactualworkbeginstointegratethesystems.

IfyouhaveanenvironmentwhereHL7messagesareused,thenallthisinformationonmessagetype,triggerevents,acknowledgementetc.istheresomewhereintheformofoneormoreinterfacespecificationdocument.

YouwillneedagoodideaofsomebasicHL7conceptsbeforeyouarecomfortablyabletonavigatethesedocumentsandotherHL7relatedartifacts.Inthefollowingpageswewillcoverthesebasicconcepts.

UnsolicitedMessagesHL7messagesaregenerallyunsolicited.Notalways,butinthevastmajorityofcases.

Beforewe get towhymostmessages are unsolicited, let’s seewhat kind of a beast anunsolicitedmessageis.

Un-solicitedornotsolicitedistheoppositeofsolicited.Thewordsolicitmeans“toask for something from someone”. So its opposite, unsolicited, will probably mean“gettingsomethingfromsomeonewithoutaskingforit”.

IrememberToronto’sMayorRobFordlandinginhotwaterwhilesolicitingdonationfor his private football foundation. He was using City of Toronto letterhead for thepurpose,notrealizingyoucan’tusethepoweroftheofficetosolicitdonation.

Similarly, if a system explicitly asks another system for a message, then that issoliciting.Messagesinthiscasearesolicitedmessages.

Adatabasequeryisagoodcandidateforsolicitedmessages.Ifyouwanttoknowthenumberofinpatientadmissionsfortheday,theinformationissolicitedasaquerytothesystem,whichrespondswithamessagecontainingthenumberofadmissionsfortheday.

NowimagineaworldwhereallHL7messagingislikethis.Afterplacinganorderforalabtest,thesysteminthedoctor’sofficewillkeeppesteringthelabsystemforthetestresult.Iftheresultisnotready,thereisnothingthelabsystemcando.Itdoesn’thavetheinformation.This is an inefficientwayofcommunicating thatwastesprocessingpower,degradesperformanceandisarealannoyance–likekidsinthebackseatconstantlyasking“Arewethereyet?”

Thealternativeisanunsolicitedmessage.Inthiscase,theLabsystemautomaticallysendsthetestresultwhenitbecomesavailable.Itdoesn’trequirethesystemplacingthe

Page 34: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

ordertokeepaskingfortheresult.Byplacinganorder,thesystemhasimplicitlyindicatedthatitwantstheresult.Orinotherwords,itreceivestheresultasanunsolicitedmessage.

This is a much better way of communicating. It is an optimal solution where amessageiscreatedonlywhenit isneeded.Andfor thatreason,mostHL7messagesareunsolicitedmessages.

MessageTypeWhile working with HL7 you will come across statements like, “this is an ADT

message”or“wecanprocessanOrdermessage”.Thesereferences,ADTandOrder,aresimply different message types.Message types are used in HL7 to group and classifysimilarmessages.

IfyouarethinkingHL7messagetypesareprobablybasedonrealworldorganizationofahealthcareenvironment,thenthisisagoodtimetothrowoutthatidea.

Insteadofmirroringrealworld,HL7messagetypesareorganizedbytheirfunction.Taketheexampleofanordermessage.Itdoesn’tmatter if themessageisfora laborapharmacy,aslongasthemessageisanorderforsomething,atest,amedicationorevenhousekeeping,itisanordermessagetype.Similarlymessagesthatdeliverresults,beitalabtestresult,anX-Rayoranultrasound,theyareallresultmessagetypes.

HL7defines thirteendifferent kindsofmessage typesbut youdon’t reallyhave toknow them all. Real life usage of HL7 follows the 80-20 rule of the Pareto principle(example,80%ofaccidentsarecausedby20%ofdriversor80%ofsalescomefrom20%of customers). Likewise, most HL7 messages use only a few of the message typesavailable.Mosthealthcareorganizationsuseonlythissmallsubsetofmessagetypesandifyoubecomefamiliarwiththetopthreeorfour,youwillhavecoveredbetweensixtyandseventypercentofrealworldimplementations.

Sowhatarethesemostcommonlyusedmessagetypes?

Asyouknow,HL7’sareaisclinicalandadministrativedata.Soitisnosurprisethatthemostcommonlyusedmessagetypeispatient-administration.Thisisthemessagetypethat groups together messages that have anything to do with managing a patient -admitting,discharging,updatingtheirinformation,transferringtoanotherunitetc.

Thenexttwomostcommonlyusedmessagetypes,inmyexperience,areOrderEntry(orders)messagesandObservationReporting (results)messages.Butof course this canvaryfromplacetoplace.

Another thing to know aboutmessage types is theMessage TypeCode. This is athree-character code that is used as an acronym for the message type. For patient-administration,thereisjustonecode:ADT(shortforAdmission,DischargeandTransfer).Allpatient-administrationmessagesareADTmessages.

Fororder-entry(orders),thereareafewdifferentmessagetypecodes,dependingonthetypeoforderthemessageiscarrying.ThecodeORMisforthegeneralordermessage.Although it has been discontinued in newer versions of HL7, ORM continues to beheavilyusedinolderimplementations.InadditiontoORM,thereisOMLforlaborders,

Page 35: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

OMIforimagingorder,OMDfordietaryorderandsoon.

Theobservation-reporting (results)message typehasa coupleofdifferentmessagetypecodesaswell,but thecodeORUis theonethat ismostcommonlyused.ThecodeOULhassomethingtodowithlabsystemautomationandnotusedmuch.Wewon’twasteourtimeonit.

TheHL7specificationdocument(HL7spec) isorganizedbymessagetypes.Ifyouwanttoknowmoreaboutaparticularmessagetypeanditscodes,allyouhavetodoisfliptothechapterforthatmessagetype.

TriggerEventHL7messages are trigger-event driven.What does thatmean? Itmeans that anHL7

message is created only when something happens (an event) in the real world. This“something”intherealworldisthetriggerthatsetsthewheelsinmotion.

Forexample,admittingapatientisarealworldeventthattriggersthecreationofanHL7message.Whenthehospitalstaffcompletestheadmitformandhitsenter,itsetsoffachainreactionintheregistrationsystemthatleadstothecreationoftheHL7message.Thecontentof themessagedependsontheevent that triggeredthemessagecreation.In thiscase,itcontainsdetailsofthepatientbeingadmitted.

Noteveryeventintherealworldtriggersmessagecreation.HL7definesspecificrealworldeventswithinthecontextofamessagetypethatcantriggermessagecreation.Itistheseeventsthatarecalledtriggerevents.

Thereisalonglistoftriggereventsthatmaptorealworldevents.Forinstance,ADTdefines over sixty different trigger events. But this is a bit of an outlier because othermessagetypesdon’thavesomanytriggerevents.

Evenwith somany triggerevents, therecould stillbea situationwhereamessageneeds to be generated for a real world event that doesn’t have a corresponding triggerevent. In such cases, onewill need to get a little creative and re-purpose another closeenoughtriggereventforthesituation.

Justlikemessagetypes,triggereventshavetheirownthree-characterTriggerEventCode.Butthereisadifference.Message-typecodesarealluppercaseletterswhereasfortrigger-eventcodes,thefirstcharacterisaletterandthenexttwocharactersarenumbers,suchasA01(patientadmit)orA02(transferpatient).

Together,amessagetypeandatriggereventuniquelydefineanHL7message.Itisgenerallywrittenbyjoiningtogetherthemessage-typecodeandtrigger-eventcodewithacaret(^)symbol.So,apatientadmitHL7messageisrepresentedasADT^A01.ApatienttransferHL7messageisrepresentedasADT^A02andsoon.OftenpeopledropADTandjustrefertothemessagesasA01orA02.

When two systems are being integrated, it is decided beforehand which HL7messageswillbesent.Let’ssayahospitalisimplementinganewpharmacysystem,whichwillbeintegratedwiththehospitalEMR.Thisistoensurethatwhenamedicationorderisplaced, thepharmacysystemhas the information toconfirmthat theorder is foravalid

Page 36: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

patient.

Itmeans the systemwill need to knowwhen a patient is registered andwhen thatpatientisdischargedfromthehospital.Orinotherwords,thepharmacysystemwillneedADT^A01 (register patient) andADT^A03 (discharge patient) HL7messages from thehospitalEMR.Toputitevenmoresimply,thepharmacywillneedA01andA03fromthehospitalEMR.

AcknowledgementMessageAcknowledgementmessagesareshortmessagesthatareceivingsystemsendsbackto

the sender to confirm that the message was received. This is on top of packet levelacknowledgement we discussed earlier. Now we are talking about application levelacknowledgement.Whetheracomplete,fullyassembledmessagewasreceivedornot.

Message acknowledgement is very important in HL7. We don’t want a situationwheremessagesaregettingcorruptedor loston thewayand thesendingsystemhasnoclue.Iftherewasanissuewiththemessagethenit’stheacknowledgementmessagethatconveys the information back to the sender.Thisway the sender knowshow to fix theissueandresendthemessage.Iftherewasnoacknowledgementatallthenthatmeansthemessagewaslostanditstimetoresendit.

ItisimportanttoknowthatHL7requiresacknowledgementfromtheapplicationandnot just the underlying system. This is to ensure that the message was successfullyprocessedby the receiving application.The Ikea in theHL7world just doesn’twant toknow whether you received the parcel, it wants to know whether you were able toassemblethefurniture.

TherearetwokindsofacknowledgementmessagesinHL7:original&enhanced.Asyou can guess, original came before enhanced but the original acknowledgement isnowhere close to being discarded. The original mode of acknowledgement is still thepreferredmethod.Itissimpleanddoesthejobwhereastheenhancedmodehastoomanybellsandwhistlesandtakesalotmoreefforttoimplement.

Originalmode is formally known asAcceptAcknowledgement. Once amessage isreceivedbythedestinationsystem,itcansendbackthreetypesofcodes.Thecodestellyouwhathappenedtotheoriginalmessage.

AA: This is good news. It means the message was successfully processed by thereceivingsystem.ItisalsocommonlyreferredtoasapositiveackorjustACK.

AE:Thismeansthemessagewasprocessedbuttherewasaprobleminthecontentofthemessage.ThisisanegativeackoraNAK.

AR:Thismeanstherewasaprocessingerror.Itcouldbeawrongmessagetypeorsomeotherproblemwiththereceivingsystem.Maybetheserverwasdownorthedatabasewas

Page 37: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

notavailable.Thiserrordoesn’thaveanythingtodowith thecontentof themessage.IttooisknownasnegativeackoraNAK.

Enhancedmode is formally knownasApplicationAcknowledgement. In this case,there could be up to six different types of codes. Using the Ikea example again, inenhancedmode,Ikeawillgettwoacknowledgements.Thefirstacknowledgementissentwhentheparcelisreceivedatthedestination,andthesecondissentafterthefurnitureisassembled(ornot).

The first acknowledgement, confirming that the message was received and safelystoredbythereceivingsystem,freesupthesendingsystemfromhavingtowaitandseeifthemessageneedstoberesent.

Thefirstacknowledgementcouldgeneratethreetypesofcodes:

CA:CommitAccept: Thismeans themessagewas accepted and safely stored by thereceivingsystem.

CR: Commit Reject: This means the message was rejected and not stored by thereceiving system.Maybe themessage typewaswrongor therewas someotherproblemwiththemessage.Anerrorcodeisincludedtoprovidemoreinformation.

CE:CommitError:Thisagainmeansthemessagewasrejectedandnotstored.Inthiscasethemessagewasrejectedbecauseofmeta-dataissues.

Aftersuccessfulstorage,themessageismadeavailabletotheapplicationandthenasecond acknowledgement is sent. This acknowledgement is more elaborate where theacknowledgementmessagestructuredependsonthemessagetypeoftheoriginalmessageanditcontainsalotmoreinformationthantheoriginalmode.

Thesecondacknowledgementmessagegeneratesthesamethreeerrorcodes,AA,AEandARthataregeneratedintheoriginalmode.Enhancedmodeisliketheoriginalmodewithanadditionalacknowledgementforsafestorageofmessagebythereceivingsystem.

Page 38: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

6.MessageBuildingBlocksTo the uninitiated, the sight of an HL7 message is often intimidating. A brew of

symbols and characters, it looks like something out of the Matrix that is beyond thecomprehension of mere mortals. But to be honest, HL7 really is quiet simple andstraightforward,onceyouknowhowtoreadit.Andforthat,youwillneedtolearnaboutthebuildingblocksofanHL7message.

Let’staketheexampleofregisteringanewpatient.Whenthestaffatthefrontdeskcompletes the patient registration and hits enter, it triggers an event: A04 (Registerpatient).ThiscausesthesystemtogenerateanewADT^A04HL7message,whichlookssomethinglikethis.MSH|^~\&|SENDER_APP|SENT_BY|RECEIVER_APP|RCVD_BY|201310201500||ADT^A04|MSG_ID001|P|2.5|||AL

EVN|A04|201310201500|||ID221^Dude@Terminal

PID|1||PAT416^^^HEALTH_ID||SEBELUS^KANSAS||194801150600|M|||123 SESAME ST^^TORONTO^ON^A1A2B2^CANADA||(416)888-8088||ENGLISH|M||PAT_AC_721914

NK1|1|SEBELUS^MARY|SPOUSE|||(416)888-9999|(647)123-1234|C|20131020

PV1|1|O|ROOM10^BED12^OUTPATIENT|ELECTIVE|||S21195^DRIKOFF^FRANCIS^^^DR^MD||C90023^PAYNE^TRACY^^^DR^MD|SUR||||1|||S21195^DRIKOFF^FRANCIS^^^DR^MD||37323|SELF||||||||||||||||||||||||201310201500

PV2|||DAYSURGERY

AL1|1|FA^PEANUT||PRODUCESMILDRASH

SeewhatImean?Makesnosense.Butsoonitwill.

SegmentTheprimarybuildingblockofamessageisasegment.Asegment issimplyarowof

data in themessage.So, for themessage above, the first segment startswithMSHandendsonlinetwowithAL.Itisactuallyjustonerowofdata,whichwaswrappedovertothe second line.There is a linebreakafterALand thatmeansendof the segment.ThesecondsegmentstartswithEVNon line threeandendsat“Terminal”on thesame line,followedbyalinebreakandsoon.Anewsegmentalwaysstartsonanewline.

Thefirst threecharactersofeachsegmentis thesegmentID.ThesegmentIDisanacronymorthenametagofthesegment.

Onceweknowthesegmentname,weknowtheinformationinthatsegment.Thisisbecausethemainpurposeofasegmentistogrouprelatedinformationtogether.

In our example here, there are seven segments (IDs bolded).MSH is theMessageHeadersegment,EVNistheEventsegment,PIDisthePatientIdentificationsegmentandsoon.WithoutevenlookingatthecontentofthePIDsegment,Icantellyouitcontainsthenameofthepatient,hishealthID,dateofbirth,phonenumber,address-basicallyalltheinformationthatcanbeusedtoidentifythepatient.Hencethenameofthesegment-PatientIdentification.MSH|^~\&|SENDER_APP|SENT_BY|RECEIVER_APP|RCVD_BY|201310201500||ADT^A04|

Page 39: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

MSG_ID001|P|2.5|||AL

EVN|A04|201310201500|||ID221^Dude@Terminal

PID|1||PAT416^^^HEALTH_ID||SEBELUS^KANSAS||194801150600|M|||123 SESAME ST^^TORONTO^ON^A1A 2B2^CANADA||(416)888-8088||ENGLISH|M||PAT_AC_721914

NK1|1|SEBELUS^MARY|SPOUSE||(416)888-9999|(647)123-1234|C|20131020

PV1|1|O|ROOM10^BED12^OUTPATIENT|ELECTIVE|||S21195^DRIKOFF^FRANCIS^^^DR^MD||C90023^PAYNE^TRACY^^^DR^MD|SUR||||1|||S21195^DRIKOFF^FRANCIS^^^DR^MD||37323|SELF||||||||||||||||||||||||201310201500

PV2|||DAYSURGERY

AL1|1|FA^PEANUT||PRODUCESMILDRASH

MessageStructure

Segmentsinamessagearealwaysorganizedinaspecificorder.Thisorderiscalledthemessage structure. Differentmessage types have differentmessage structures but somethingsarealwaysthesame.Forexample,everymessagestartswithanMSHsegment.

If theorderofsegmentsinamessageisnotexactlylikeitsmessagestructure, thenthatmessagewillbecomeinvalid.Itwillberejectedbythereceivingsystem.

YoucangettheabstractmessagestructureofanymessageintheHL7specificationdocument.TheabstractmessagestructureofanADT^A04messageisinChapter3oftheHL7specificationdocumentwhereeventA04isdiscussed.

HereisapartialabstractmessagestructureofanADT^A04message.Itisjustatablewith three columns: segment ID, segment name and the chapterwhere that segment isexplained.

Ifyoucompare theexamplemessage to itsabstractmessagestructure, thesegmentorder does not match between the two. In the example message, the SFT segment ismissingafterMSH;PD1&ROLaremissingtoo.

Doesthatmeantheexamplemessageisinvalid?No,it’snotbecausethe[]and{}bracketsaroundthosesegmentsmakethemeitheroptionalorrepeatable.

Optional/Repeatable/Mandatory

Thereare twokindsofbrackets: square [ ]andcurly{}. Ifa segment ID isenclosedwithin [square brackets], it means the segment is optional.We can choose whether toinclude that segment in themessage or not. These segments are generally for optionalinformation,suchasPD1(additionalpatientinformation).

If the segment ID is enclosed within {curly brackets}, then that segment isrepeatable.Wecanhavemorethanoneinstanceofthatsegmentinarealmessage.Curlybrackets are for segments like NK1 (Next of Kin). If a patient has given contact

Page 40: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

informationfortwonextofkin(spouseandsister),thentheinformationforeachnextofkinwillneedaseparateNK1segmentinthemessage.

IfasegmentIDisenclosedinboth[{squareandcurly}]bracketsthenthatmeansthesegmentisbothoptionalandrepeatable.IfasegmentIDisnotsurroundedbyanybracketthenthatmeansitisamandatorysegment.Thatsegmenthastobepresentinthemessage.So segments likeMSH,EVN,PID,PV1,withnobrackets,have tobepresent in a realmessage.

Basedon this knowledgewe can seewhy the example is a validmessage.All themissingsegments,SFT,PD1andROLaresurroundedbysquarebrackets.Andthatmeansthosesegmentsareoptional.Wecanchoosetoleavethemout.

PipeDelimitedSofarsogood.Nowweknowthatamessageisnothingbutacollectionofsegments.

Let’sdigdeeper.Let’stakeasinglesegment,forexamplePID(PatientIdentification),andfollowthesequenceofcharactersinthissegment.Youcannothelpbutnoticethe|symbolscatteredallovertheplace.Thissymboliscalledapipe.

PID|1||PAT416^^^HEALTH_ID||SEBELUS^KANSAS||194801150600|M|||123 SESAME ST^^TORONTO^ON^A1A 2B2^CANADA||(416)888-8088||ENGLISH|M||PAT_AC_721914

ApipeisafieldseparatorinHL7.Or,ifIweretousethejargon,HL7messagesarepipedelimited.

When you hear delimiter, think separator. Have you ever come across a csv file?Oftenweconvertanexcelfileintoacsv(comma-separated-value)format,toexportdata.Itisaverycommonlyusedfileformatforupdatingdatabases.

Whenthedatainanexcelfileisconvertedtocsvformat,itgoesfromlookinglikeatabletosimplerowsofdata,likebelow.

Notice how the data has been stripped down to the basics. It is just field valuesseparatedbycommas.Incsvformat,acommaisthesymbolthatseparatesfieldvaluesortousethecorrectjargon–itisthefielddelimiter.SonowyouknowwhatImean,whenIsay,apipeisthefielddelimiterinHL7.ItisthesymbolthatisusedtoseparatefieldsinanHL7message.

Does thatmean a segment is just a collection of fields?That’s right, a segment isnothingbutacollectionofrelatedfields.ButinHL7,unlikethecsvfile, thereisnotoprow with the name of individual fields. Then how do we know what those fieldsrepresent?

Positional

Fieldsinasegmentarepositional.Thisisanotherwayofsayingthatthepositionofa

Page 41: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

field in the segment is fixed.Patientname is always the fifth field in thePIDsegment.Dateofbirthisseventh.YoucannothaveDOBintheseventhfieldinonemessageandinthetenthfieldinanothermessage.Thepositionofafieldisfixed.

TheHL7 specificationdocumentdefines an attribute table for each segment. Thisattribute table contains the list of fields for each segment and other related informationlikelengthoffield,datatype,etc.Bothsendingandreceivingsystemsrefertotheattributetable to figureoutwhereaparticular field is.Thiseliminates theneed to sendaheaderrowwithfieldnamesforeachmessage.

Component(^)Let’sput thisnewfoundknowledgeaboutattribute tables to the test. Ifyourefer to

theattributetableforPIDsegmentinChapter3oftheHL7specificationdocument,youwillnoticethatthefifthfieldisforthenameofthepatient.Now,wewillcheckthesamefieldinourexamplemessage.Thebestwaytogettoafieldisbycountingthepipes.PID|1||PAT416^^^HEALTH_ID||SEBELUS^KANSAS||194801150600|M|||123 SESAME ST^^TORONTO^ON^A1A 2B2^CANADA||(416)888-8088||ENGLISH|M||PAT_AC_721914

Thevalue after the fifth pipe isSEBELUS^KANSAS,whichdoes look like a realperson’sname.YoucannowclaimthatyouarecapableofreadinganHL7message!

However,thereisa^symbolembeddedinthenamewhichneedsalittleexplaining.The ^ symbol is called a caret. A caret is the component separator (delimiter) in HL7messages.

Justlikeasegmentismadeupoffieldsseparatedbypipes,afieldismadeupofpartscalledcomponents,whichareseparatedbycarets.Ifafieldhastwoormorecomponentsthen thosecomponentshave tobe separatedbycarets in themessage.Forexample, thenamefieldcanhaveafirstname,amiddlename,andalastname.Soacaretwillhavetobe placed between the first name and themiddle name as well as between themiddlenameandthelastname.

Sub-component(&)Yes, some components aremade up of even smaller pieces. Sometimes, I wonder if

therewerephysicistsinvolvedincreatingHL7.Youknow,molecules(suchaswater)aremadeupofatoms(oxygenandhydrogen).Theatomsaremadeupofsub-atomicparticles(electrons,protons&neutrons)and thesub-atomicparticlesaremadeupofquarks (up,down,strange,charmetc.).

Similarly,therearecomponents,whicharecompositeinnatureandtheyaremadeupof smaller pieces called sub-components. Sub-components are separated by the &(ampersand)symbol.

Going back to the example of patient name, its first component, family name, isactually defined as a composite component with five sub-components: surname, ownsurname prefix, own surname, surname prefix from partner/spouse, and surname frompartner/spouse.

Page 42: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

IfthesurnameofthepatientwasSt.PierreJr.withthefirstnameofKansas,thenthename field would have been something like PIERRE&JR&ST^KANSAS, withsubcomponentsofthelastnameseparatedby&(ampersand).

Sothereyouhaveit,thebuildingblocksofanHL7message.

Amessageismadeupofsegments

Asegmentismadeupoffieldsseparatedbypipes(|)

Afieldismadeupofcomponentsseparatedbyacaret(^)

Acomponentismadeupofsub-componentsseparatedbyanampersand(&)

Page 43: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

7.WorkingwithaMessageNow that we have some ideawhat HL7 is, it’s time to start workingwith complete

messages.

What are some of the situations where you are going to be running into an HL7message?

1. During system integration: If a new clinical system is purchased, it will need toexchangeHL7messageswithexistingsystems.

2.During troubleshooting: If your system is rejectingan incomingmessage, youwillneedtolookattheerrordescriptionandtheHL7message.

3.Whilecreatingamessageprofile.IfyouareasoftwarecompanythenyouwillneedtodefinewhatHL7messagescomingoutofyoursystemlooklike.

TherecouldbeothersituationsbutthesethreemakeitclearthatworkingwithHL7messagesinvolvesreading,writingandcreatingmessages.

To read a message, you will need the Interface Specification document (interfacespec).Ittellsyouwhateachfieldinthemessageisfor.Ifaninterfacespecisnotavailable,youcanlookupthesegmentattributetableintheHL7spectogetanideaaboutthefield.However,thesourceoftruthisalwaystheinterfacespec.

Towrite amessage, youwill definitely need an interface spec.This is because anHL7 speconlygives you the abstract framework.Organizations further tweak the rules(for example, only allow numbers in an alphanumeric field) and these rules aredocumentedintheinterfacespec.Tocreateavalidmessage,youwillneedtocomplywithalltherules.

Creatingamessagealsoinvolvesfiguringout the informationtobeincludedin themessageandhowitwillbemapped.Thisinformationisthendocumentedintheinterfacespec.IttakesawhiletogetallthisworkdoneandyouwillneedtoknowyourwayaroundtheHL7specinordertodoso.

Butbeforewegetdown to reading,writingandcreatingmessages, let’s learnabitmore about the HL7 spec and the interface spec so that we are able to navigate themeasily.

AnatomyofaMessageItendtolookatanHL7messageasmadeupofaheadandabody.Theheadisthefirst

twoorthreesegmentsatthetopofthemessageandtherestisthebody.HeadsegmentsareControlsegmentsandthebodysegmentsareDatasegments.

Control segments only carry meta-data information about a message. RememberEdwardSnowdenandtheNSAspyingscandal?Atonepoint,theNSAcamebackwiththe

Page 44: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

excuse that theywereonlycollectingmeta-dataofphoneconversations. Inotherwords,they were not listening to actual conversation, only recording call related information.Thingslikethedurationofthecall,thephonenumberdialed,localtimeofthecalletc.

Similarly, in HL7, control segments carry only meta-data information about amessage.Datasegments,asthenamesuggests,aretherealcarriersofthedata.

HL7SpecificationDocumentThere is no escaping it. If youwant to knowHL7, youwill have to knowyourway

around the eminentlydryHL7 specificationdocument (HL7 spec).That’swhere all theinformationis.

TheHL7spec is theowner’smanual forHL7messaging. It isabulkymanual thathasfifteenchaptersandoversixteenhundredpagesofcontent.

Untilrecently,youhadtopayaconsiderableamounttogetholdofacopy.However,in September 2012, the organization announced that HL7 standards and all of itsintellectualpropertieswouldbemadepubliclyavailabletoreducebarrierstoadoptionandtobroadenitsusage.Youcandownloadthespecforfreefromtheirwebsite.

Go to the HL7.org homepage and click on “Standards” in the menu. Withinstandards,clickon“Section1:PrimaryStandards”andonthefollowingpage(whichwasatableforme),clickon“HL7Version2ProductSuite”.Thiswilltakeyoutoapagethatlistsalltheversionsofthestandard.Ihadtoregisterbutitwasprettysimple(name,email,address). After that, I was able to download a compressed copy of the specificationdocument.Theorganizationstillrequiresthatyouacquirealicense(forfree)beforeusingthestandard.

Onceyouunzipthedownloadedfile,itexpandsintoovertwentydifferentfiles.Thiscan be a bit overwhelming, like driving in a new city where you don’t have amentallayout of the place. To avoid frustration while looking for specific information, it willserveyouwelltohaveagoodsenseofthelayoftheland.

So,letsunclutterthiscollectionofovertwentyfiles.Therearefifteenchapters,fourappendicesandsomeotherstuff.Thechaptersareimportant.Youcantypicallyignoretherest.Evenwiththechapters,thereareonlyafewthatarereallyimportant.Rememberthe

Page 45: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

80-20rule?

Chapter2(CH02.pdf)isthemostimportantchapterinthecollection.Thischapteriscalled“Control”andthatiswhereyouwillfindinformationonalltheimportantconcepts,controlsegments,fields,datatypesetc.

HL7alsodefinesa lotofdata types,whichare inCH02A.pdf.Youcan ignore thischapterunlessyouneeddetailsofaparticulardatatype.

Then there are Chapters 3–15. Each chapter handles a different message type, itstriggerevents,itsdatatypesandotherrelateddetails.

Each chapter has more or less the same layout. First, trigger events and messagetypesarediscussed.Thensomedatasegmentsareintroduced,followedbyexamplesandfinallyspecialscenarios.

InterfaceSpecificationDocumentImentionedearlierthattheHL7specisliketheowner’smanual.Thisstatementneedsa

correction. The real owners’ manual is the Interface Specification Document (interfacespec).HL7 spec ismore like a rulebookwithmultiple options. The interface spec is acustomizedversionofthatrulebook.

Interfacespecsvarydependingonthetypeofinterfaceswearetalkingabout.Ifitisonlyforsendingandreceivingmessages,thenthespecwilldetailwhatthemessagewilllooklikegoingoutandwhatitshouldlooklikecomingin,beforethesystemwillprocessit.

For integration engines (hubs), the spec looks different. They receive a message,changethetype/contentofthemessageandsendoutadifferentmessage.Soinadditiontosending and receivingmessages, the interface specwill also have to provide details ontransformingthemessage.

Thereisnosetstructureforaninterfacespec.Peopledotheirownthing.Buttherearesomecommonpiecesofinformationtheyallhave.

The spec will define one or more trigger events. It could even define an entiremessagetypewithallofitstriggerevents.Generally,youwillhaveanumberofdifferentspecsfordifferenttriggereventsandmessagetypes.

Withinthespec,foreachtriggerevent,youwillhaveamessagestructurethatdefinesthe segments and their order in the message. And for each segment, there will be anattributetable,whichdefinesthelength,optionality,datatype,andotherdetailsforeachfieldofthatsegment.Messagestructureandsegmentdetailsgiveyouprettymuchalltheinformationyouwillneedtoreadandwritemessages.

Reading/WritingaMessageHereistheexamplemessagefromthepreviouschapter.Let’stakeastabatreadingit.

MSH|^~\&|SENDER_APP|SENT_BY|RECEIVER_APP|RCVD_BY|201310201500||ADT^A04|MSG_ID001|P|2.5|||AL

Page 46: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

EVN|A04|201310201500|||ID221^Dude@Terminal

PID|1||PAT416^^^HEALTH_ID||SEBELUS^KANSAS||194801150600|M|||123 SESAME ST^^TORONTO^ON^A1A 2B2^CANADA||(416)888-8088||ENGLISH|M||PAT_AC_721914

NK1|1|SEBELUS^MARY|SPOUSE|||(416)888-9999|(647)1231234|C|20131020

PV1|1|O|ROOM10^BED12^OUTPATIENT|ELECTIVE|||S21195^DRIKOFF^FRANCIS^^^DR^MD||C90023^PAYNE^TRACY^^^DR^MD|SUR||||1|||S21195^DRIKOFF^FRANCIS^^^DR^MD||37323|SELF||||||||||||||||||||||||201310201500

PV2|||DAYSURGERY

AL1|1|FA^PEANUT||PRODUCESMILDRASH

Firstthingyoulookforinamessageisitsmessagetypeandtriggerevent.MessagetypeistheninthfieldintheMSHsegment(MSH-9).Inourcase,itsvalueisADT^A04(boldedin themessage).Remember, this isafieldwith twocomponents joinedtogetherbyacomponentdelimiter(^).Thefirstcomponentisthegeneralmessagetype,whichisADT. This means the message has something to do with patient administration. Thesecond component is the event type code. This is the trigger event that generated themessage. In our example it is A04, which means a patient registration triggered thismessage.

Whenyouareworkingwithmessages,youwillbe regularlychecking their triggereventcodes.MSH-9isoneplacetocheckbutthereisanotherfieldthatholdsthetriggereventcode.ItisthefirstfieldoftheEVNsegment(EVN-1).Ipersonallypreferthisfieldbecauseitiseasiertolocateinamessage.JustlookforEVNsegmentandrightafterityouhavethetriggereventcode.Youcanconfirmthisintheexamplemessage.Thecodeisthesameinboththefields-A04.

Onceyouknowthetriggereventcode,youknowtheinformationinthemessage.Forexample,sinceA04isthetriggereventcodeforpatientregistration,itimpliesthemessagecontainsinformationaboutapatientregistration.

WheneveryouarereadinganHL7message,youarelookingforspecificinformation.Nomatterwhat informationyouare looking for,youwillneed toknow the field in themessagebodywherethatinformationis.Forthat,youturntotheinterfacespecandlookforthefieldthatholdsthatinformation.

Let’stakeanexample.SupposeyouwanttofindoutthepatientwhowasregisteredatthehospitalonOctober20,2013at3:00PM.Yourtechnicalguyshavenarroweddownthesearchtoasinglemessage,theexamplemessageabove,andnowyouwanttoconfirmthatthisisthemessagethathasthepatient’sname.

For that,youwill firstneed to locate thefieldfordateand timeofregistrationandconfirm that it isOctober20, 20133:00PM.After confirming it, youwill look for thenameofthepatient.

Sowherecouldbethedateandtimeofregistrationinthemessage?Dateandtime–thatsoundslikemeta-data.Let’slookinthecontrolsegments.

There are two control segments in our example message - MSH & EVN. If youconsulttheirattributetablesinthespec(HL7orinterface),youwillnoticethatneitherhasa field for date and time of registration.Welcome to the world of HL7! Dealing withambiguityisaprerequisite.

Page 47: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Wedohaveacoupleofotherdate/timefields.MSH-7(Date/TimeofMessage)holdsdate/time forwhen themessagewasgeneratedandEVN-2 (RecordedDate/Time)holdsthe date/time forwhen the trigger eventwas fired.Generally, as in our example, thesefieldshavethesamevalue.Butifthereisadifference,thenI’llgowithEVN-2.Itsoundsmorelikethedateandtimeofpatient’sregistration.

The value inEVN-2 is 201310201500.To interpret this,we again check theEVNattribute table and look for the data format of EVN-2. The format isYYYYMMDDHHMM,whereYistheyear,Misthemonth,andsoon.Afterparsingthecontentwegettheyearas2013,themonthas10(October),thedayas20andthetimeas1500or3PM.Thisisthemessagewearelookingfor.

Ok,wehaveourmessage.Now,ontothesecondpart–findingthepatient’sname.Patient’snameiswithoutdoubtclinicaldata.Ithastobeinadatasegment.Therearefivedatasegmentsinthemessageandthatiswherewewillsearchforthepatient’sname.Thedatasegmentsare:

PID–PatientIdentificationSegment

NK1–NextofKinSegment

PV1–PatientVisitSegment

PV2–PatientVisit–AdditionalInfo.Segment&

AL1–AllergyInformationSegment

It is not hard to guess just by looking at the names of the segments that patient’sname fieldprobably is in thePIDsegment.Of course, there couldbea situationwherethings are not as obvious (like the date/time field earlier). In that casewewill have tosearchtheinterfacespecforthatfield.Itdoesgetboringsometimes.

To confirm our hunch we check the attribute table of the PID segment and sureenough the 5th field (PID-5) is the name of the patient. In themessage,we count fivepipesand thevalueafter the fifthpipe,SEBELUS^KANSAS, is thepatient’sname.Wehave successfully read themessageand found thatKansasSebeluswas thepatientwhowasregisteredatthehospitalonOctober20,2013at3:00PM.

Writingamessageisjustthereverseofreadingit.Inthecaseofwriting,yourefertothe interface spec and build the message by populating fields with appropriate values.PatientnamegoesinPID-5,dateofbirthgoesinPID-7andsoon.

CreatingaMessageNowit’stimetocreateamessageortobeprecise,amessageprofile,whereyoudefine

itsexactstructure.Thisisinvolvedworkandusuallyabusinessorinterfaceanalystwillbedoingitfulltime.

Tocreate amessage, youagain startwith the trigger event. If youare creating theprofileforpatientregistration,youstartwithA04.

Page 48: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

A04,likeeveryothertriggerevent,hasitsabstractmessagestructuredefinedintheHL7spec.Thefirsttaskistocreateabarebonesmessagestructurebyeliminatingalltheoptional segments. A message structure made up of only the required segments, likebelow.

MSH

EVN

PID

PV1

This,then,isthesimplestmessagestructureofanA04message.

Next, depending on additional information that has to be sent, you include otheroptional segments from the abstractmessage structure, at appropriate placeswithin thebarebonesmessagestructure.

Theexamplemessagehasthreeoptionalsegments-informationonfamilymembers(NK1), additional information about the visit (PV2) and allergy information (AL1).Inclusionofthesesegmentsattheirappropriatelocationschangesthemessagestructure.

MSH

EVN

PID

[{NK1}]

PV1

[PV2]

[{AL1}]

This then is themessagestructureof theexampleA04message.After themessagestructureisdefined,youcustomizetheattributetableforeachsegmentandthejobisdone.Anothermessagehasbeendefined.OtherscanreadthisinformationintheinterfacespecandtheywillknowwhatanA04messagecomingoutofyoursystemwilllooklike.

SegmentAttributeTable

Wehavetalkedalotaboutthesegmentattributetable,solet’stakeamomenttolearnmore about it.A segment attribute table contains the list of fields in a segment. It alsoincludesotherdetailssuchaswhichfieldsareoptional,whichcanrepeat,etc.AllsegmentattributetablesintheinterfacespecarederivedfromtheabstracttablesintheHL7spec.

Tocustomizeasegmentattributetable,thebasicruleisthatyoucanonlyconstrain.YoucanaddmoreconditionsandrulesbutyoucannotremoveexistingrulesdefinedbyHL7.

Page 49: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

What conditions can you add? Look at the columns in the segment attribute tablebelow. Let’s use LEN (length) as an example. The table defines 250 characters as thelength of the patient name field (5th field). You can reduce the field length to 50characters.No problem.What you cannot do is increase field length to 300 characters.Thatwillviolatetheruleof250characterlimitsetbyHL7.

And, as you can see, the column headings of the segment attribute table are notexactlyintuitive.Sohereisadescriptionofwhattheystandfor.

SEQ:SequenceNumber.This is just thepositionof thefieldin thesegment.SetIDisthefirstfieldinthePIDsegment,DateofBirthistheseventhfield,Sexistheeighthandsoon.

LEN:MaximumLengthoftheField.Nothingtoexplainhere.

DT:DataType.HL7likestocontrolhowthedataisrepresentedinthemessageanditdoessothroughdatatypes.Thiscolumndefinesthedatatypeofthefield.

OPT:Optionality.Thiscolumntellsyouwhetheryouarerequiredtohaveavalueinthefieldorifitisoptional.AfieldcanbeRequired(R),Optional(O)orConditional(C).Ifitisconditional,itmeanstheoptionalityisbasedonanotherfield.Forexample,BloodTypeisaconditionalfield.Itisoptionalnormallybutifthepatientisadmittedforsurgerythenitbecomesarequiredfield.

Anotherletter(B)canalsobeseeninthiscolumn.Itisforbackwardcompatibility.ThesefieldsarepresentonlytosupportolderversionsofHL7.Unlessyouaresupportingthatversion,youshouldleavethosefieldsempty.

RP#:Repetition(number).Thiscolumntellsyouif thefieldcanrepeat.If thefieldisblankorhasan“N”thennorepetitionofthefieldisallowed.Ifthefieldhasa“Y”thenitcanrepeatoneormoretimes.Ifithasanumber,suchasY(3),thenthatfieldcanrepeatupto3times.Fieldrepetitionvaluesareseparatedbya~(tilde)inthemessage.

TBL#:TableNumber.Forsome fields,HL7onlyallowsaspecificsetofvalues.Forexample,intheAdministrativeSexfield,onlythefirstletterofpatient’sgender(M,F,U)isallowed.You cannot put“Male” in this field. These valid values are defined in a table

Page 50: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

withauniquetablenumber.Ifafieldtakesitsvaluesfromatablethenthattablenumberislistedinthiscolumn,asisthecasewiththesexfield.

ITEM#: IDNumber.This isanumber thatuniquely identifiesevery field in theHL7specificationdocument.Field“Date/TimeofBirth”isattheseventhfieldpositioninthePIDsegmentanditsIDis00110.ThesamefieldisatthesixteenthpositioninthesegmentNK1 but the ID is the same, 00110. Keep in mind the subtle difference in field namesthough.“Name”and“PatientName”aredifferentfieldsandtheyhavedifferentID’s.

ELEMENTNAME:NameoftheField.Thisisjustadescriptivenameofthefield.

Page 51: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

8.ControlSegmentsFromthelastchapter,ifyourememberthediscussionabouttheanatomyofamessage,

control segmentsare thesegments in theheadofamessage.Theyonlycarrymeta-datainformationaboutamessage.

ThereareaboutadozencontrolsegmentsdefinedbyHL7.Theyareallexplainedinchapter 2 of theHL7 spec. Fortunately,we only need to know about a few of them toaccount for the vast majority of cases. For example, there are control segments forbreaking a very large message into smaller pieces and control segments for batchingtogetheralargenumberofmessages.Thesecontrolsegmentsarenotusedthatfrequentlyandforageneralunderstanding,youcanskipthem.

There are five control segments that you really should know about –MSH,EVN,NTE,MSA&ERR.Wewill startwithMSH, theubiquitouscontrolsegment thateverymessagebeginswith. It is themost importantcontrolsegment. Ifyoudecide five is toomanyforyourprecioustimeandyouareonlygoingtoreadaboutone,thenletthisbetheone.

MessageHeaderSegment(MSH)Themessageheadersegment(MSH)isthemostimportantcontrolsegment.EveryHL7

messagestartswiththissegment.WhenanHL7messageisreceivedbyasystem,itistheMSH that tells the receiving systemwhere thismessage came from, the information itcontainsandhowitissupposedtobeacknowledged.

Thisisasegmentyouwanttoknowwell.

To get a better understanding of the contents of this segment, let’s use theMSHsegmentfromourexampleA04messageandexploreitscontents.

MSH|^~\&|SENDER_APP|SENT_BY|RECEIVER_APP|RCVD_BY|201310201500||ADT^A04|MSG_ID001|P|2.5|||AL

Ifyoubreakthesegmentdownintoitsseparatefields,itgetseasiertofigureoutthecontent.Remember|isusedtoseparatefields.

MSH-1:|(FieldSeparator)

MSH-2:^~\&(EncodingCharacters)MSH-3:SENDER_APP(SendingApplication)

MSH-4:SENT_BY(SendingFacility)

MSH-5:RECEIVER_APP(ReceivingApplication)

MSH-6:RCVD_BY(ReceivingFacility)

MSH-7:201310201500(Date/TimeofMessage)

MSH-8:

MSH-9:ADT^A04(MessageType)

Page 52: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

MSH-10:MSG_ID001(MessageControlID)

MSH-11:P(ProcessingID)

MSH-12:2.5(VersionID)

MSH-13:

MSH-14:

MSH-15:AL(AcceptAcknowledgementType)

Note that some of the fields are empty (e.g. MSH-8). This is perfectly fine.Remember, not every field in a segment is required tohave avalue. If you refer to thesegmentattributetableofMSH,youcanconfirmthatallmissingfieldsareoptional.

Now,hereisalittleinsiderinformation.Thereareonlyafewfieldsineachsegmentthatarereallyimportantandregularlyused.Thatiswhyyouseetheusualpipepattern(||||)inHL7messages.Theconsecutivepipesarenothingbutemptyfields.

Sokeepingwithourtradition,andsavingyouprecioustime,wearegoingtodiscussonlythemostimportantfieldsinasegment.

In the MSH segment, owing to the fact that it contains most of the meta-datainformation,therearemanyimportantfields.Itistheheaviestcontrolsegment.Someoftheseimportantfieldsarerequiredandothersareoptional,buttheyalmostalwayshaveavalue.

IfyourefertothesegmentattributetableoftheMSHsegment,HL7requiresthatthefollowingfieldsalwayshaveavalue.MSH-1:FieldSeparator

MSH-2:EncodingCharacters

MSH-7:Date/TimeOfMessage

MSH-9:MessageType

MSH-10:MessageControlID

MSH-11:ProcessingID

MSH-12:VersionID

It iseasytofindoutwhichfieldsarerequiredinasegment.JustgotothesegmentattributetableandlookfortheletterRintheoptionality(OPT)column.

Besidestheserequiredfields,therearesomeotherfields(below)inMSH,whichareoptionalbutregularlyused.TheyareimportantandIthinkyoushouldknowaboutthem.MSH-3:SendingApplication

MSH-4:SendingFacility

MSH-5:ReceivingApplication

MSH-6:ReceivingFacility

MSH-15:AcceptAcknowledgementType

MSH-16:ApplicationAcknowledgementType

Keep inmind though that this is onlymy personal opinion.Others can argue thatthereareotheroptionalfieldsthatareimportantandsomeherearenot.I’mnotdenyingit.

Page 53: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Butfrommyexperience,IbelievethesearetheimportantfieldsintheMSHsegment.

Nowlet’sgetfamiliarwiththesefieldsbecausethenameofthefielddoesn’ttellyouevenonetenthofthestory.

MSH-1:FieldSeparator

Usually, the first field in a segment is the field that follows the segment ID. Sotechnically “encoding characters” should be the first field of MSH segment. But withMSH,thereisananomaly.Thefirstfield(MSH-1)alwaysdefinesthesymbolthatwillbethe field separator (delimiter) for the entire message. If you remember the discussionaboutpipedelimitersinChapter6,|isthefieldseparatorinHL7messagesandtherefore,thefirstfieldofMSH.Butitdoesn’thavetobe.Youcanchoosetohaveacomma(,)oranyothersymbolastheseparator.Ifyouchoosetouseacomma,thesegmentwill looksomethinglikethis.MSH,^~\&,SENDER_APP,SENT_BY,RECEIVER_APP,RCVD_BY,201310201500,,ADT^A04,MSG_ID001,P,2.5,,,AL

ThiswouldbeaperfectlylegitimateHL7segment.However,|hasbecomesuchadefactostandardthatnoonereallyusesanythingbut|asthefielddelimiter.Butit’sgoodtoknowthatwehavethepowertochangeit.

MSH-2:EncodingCharacters

Encoding Characters are the four symbols ^ ~ \ & that HL7 reserves for messageconstruction.

These characters have specialmeaning,which allows applications reading anHL7messagetodistinguishbetweencomponentsandsubcomponentsofafield,readrepeatingfields,andtranslatesymbols.

The encoding characters, in order, are - Component Separator (^), RepetitionSeparator (~),EscapeCharacter (\) andSubComponent Separator (&).The position ofeach character is fixed in the field. First the component separator then the repetitionseparatorandsoon.

By having these symbols in MSH-2, we are basically saying that in this HL7message, ^ will be used to separate components, ~ will be used to separate multipleoccurrencesofafield,\willbeusedforspecialcharactersand&willbeusedtoseparatesubcomponents.

But shouldn’t this be hardcoded in systems that read HL7 messages, instead ofincludingitineverymessage?

Goodpoint.The reasonencodingcharactersare included ineveryHL7message isbecausethesecharactersarecustomizabletoo,justlikethefieldseparator|.

HL7gives you the option of selecting your own encoding characters. If you don’tlike^andwouldratherhave#asthecomponentseparatorinyourmessagesthenallyouhavetodoisreplace^with#inMSH-2.Asaresult,yourencodingcharacterswouldbe

Page 54: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

#~\&.The#symbolwillnowbethecomponentseparator.

Butthiswholediscussionispointless!Overtheyears,thesesymbolshavebecomeadefactostandard.I’llbet,manyfolkswhohavebeenworkingwithHL7foryears,don’tknow thatyoucanchange these symbols. Ihavenevercomeacrossamessagewhereadifferentsetofsymbolswereused.

Before we move to the next field, you need to know more about the other twoencodingcharacters–theRepetitionSeparator(~)andtheEscapeCharacter(\).

RepetitionSeparator(~):Thisisthesymbolthatseparatesmultiplevaluesinafield.Rememberthesectiononsegmentattributetableinchapter7?Somefieldsarerepeatableandtheycanhavemultiplevalues.~isthesymbolthatisusedtoseparatethosevaluesinafield.

In theMSHsegment, fieldMSH-18andfieldMSH-21are repeatable.Thismeans,whenever those fields have two ormore values, the values will be separated by the ~symbol. If a systemreading themessagecomesacross the~symbol, itwillknowrightawaythatwhatfollowsisthenextvalueofthefield.

EscapeCharacter (\): HL7 reserves encoding characters for message constructionandtheyhaveaspecialmeaninginthemessage.Whathappensifyouneedtouseoneofthosespecialcharactersaspartofthedata?Theapplicationreadingthemessageisgoingtobeallconfused!!

In real world applications, themost troublesome of these special characters is theampersandsymbol(&).Itisusedfor“and”(asinBen&Jerry’s)andisalsoacommonlyusedsymbolinprogramminglanguageslikeHTML(whichcouldbeembeddedinanHL7message).So,soonerorlater,youareboundtocomeacrossthe&symbolinthebodyofanHL7message.

Whathappensifthesecharactersarepartofthedata?Let’sconsideranexample.

Ben&Jerry’sDiagnosticCentersendstheresultofatestasanHL7messagetotheorderinghospital.Thehospitalsystemreceivesthemessageandstartsreadingittoparsethe data (pull out field values) and save it to a database.When the system gets to theSendingFacilityfield(MSH-4),itwillread“Ben”andthenrunintothe&symbol.Atthatpoint,thesystemisbeingtoldthatthenameofthefacilityhasasub-component.Facilitynames don’t have sub-components (if you check the segment attribute table), so in alllikelihoodthesystemdoesn’thaveacorrespondingfieldinthedatabasetosavethevalue“Jerry’sDiagnosticCenter”.

This isarecipeforapplicationfailure.Let’sassumethis isafuturistic,can-handle-anythingkindofsystem,buteventhenthesystemisonlysaving“Ben”asthenameofthesendingfacility,whichisincorrect.Thedoctorreadingthelabreportwillseethat“Ben”sentthetestresult.Idon’tknowhowmuchfaithshewillhaveinthereport.

Sowhatdowedo?Wecan’taskBen&Jerry’sDiagnosticCentertochangeitsname.

This is where the escape character comes to the rescue. If characters, which havespecialmeaninginHL7,needtobetransmittedaspartofthedata,thenalloneneedstodoisreplacethecharacterwithitscorrespondingescapesequence.Thesystemreadingitwill

Page 55: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

readtheescapesequenceandreplaceitwiththatspecialcharacterbeforesavingit.

Anescapesequenceisnothingmorethanoneormorecharacterssurroundedbytheescapecharacter(\).EveryspecialcharacterinHL7hasacorrespondingescapesequence.Therearemanyescapesequencesforformattingandhighlightingtext,andyoucanevencreatecustomescapesequences.

Herearetheescapesequencesforthesymbolswehavealreadydiscussed:

GuesshowBen& Jerry’sDiagnosticCenterwill be encoded in anHL7message.Youwillreplacetheencodingcharacter&withitscorrespondingescapesequencesothatyouwillhave“Ben\T\Jerry’sDiagnosticCenter”encodedinthemessage.Thereceivingsystemwillrecognize\T\asanescapesequenceandreplaceitwiththe&symbolwhenthedataissavedlocally.

MSH-3:SendingApplication&MSH-4:SendingFacility

Fields threeandfourareoptional,but theyarealmostalwayspopulatedinrealworldimplementations.Theycontain thenameof theapplicationand the facility that sent themessage (the sending system). Often these fields are used as filter to process or routemessagesbasedonthesendingapplicationandfacility.

Foranexample, ifBen&Jerry’sDiagnosticCenter is runningaMeditech system,thenthesendingapplicationwillbe“Meditech”inMSH-3andthesendingfacility,“Ben&Jerry’sDiagnosticCenter”(oranabbreviationB&JDIAG)willbeintheMSH-4field.

MSH-5:ReceivingApplication&MSH-6:ReceivingFacility

Fieldsfiveandsixaresimilartofieldsthreeandfourexceptthattheycontainthenameof theapplicationand thefacility that themessage isbeingsent to(thereceiver).Thesefieldstooareusedinrealworldimplementationsasafiltertorouteorprocessmessagesbasedontheintendedrecipient.

MSH-7:Date/TimeofMessage

Thisisarequiredfield.Itcapturesthedateandtimewhenthesendingsystemcreatedthemessage. In aNorthAmerican context, the field is usually populated in the formatYYYYMMDDHHMM(whereY=year,M=monthandsoon).Somesitesgotoahigherdegreeofprecisionandincludesecondsorevenmillisecondsinthefield.HL7allowsupto26characters,sowehavealotofroomhere!

Page 56: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

MSH-9:MessageType

MessageType is a very important field and avalidvalue in this field is required foreverymessage.This is thefieldthat tells thereceivingsystemthetypeofmessageit is.Knowingthetypeofmessageisessentialforasystemtobeabletoreadthemessage.

Withoutthisinformation,thereceivingsystemwillbeliketheearlyarcheologistsinEgypt.Theyhadnoideawhatthebirdsandtheeyesinhieroglyphsmeant.Itwasn’tuntiltheRosetta stonewas discovered byNapoleon’s troops andChampollion figured out awaytoreadit,thathieroglyphsstartedtomakesense.Thisiswhatmessagetypedoestothereceivingsystem.

Themessage type fieldhas three components–MessageType (MSH-9.1),TriggerEvent(MSH-9.2)andMessageStructureID(MSH-9.3).Inourexample,thisfieldhasthevalueADT^A04.Noticesomething?Onlythefirsttwocomponentsarethere.Thisisfinebecausethethirdcomponent isanoptionalcomponentandusuallyweleaveitempty.IfyouwanttoknowtheMessageStructureIDofamessage,youcanlookitupinHL7specswheretheabstractmessagestructureisdefined.It’sintheheading.

Wehavealreadydiscussedmessagetypes(MSH-9.1)andtriggerevents(MSH-9.2).Ifyouneedtorefresh,theyareinChapter5.

MSH-10:MessageControlID

Thepurposeof thisfield is touniquelyidentifyeachandeverymessage.Usually, thevalue in this field is a unique number generated by the sending system. For eachsubsequent message, the sending system increments this number by one to generateanotheruniquenumber.Somesystemsalsoattachadatestampattheendofthenumbertoeliminateanychancesofduplication.

Whydoweneedtouniquelyidentifyeachmessage?

When the receiving system gets the message, it has to send an acknowledgementback to the sending system.Acknowledgement tells the sending system if themessagewasreceivedokandifitcanmoveonorwhethertherearedefectsinthemessageanditneedstoresendit.ThereceivingsystemusestheMessageControlIDtotellthesendingsystemwhichmessage it is talkingabout.Andthat iswhyweneed touniquely identifyeachandeverymessage.

TroubleshootingisanotherreasonwhyweneedauniqueIDforeverymessage.Atthetimeofdebuggingandtesting,MSH-10isaninvaluablepieceofinformation.Ithelpstrackdownanindividualmessageinahaystackofmessages.

MSH-11:ProcessingID

This is a required field, which contains a single character. It signals whether themessageisreal(productionintechiespeak)orjustfortesting.IfthevalueisP,itsignalsthat it is a production or real message. If the value is T (Test/ Training) or D(Development)thenitisatestmessage.

Page 57: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

MSH-12:VersionID

Thisisanotherrequiredfieldthatisofinterestonlytodevelopersandinterfaceanalysts.This field contains the version number of HL7 that the message conforms to. In ourexamplethisvalueis2.5,whichmeansthemessageconformstoHL7version2.5.

MSH-15: Accept Acknowledgement Type & MSH-16: ApplicationAcknowledgementType

Rememberthediscussiononmessageacknowledgementinchapter5?Evenifyoudo,here’saquickrecap.

There are two types of acknowledgementmessages – original& enhanced. In theoriginal mode only one acknowledgement message is sent. It is sent by the receivingapplication,henceitsname,applicationacknowledgement.

In the enhanced mode, two acknowledgement messages are sent. One is theapplication acknowledgement and the other one is accept acknowledgement. Acceptacknowledgementissentwhenthereceivingsystemhassuccessfullysavedthemessageatitsend.

Inotherwords,inenhancedmode,whenthereceivingsystemacceptsthedeliveredmessage, it sends out an accept acknowledgement. It then sends the message to theapplication, which does its own verification and sends out an applicationacknowledgement.

FieldsMSH-15andMSH-16actlikeswitchesforthesetwoacknowledgementtypes.IfthevalueisALinMSH-15thenthereceivingsystemissupposedto“ALways”sendanaccept acknowledgement. If the value is NE then it should “NEver” send an acceptacknowledgement.ThesamecodesareusedintheMSH-16field,onlythistimeitpertainstotheapplicationacknowledgementmessage.

Formost practical purposes, these fields are useless.This is becausewedon’t useenhancedmodeofacknowledgementmuch.Usuallypeoplejustleavethesefieldsempty,whichmeansoriginalmode.Ifyouwanttousetheenhancedmode,thenyouwillhavetohave AL in both the fields. If you just want to know that the message was receivedsuccessfully,thenyouwillhaveALinMSH-15asinourexamplemessage.

EventTypeSegment(EVN)Event Type is a required control segment in many message types, such as patient

administration(ADT)andfinancialmanagement(BAR).Itisashortsegmentwithsevenfields, only one of which is required. It has “good to know” kind of information butnothingcritical.But the segment is socommon inHL7messages that I feltyou shouldknowaboutit.

Theonlyuseful information this segmenthas, inmyopinion, is the timewhen theeventhappened,EVN-2.

Page 58: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

HereistheEVNsegmentfromtheexamplemessage.EVN|A04|201310201500|||ID221^Dude@Terminal

EVN-1:A04(EventTypeCode)

EVN-2:201310201500(RecordedDate/Time)

EVN-3:

EVN-4:

EVN-5:ID221^Dude@Terminal(OperatorID)

EVN-6:

EVN-7:

ThisexampleisverytypicalofEVNsegmentsintherealworld.Youhavethetriggereventcode(A04)inthefirstfieldeventhoughitisnotrequiredandisarepeatfromMSH-9.2. Andthen there is theRecordedDate/Time, theonlyrequiredfield in thissegment.Amongtheoptionalfields,EVN-1andEVN-5aregenerallypopulated.

EVN-1:EventTypeCode

Asthenamesuggests,thisfieldholdsthetriggereventcode.ItisaduplicateofMSH-9.2andretainedforusebysystemsusingolderversionsofHL7.

Youwill always find this fieldpopulated.This is becauseEVN-1used tohold thetriggereventcodebeforeanewerversionofHL7camealongandmovedthetriggereventcode toMSH-9.2.Peoplekeptpopulating thevalue inEVN-1 tomaintaincompatibilitywith older versions. Who wanted to come back and recode the interfaces! A littleduplicationdidn’tsoundlikeabigpricetopayandnowit’sbakedin.

EVN-2:RecordedDate/Time

This is the only required field in this segment. It holds the date and time(YYYYMMDDHHMMSS)ofthetriggerevent.Touseourexamplemessage,thevalueinEVN-2 is themoment when, after filling out the form, the person at the desk hits thesubmitbuttontoregisterthepatient.

EVN-5:OperatorID

Thisisanoptionalfieldthatholdstheidentifyinginformationofthepersonatthedesk.Itidentifiesthe“dude”attheterminal.Heistheonewhohitthesubmitbuttontoregisterthepatient.ThefieldcontainshisemployeeIDandname.

Nowyouknowwheretolookifyouwanttofindoutwhodidtheregistration.

Notes&CommentsSegment(NTE)

Page 59: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

NTEisageneralpurposesegment.As thenamesuggests, this isasegment fornotesandcomments.Youwillfindthissegmentpepperedallovertheplaceinorderandreportmessages.

If you look at the abstractmessage structure of a general order (ORM^O01) or aresult (ORU^R01) message, you will find NTE at multiple places. And it is alwaysenclosedbetweensquareandcurlybrackets;it’salwaysoptionalandrepeatable.

ThereasonthissegmentisinmultipleplacesisbecauseanNTEisalwaysassociatedwith the segment it came after. If an NTE is after a PID segment, it holds notes &comments about the patient. If it is after OBX segment (result) then it holds notes &commentsabouttheresult.

Thesegmentitselfisveryshort.Itonlyhasfourfields,whicharealloptional.

NTE-1:SetID-NTE

This field assigns a number to an NTE segment. NTE commonly repeats toaccommodatelongcommentsandthisfieldhelps to identify individualsegments in thatcomment.

Numberingstartsat1andincreasesbyincrementsofoneuntilthatcommentisdone.Thenext timeanotherNTE isused, thenumbering starts again from1.So if there is acomment about the patient, it will have a bunch ofNTEs numbered 1 to n. If there isanothergroupofNTEsforresult,theytoowillbenumbered1ton.

I have come across messages with beautifully formatted comments and dottedborders.Theyreallygrabyourattentioninaseaofrandomcharacters.Whosaystechiesaren’tartistic!

Let’sconsideranexample.Supposethefollowingcommentsweretobeincludedinanordermessageforabloodtest:

Patientcomment(afterPID)

Thepatientwasveryparticularabouthisbreakfast.Heconsumedanorangebeforethebloodwasdrawn.

Ordercomment(afterOBR)

Ifthetestresultswillbeaffectedbecauseofconsumptionofacitrusfruit,pleasegiveusacall.Wewillcancelthisorderandcreateanotherone.

Acreativesenderwithaflairfordesigncouldsendthecommentssomethinglikethis:PID|…….

NTE|1||––––––––––––––––––––––|

NTE|2||Thepatientwasveryparticularabouthisbreakfast|

Page 60: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

NTE|3||Heconsumedanorangebeforethebloodwasdrawn|

NTE|4||––––––––––––––––––––––|

.

.

OBR|…..

NTE|1||––––––––––––––––––––––|

NTE|2|Ifthetestresultswillbeaffectedbecauseofconsumption|

NTE|3|ofacitrusfruit,pleasegiveusacall|

NTE|4||Wewillcancelthisorderandcreateanotherone|

NTE|5||––––––––––––––––––––––|

NoticehowtheNTEsegmentsarenumbered1,2,3,4…foreachcomment.That is theSetIDtoidentifyindividualNTE’sinagroup.

NTE-3:Comment

Thisisthefieldthatholdstheactualnotes&commentsinfree-formtext.Youcanevenformatthetext(highlightetc.)byincludingappropriateescapesequences.

AcknowledgementControlSegmentsAgeneralacknowledgementmessageismadeentirelyofcontrolsegments.Ofcourse,

MSHisthefirstsegmentinthemessage.Itisalwaysthefirstsegment,nomatterwhatthemessagetype.After thatyouhaveMSA,theacknowledgementsegmentandif thereareerrors, you will have ERR segments. That’s it. These are the only segments in anacknowledgementmessage.

HL7doesallowcustomizedacknowledgementmessagesbutinreallife,weonlyusethegeneralacknowledgementmessagewithitssimplemessagestructure.

Forasuccessfulmessage,apositiveacknowledgement(ACKinshortform)issent,whichisevensimplerandhasonlytwotypesofsegments-MSH&MSA.Forexample,MSH|^~\&|RECEIVER_APP|RCVD_BY|SENDER_APP|SENT_BY|201310201501||ADT^A04|R_MSG_ID279|P|2.5|||AL

MSA|AA|MSG_ID001|Gotyourmessage

Foranunsuccessfulmessage,anegativeacknowledgement (NAKinshort form) issent,whichcanhave three typesof segments (MSH,MSA&ERR).TheERRsegmentcanrepeatifthereismorethanoneerrortoreport.

Intheexamplebelowwehavetwoerrorstoreport,hencetwoERRsegments.MSH|^~\&|RECEIVER_APP|RCVD_BY|SENDER_APP|SENT_BY|201310201501||ADT^A04|R_MSG_ID279|P|2.5|||AL

MSA|AE|MSG_ID001|Can’treadthismessage.

ERR||PID^5|101^Requiredfieldmissing|E

ERR||PID^7|102^Datatypeerror|E

Page 61: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Now, let’s look more closely at these control segments (MSA & ERR) in anacknowledgementmessage.

MessageAcknowledgementSegment(MSA)MSA is a required segment in every acknowledgementmessage.This is the segment

thatholdstheacknowledgementcode,whichtellsyouifthereceiverwasabletoprocessthemessageornot.

Thesegmenthassixfields,outofwhichonlythefirsttwoarerequired.Inpractice,thethirdfield,whichisoptional,isalsopopulated.Thelastthreearealwaysempty.

MSA-1:AcknowledgementCode

Whenpeoplelookatacknowledgementmessages,thisisthefirstfieldtheireyesgoto.ThefirstfieldoftheMSAsegmentholdstheall-importantacknowledgementcode.

Theacknowledgementcodeismadeupoftwouppercaseletters.IfthevalueisAAthatmeansallisgood.Forerrormessages,wehavetwocodes–AEandAR.

AEmeansthere isaproblemwith themessage.Itcouldbe itscontent,structureorsomethingelsebutmostprobablythesourceoftheproblemisthesender.IfitisAR,thenthatmeansthereissomeothersystemlevelproblem,suchasdiskspaceissuesorapowerfailure. In this case, the sourceof theproblemcouldbe the receiverandmostprobablyyouwillneedtoresendthemessage.

MSA-2:MessageControlID

ThisisthesecondrequiredfieldintheMSAsegment.ItcontainstheMessageControlID(MSH-10)oftheoriginalmessage.Ifyouremember,themessagecontrolIDuniquelyidentifiesamessageandbyincludingithere,theacknowledgementmessageisindicatingthatthisacknowledgementisforthemessagewithcontrolIDinMSA-2.

Let’s clarify thiswith the help of an example below.The originalmessage has itscontrol ID in MSH-10 (MSG_ID001) and the same control ID is in MSA-2 of theacknowledgement message. Keep in mind though, that the acknowledgement messagealsohasitsmessagecontrolIDinMSH-10(R_MSG_ID279),whichisdifferentfromthemessagecontrolIDoftheoriginalmessage.

(OriginalMessage)MSH|^~\&|SENDER_APP|SENT_BY|RECEIVER_APP|RCVD_BY|201310201500||ADT^A04|MSG_ID001|P|2.5|||AL

(AcknowledgementMessage)MSH|^~\&|RECEIVER_APP|RCVD_BY|SENDER_APP|SENT_BY|201310201501||ADT^A04|

Page 62: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

R_MSG_ID279|P|2.5|||AL

MSA|AA|MSG_ID001|Gotyourmessage

WithoutthisID,thereisnowayforthesendingsystemtoknowwhichmessagethereceiverisacknowledging.

MSA-3:TextMessage

This is an optional field that can be used to send additional information like errordetails.NewerversionsofHL7don’trecommendusingthisfield.Wehaveabrandnewsegment(ERR)toprovidedetailedinformationabouterrors.

ErrorSegment(ERR)TheERRsegmentisincludedinanacknowledgementmessagewhenthereisanerrorto

report.Thissegmentisusedtoprovidemoredetailsabouttheerrorcondition.

Foreacherrorcondition,aseparateERRsegmentiscreated.Intheexample,wehavetwoERRsegments,whichimpliesthereweretwoissuesinthemessage.ERR||PID^5|101^Requiredfieldmissing|E

ERR||PID^7|102^Datatypeerror|E

Therearetwelvefieldsinthissegment.Twoarerequiredandtherestareoptional.

ERR-2:ErrorLocation

Thisisanoptionalfieldbutitalmostalwayshasavalue.Itidentifiesthesegmentandfieldwheretheerrorhappened.

In our example, for the twoERR segments, the values arePID-5 andPID-7.Thismeanstherewasaproblemwiththe“PatientName”(PID-5)fieldandthe“PatientDateofBirth” (PID-7) field. It looks likewearemissing thepatientnameand thedateofbirthwassentinthewrongformat.

ERR-3:HL7ErrorCode

This is a required field that contains a three-digit error code.HL7 defines a table ofgeneralerrorconditions(inHL7spec)withacodenumberforeachcondition.Thevaluein our example is from that table. For example, if a required field is missing in themessage,thenthevalueinERR-3is101.

ERR-4:Severity

Thisisanotherrequiredfield,whichcontainsasinglecharacter,forthe“errorseverity”code. There are only three values for this field, I (Information), W (Warning) and E(Error).Usually,ifwearesendingerrorinformation,itisbecausetherewasanerror.No

Page 63: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

onebotherswithinformationandwarningmessages.ThevaluehereisalmostalwaysE.

Page 64: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

9.DataSegmentsNowwe come to themeat and potatoes ofHL7messaging.Data segments form the

bodyofanHL7message.Theycarrypatientandclinicaldata,thethingthatmattersthemost.Restofthemessageisjustthebox,styrofoampackagingandtheshippinglabel.

Themainpurposeofadatasegment is togroup togethersimilardata inoneplace.Forexample,all the informationaboutapatient isgroupedtogether inasegmentcalledPID (Patient Identification segment). Actually, there are so many data fields about thepatientthatthereisonemoresegment,PD1,foradditionalpatientdata.

Similarly, all patient visit information is in PV1, allergy info is inAL1, insuranceinformationisinIN1andsoon.EachsegmentisdescribedindetailintheHL7spec.

There is another kind of data segment that youwill occasionally come across in amessage. These are locally defined segments orwhatwe call Z segments. HL7 allowsusers todefine theirownsegment if theywant tosendadditional informationforwhichthereisnofielddefinedbyHL7. Unfortunately, thisisamuchabusedprivilege.Ihavecomeacrossmessageswhereyouhavethebareminimummandatorysegments,followedbyrowsofZsegmentswiththeactualdata.

Inthischapter,wewilllookatsomeofthemostcommonlyuseddatasegments.

Therearecloseto150datasegmentsdefinedintheHL7spec.Noteventheexpertsareexpected toknowaboutallof them.It isalwaysagoodidea tokeeptheHL7specshandysowhenevertheneedarises,youcanquicklylookupaparticularsegmentanditsdetails.

For a general understanding, you only need to know about a few of these datasegments.The80-20ruleappliestodatasegmentstoo.Onlyabouttwentypercentofdatasegmentsareactuallyusedineightypercentofmessages.Soforabusyprofessionallikeyou,itmakessensetoinvestthelimitedtimeyouhave,inthattwentypercent.

Therearethreemessagetypesthataccountformostofthattwentypercent.•ADT(PatientAdministration–Chapter3)

•ORM(OrderEntry–Chapter4)

•ORU(ObservationReporting–Chapter7)

Ifyougetagoodhandleonthese,I’msureyoucanhandleanyexoticmessagethatgets thrownatyou.TheHL7spec isyour friendanddon’t forget toask thevendor fortheir interface spec.Between these twodocuments, you can figureout almost anyHL7message.

ADT(PatientAdministration)PatientAdministrationmessagesareattheheartofHL7messaging.Iamnotsurehow

theycametobeknownasADTmessages,probably it isareferenceto threecommonlyoccurringtriggerevents–Admit,Discharge&Transfer.

Page 65: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Thismessage type is all about the patient. Its primaryuse is tomake sure varioussystemsinahealthcareorganizationareinsyncwithpatientinfo,suchasthepatientstatusinthehospital,contactinfo,medication,allergies,etc.

Inatypicalhealthcareorganization,thereisusuallyanEMRoraregistrationsystemthat manages patient records and updates other ancillary clinical systems throughHL7ADTmessages.Itisthroughthesemessagesthatapatient’sstatusandinformationiskeptsynchronizedacrosstheorganizationandbeyond.

From themoment aperson starts interactingwith thehospital,HL7messages startgetting generated in response to real world events (trigger events). This is how othersystemsalwayshavethelatestinformationaboutapatient.

Let’sconsideranexample.Apersonwalksintotheoutpatientunitofahospital.Thefirstthingthathappensispatientregistrationatthefrontdesk.Thisrealworldeventisatriggerevent,EventA04(RegisteraPatient).Whenithappens,thesystemautomaticallygenerates anADT^A04message to let other systemsknow that anewpatient hasbeenregisteredwiththehospital.

Let’ssayallisnotlookingwellforthepatientandthedoctordecidestokeephiminthehospitalforobservation.Thismeansthepersonisgettingadmittedtothehospital.Thisis another trigger event, Event A01 (Admit/Visit Notification). This event will causeanotherHL7message,ADT^A01,tobegenerated.Ifthepatientisgettingadmittedtothehospital,itmeanshewillneedabed,anursewillbeassignedforcareandmedicationwillhave to be ordered. All the ancillary systems, nursing, bed management, pharmacy,finance, foodservicesetc.will receive theADT^A01message,so that theyknowaboutthisnewpatientandanynecessaryfollow-upactioncanbetakenbythem.

Thenextday, thepatient isdoingmuchbetterand thedoctor sayshe is free togohome.Heisgivenhismedication,someonearrivestotakehimhomeandheisdischargedby the administration system. This is another trigger event, Event A03 (Discharge/EndVisit).ThistriggereventgeneratesanHL7message,ADT^A03,sothatothersystemscanupdate their records and close the patient account. We don’t want a situation wheresomeone is ordering controlled drugs from pharmacy on behalf of a patient who hasalreadybeendischarged!

This was a simple example. In real life, between registration and discharge, apatient’srecordcanundergoalotofchanges.Thedoctorcouldchange,thepatientcouldgettransferredtoanotherunit/bedorthepatient’scontactcouldchange.AllthesechangeshavecorrespondingtriggereventsthatgenerateHL7messages.Infact,thereareoversixtydifferentADTtriggerevents,everythingfromcancelvisittodeleterecord.Butthereisnoreasontobealarmed,mostofthesetriggereventsarebarelyused.The80-20cornucopiakeepsongiving.ThereareonlyahandfulofADTtriggereventsthatarecommonlyused.

AfterRegistration(A04),Admit(A01)andDischarge(A03),thenextimportantADTtriggereventisA08(UpdatePatientInformation).Thiseventistriggeredwheneverthereisachangeinthepatientrecord.An“AOEight”(that’showinsiderspronounceA08)isaveryheavilyusedADTmessage.

Then there are other ADT trigger events worth knowing - transfer patient (A02),cancel admit (A11), cancel discharge (A13) and pre-admit (A05) are some of the

Page 66: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

examples.

One very importantADT trigger event is amerge event. This occurs in situationswhere, bymistake, two patient records have been created for the same person and therecords have to be merged into one. Merge is a complex topic so we will address itseparatelyinthenextchapter.

AlthougheachADTtriggereventgeneratesaslightlydifferentmessage,ifyoulookat their message structure, youwill notice thatmost ADTmessages follow a commonpattern.

After thecontrol segments (MSH,EVNetc.) in theheadof themessage, thebodystarts with patient identification and related information (PID, PD1, NK1). This isfollowed by information about patient visit (PV1, PV2) and then you have all kind ofothersegmentsforallergy,diagnosis,procedure,insuranceetc.

OfallthesegmentsinADTmessages,PID(PatientIdentification)andPV1(PatientVisit) are the twomost important data segments. These segments have a lot of fieldsbetweenthembutthenagain,the80-20ruleistheretohelp.Onlyasmallsubsetoffieldsinthesesegmentsiscommonlyused.

PID–PatientIdentificationSegmentThePIDsegment,asthenameimplies,carriesinformationaboutthepatient.Itisoneof

themostfrequentlyusedsegmentsandusuallyappearsrightafterthecontrolsegments.

IfyouhavearawHL7messageandyouwanttofindoutthedetailsofthepatient,you look in the PID segment. This iswhere the patient’s name, age, address and otherdemographic information is. There is another segment, PD1 (Patient AdditionalDemographicsegment),foradditionalpatientinformationbutthatsegmentisrarelyused,ifever.

Let’sparsethePIDsegmentfromourexamplemessageandlookatitsfields.PID|1||PAT416^^^HEALTH_ID||SEBELUS^KANSAS||194801150600|M|||123 SESAME ST^^TORONTO^ON^A1A 2B2^CANADA||(416)888-8088||ENGLISH|M||PAT_AC_721914

PID-1:1(SequenceNumber)

PID-2:

PID-3:PAT416^^^HEALTH_ID(PatientIdentifierList)

PID-4:

PID-5:SEBELUS^KANSAS(PatientName)

PID-6:

PID-7:194801150600(Date/TimeofBirth)

PID-8:M(AdministrativeSex)

PID-9:

PID-10:

Page 67: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

PID-11:123 SESAME ST^^TORONTO^ON^A1A 2B2^CANADA(Address)

PID-12:

PID-13:(416)888-8088(PhoneNumber–Home)

PID-14:

PID-15:ENGLISH(PrimaryLanguage)

PID-16:M(MaritalStatus)

PID-17:

PID-18:PAT_AC_721914(PatientAccountNumber)

PIDsegmenthasthirtyninefieldsbutonlytwoaremandatory,PID-3(PatientID)&PID-5(PatientName).Alltheotherfieldsareoptional.Intheexamplesegmentwechosenottosendanyinformationafterfieldeighteen.That’swhythesegmentendsatPID-18andimpliesthattheremainingfieldsareempty.

PID-2/PID-3/PID-4:PatientIdentifierFields

Patientidentifierisaveryimportantfieldforhealthcareapplications.Usually,thefieldholds theMRN (medical record number),which is assigned to a patient at the time ofregistration.But there are other identifiers, such as billing account number, health cardnumberorSSNthatcanbeusedtouniquelyidentifyapatient.

TherearethreefieldsforpatientidentifierinthePIDsegmentbutonlyone,PID-3,iscommonly used.BothPID-2 andPID-4 are deprecated,meaning they continue to existonly to support older versions ofHL7. So youwill see a value in PID-2 or 4 only forapplicationsthatwereimplementedinthepast.

PID-3isanimportantfield.Itismandatory,soyoucan’tleavethisoneempty.Itisalso a repeating field, meaning you can send multiple patient identifiers in PID-3. Ofcourse,theidentifierswillhavetobeseparatedbytherepetitiondelimiter(~).Anexamplewouldlooksomethinglikethis:PAT416^^^HEALTH_ID~999-99-9999^^^SSN.

Anotherthingtoknowaboutthisfieldisthatitisacompoundfield.Therecanbeupto ten components in this field but we don’t have to worry about that. Usually onlycomponent1(IDnumber)and4(AssigningAuthority)arevalued.That’swhythevalueinthe example looks like PAT416^^^HEALTH_ID. Component 1 (ID) is PAT416 andcomponent4(assigningauthority)isHEALTH_ID.Thisisthehealthcardnumberofthepatient.

PID-5:PatientName

This is another mandatory field and a compound field that has way too manycomponents. HL7 went overboard here. In addition to the usual first, middle and lastnames,theyhavedefinedcomponentsforprefix,suffix,degree,surnamefrompartner…it’salonglist.

Inpractice,weonlypopulatethefirstthreecomponents,lastname,firstnameandthemiddlename.Inourexample,wehaveonlypopulatedthefirsttwo,lastandfirstname.It

Page 68: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

isnotuncommontoaddMDorwhateverotherdegreeadoctorhas,tohername.Degreeis the sixth component so there will be a lot of carets in the field, something likePAYNE^TRACY^^^^MD.

PID-7/PID-8:PatientDate&TimeofBirthandSex

Although these fields are optional, they almost always have a value. PID-7 (Date&Time of Birth) is in the TS (timestamp) format so the field value is sent asYYYYMMDDHHMM.Iftimeisnotavailable,onlythedateofbirth(YYYYMMDD)issent.

PID-8representsthesexoftheperson.Thisfieldcanonlyhaveonecharacter.Misformale,FforfemaleandUisforunknown.Ifsiteswanttodefinetheirowncodes,theyarefreetodosobuttheywillhavetomakesurethatboththesendingandthereceivingsystemsarereferringtothesamesetofcodes.Otherwise,therewillbeamessagefailureandabigheadacheforimplementers.

PID-11/PID-13/PID-14:PatientAddress&PhoneNumber

Thesefieldsholdthecontactinformationofthepatientandareusuallypopulated.Allthreearerepeatingfieldssotherecanbemultipleaddressesandphonenumbers.

In the example above,wealsohavevalues in thePID-15 (PrimaryLanguage) andPID-16 (Marital Status) fields. These fields are used to send additional demographicinformationaboutthepatient.Italldependsontheinformationcollectedbythehealthcarefacilityandvariesfromoneorganizationtothenext.

PID-18:PatientAccountNumber

Although this field is defined as optional, in my experience, this field is alwayspopulated.Thisisthefinancial/billingaccountnumbertowhichallexpensesandchargesforpatientcareareassigned. Evenin jurisdictionswhereyouhaveuniversalhealthcare(like in Canada), the patient account number is populated and used for reporting andtrackingexpenses.

PV1–PatientVisitSegmentThisisanotherveryimportantandextensivelyuseddatasegment.Itcarriesinformation

aboutapatient’svisit toahealthcarefacility(whichcliniciansrefer toasanencounter).Fieldsinthissegmentincludetypeofpatient(inpatient/outpatient),admittingdoctor,dateofadmission,locationofbedetc.Inall,therearefiftytwofieldsinthissegment.

PV1 followsPID in thebodyof themessage and is usually amandatory segment.Let’sparsePV1fromtheexamplemessageandlookatsomeoftheimportantfields.

PV1|1|O|ROOM10^BED12^OUTPATIENT|ELECTIVE|||S21195^DRIKOFF^FRANCIS^^^DR^MD||C90023^PAYNE^TRACY^^^DR^MD|SUR||||1|||S21195^DRIKOFF^FRANCIS^^^DR^MD||37323|SELF||||||||||||||||||||||||201310201500

Page 69: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

PV1-1:1(SequenceNumber)

PV1-2:O(PatientClass)

PV1-3:ROOM10^BED12^OUTPATIENT(AssignedPatientLocation)

PV1-4:ELECTIVE(AdmissionType)

PV1-5:

PV1-6:

PV1-7:S21195^DRIKOFF^FRANCIS^^^DR^MD(AttendingDoctor)

PV1-8:

PV1-9:C90023^PAYNE^TRACY^^^DR^MD(ConsultingDoctor)

PV1-10:SUR(HospitalService)

PV1-11:

PV1-12:

PV1-13:

PV1-14:1(AdmitSource)

PV1-15:

PV1-16:

PV1-17:S21195^DRIKOFF^FRANCIS^^^DR^MD(AdmittingDoctor)

PV1-18:

PV1-19:37323(VisitNumber)

PV1-20:SELF(FinancialClass)

PV1-21:

….

PV1-44:201310201500(AdmitDate/Time)

PV1-45:

PV1-46:

….

Thereisonlyonerequiredfieldinthissegment,PV1-2.Butanumberofotherfieldsareusuallypopulated.Fieldspopulatedintheexampleaboveareagoodapproximationofreal life messages. There could also be one-off cases, where a rarely used field ispopulated.

Once,IcameacrossamessagewherePV1-16wasvaluedandIdidn’tknowwhatitwas for.This field is for flaggingVIP patients. It is there for health records of famouspeopleandsituationswheretheclinicalstaffmighthavemorethanaprofessionallevelofinterestinthepatient’smedicalhistory.

Remember when George Clooney had a motorcycle accident in New York andshowedupatalocalhospital.Alotofstaff,especiallywomen,wereconcernedaboutthispatientinemergency,andwerecheckinghisrecordstomakesureeverythingwasallright.Godknowswhythemediastartedscreamingaboutbreachofprivacy.

Page 70: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

PV1-2:PatientClass

ThisistheonlyrequiredfieldinthePV1segment.Itcontainsasingleletter,thecodeforthetypeofpatient.

HL7doesn’tdefineastandardlistofcodesforthetypeofpatient,although,thereisasuggestedlist.Afacilitycanusethissuggestedlistorcreateitsowncustomlistandshareitwithsystemsreceivingthemessage.

Somecommonlyusedcodesare-I(Inpatient)forpatientsstayingatthehospital,O(Outpatient) forpatientswhoare justvisitingforaconsultation,dialysisorcheckupbutarenotgoingtospendthenightatthehospitalandE(Emergency)forpatientswhocamethroughtheemergencydepartment.

PV1-3/PV1-6/PV1-11:PatientLocation

Thesefieldscontainapatient’slocationinthehospital.Foroutpatients,thefieldstaysempty but for those who are inpatients, PV1-3 contains their current location in thehospital. If thepatientwasmovedfromanother location, thatprior location is inPV1-6andifthepatientisinatemporarybed,thenthatgoesinPV1-11.Notallfieldsarealwayspopulated.UsuallyonlyPV1-3isvalued(currentlocation).

These location fields are large and complicated. Each one is made up of elevencomponents and some of the components themselves are made up of subcomponents.However, the 80-20 rule is here to saveus.Usually, only the first four components arevalued.Thefirstcomponentisforthenursingstation/unit,thesecondcomponentisforthebed,thethirdcomponentisfortheroomandthefourthoneisforthefacility/site.Togethertheyareenoughtopinpointapatient’slocationinahospital.

Patient locationisanimportantfieldandusedbymanydifferentclinicalsystems.IrememberitbeingusedinanInfectionControlsystemtotrackthemovementofpatientswhohadantibioticresistantinfections(MRSA).

PV1-7/PV1-8/PV1-9/PV1-17/PV1-52:Doctors&OtherHealthcareProviders

These fields contain the identifying information of doctors and other healthcareproviderswhoarecaringfororwereinvolvedinthecareofthepatient.PV1-7isfortheattendingdoctor,PV1-8isforthereferringdoctor,PV1-9isfordoctor(s)consultedonthecase,PV1-17isforthedoctorwhoadmittedthepatient(inpatient)andPV1-52isforotherhealthcareproviders likenursesandphysiotherapistwhoare involved in thecareof thepatient.

These fields too are complicated compound fields but only a few components areused. The first component is the “ID Number” and it is used to uniquely identify thedoctor.InToronto,everydoctorhasauniqueCPSO(CollegeofPhysiciansandSurgeonsofOntario) number,which is often used as the ID number.But you can use a local orinternalID.Aslongasthenumberuniquelyidentifiesadoctor,itisgoodtogo.

Page 71: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Secondtoseventhcomponentsofthefieldareforthedoctor’sname.IwouldalwayspopulatethesixthandtheseventhcomponentwithDRandMDrespectively.Afterall,ittakesyearsoftoiltoacquirethoseletters,sotheleastIcoulddowasmakesureitwaspartofthedoctor’sname.

The ninth component of the field is for the organization that assigned the “IDnumber” (first component) to thedoctor.So if theCPSOnumberwerebeingused then“CPSO”wouldgointhisfield.

PV1-19:VisitNumber

Every patient visit to a healthcare facility is assigned a unique number called a visitnumber.Thisfieldholdsthatnumber.BeforeweanswerwhyweneedtoassignauniqueIDtoeverypatientvisit,youneedtoknowhowhealthcarerecordsareorganized.

Healthcare records are organized in a hierarchy. At the top is the patient record,which is identifiedby thePID-3 (Patient Identifier) field.Foreachpatient record, therecouldbeoneormoreaccounts,whichareidentifiedbyanaccountnumber.TheseaccountnumbersarefoundinthePID-18(PatientAccountNumber)field.Anaccountnumberisused forbillingpurposes towhichallpatientexpensesarecharged.Eachaccountcouldhaveoneormorepatientvisit(PV1-19)fieldsassociatedwithit.Soforarecurringvisitlikedialysisorphysiotherapy,youcanhaveadedicatedaccounttowhichallrelatedvisitsarebilled.Andforone-offvisits,suchasanemergency,youhaveaseparateaccount,bothunderthesamepatientrecord.

Now to the questionwhywe need to assign a unique ID to every patient visit.Apatient visit can lead to an order for a lab test, medication or some other service. ByhavingauniqueIDforeveryvisit,itiseasiertotrackordersbythevisitnumber.Avisitnumberalsomakesiteasiertomergepatientrecords.

Thisisanimportantfieldanditisalmostalwayspopulated.

PV1-44/PV1-45:Admit&DischargeDate/Time

Thesefieldsareusedtocapturethedateandtimeofpatientadmittanceanddischarge.Theyareobviouslyused for inpatientvisitsbut are sometimesalsoused for emergencypatientsandoutpatients.

OrderMessage-OrderEntryItistimetoturnourattentiontoanotherimportantgroupofHL7messagescalledorder

messages.TheirdetailsareinChapter4oftheHL7spec.

Wecall themordermessagesbecausemessages in thisgroupareused toorder forsupplies and services. It is only because of these messages that a system is able toelectronically requestmedication frompharmacy, order a lab test, or request a patient’smealthroughtheTV.

Page 72: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

The HL7 spec defines an all-purpose order message type called a General OrdermessageORM^O01.Thismessage typecanbeused toplacedifferent typesoforders -medication,labtest,supplyetc.

ORM^O01hastwoveryimportantsegments-aCommonOrderSegment(ORC)andanOrderDetailSegment.ORCisstraightforwardandwecoveritindetailfurtherbelow.

TheOrderDetailsegmentchangeswiththetypeoforderbeingplaced.Usually,itisan OBR (Observation Request segment), but for diet orders, it changes to ODS, forpharmacy,toRXOandforsupplyordersit isRQD.Thisisnecessarytoaccountfortheuniqueinformationneededbydifferentordertypes.

Thingschangedafterversion2.3.Specializedordermessageswithafixedmessagestructure were created. These were OMG^O19 for clinical orders, OML^O21 for laborders,OMD^O03fordietorders,RDE^O11forpharmacyorders,andsoon.

Itwas recommended that these specializedordermessages be usedgoing forward,butORM^O01issuchawidelyusedandentrenchedmessagetypethatitcontinuestobethedominantandmostimportantordermessage.IfyoulearnaboutonlyORM^O01andOBRsegment,itwilltakeprobablycareof80%ofcases.Forothers,youcanalwaysturnbacktotheHL7spec.

Beforewe takeacloser lookat segmentsORCandOBR, let’sget some importantconceptsoutoftheway.

Placer/Filler

Whenever an order is being placed for supplies and services, there are at least twosystemsinvolvedinthetransaction.Thesystemthatplacestheorderandthesystemthatfills the order (or provides the service). InHL7 parlance, a “Placer” is the system thatplaces the order and a “Filler” is the system that fulfills the order or provides theservices/supplies.

SupposeaphysicianentersanorderforabloodtestintheHIS(hospitalinformationsystem),whichconverts thatorder intoanHL7messageandsendsit to thelabsystem.HeretheHISisthe“placer”andthelabsystem,whichfillstheorder,isthe“filler”.

Itisnotnecessaryfortheplacerandthefillertobeseparatesystems;theycanbethesamesystem.Forexample,whenanorderisplacedinternallywithinadepartment.

Everytimeanorder iscreated, theplacerassigns itauniquenumber(PlacerOrderNumber)beforesendingittothefiller.Whenthefillerreceivestheorder,italsoassignsauniquenumbertotheorder(FillerOrderNumber)beforeanyfurtherprocessingisdone.These numbers are very important and you will often need them for tracking anddebuggingordermessages.

OrderControl

Noteveryordergoesthroughthesameprocess.Anordercouldbemodified,cancelled,orputonhold.Toaccountforallthesedifferentsituations,ORChasanordercontrolfield

Page 73: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

(ORC-1)tocommunicatethecurrentstatusoftheordertothefiller.

When the placer first creates an order, the status of the order is set to NW (NewOrder).Subsequently, if thatorderneeds tobecancelled, theplacersendsanotherordermessagewiththesameplacernumberasthatoforiginalorderbutthestatusissettoOC(OrderCancelled).

Whenthefillerreadsthissecondmessage,itwillgoaheadandcanceltheorderinitssystem.After cancellation, anacknowledgementwith theorder statusCR (CancelledasRequested)issentback.

TherearealotofcodesfororderstatusesandtheyareallthereinChapter4oftheHL7 spec. Just to give you a taste, if the filler is not able to cancel the order, becausemaybe the testhasalreadybeenperformed, itwill sendbackanacknowledgementwithcodeUC(UnabletoCancel).

SegmentRules

The way ORC and Order Detail segments (OBR, ODS, RXO etc.) show up in amessage can be confusing at times. But there are rules and if you know them,understanding the occurrence of these segments in a message becomes prettystraightforward.

Forthesakeofsimplicity,wewilluseOBRfororderdetailsegment.

BothORCandOBRcontaindetailsof anorder and there aremany fields that arecommonbetween these two segments.A ruleof thumbwith theseoverlapping fields isthatthevalueinORCalwaysoverridesthevalueinOBR.

The bestway to distinguish between these segments is to seeORC as the controlsegment andOBR as the data segment.Yes, they are both data segments but from theperspectiveofanorder,ORCcontainsonlythemeta-dataofanorder,suchasthestatusoftheorder,placer IDand filler ID.OBR,on theotherhand,containsactualorderdetailslikewhatisbeingorderedandthedetailsofthespecimen(blood,urineetc.).

Foraneworder,youneedanORC/OBRpairtodefinethecompleteorder.AnORCwillspelloutallthemeta-datainformationandtheOBRwillcontaintheactualdetailsoftheorder.However,forcancellationofanexistingorder,thereisnoneedforanOBR.JustanORCwiththecancel(CA)statusisenough.

Thereisanotherthingtokeepinmindaboutordermessages.AsingleHL7messagecanhavemorethanoneorder.ItwilljusthavemorethanoneoccurrenceofanORC/OBRpair or multiple ORC segments (for the case where more than one order is beingcancelled).

Let’stakealookatthesesegmentsnow.

ORC–CommonOrderSegmentAs mentioned earlier, an ORC segment is like the control segment of an order. It

Page 74: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

containsmeta-data information about the order and is required in every ordermessage.There are thirty fields in this segment but as youmust have guessed, not everything isused.

ORC-1:OrderControl

ThisistheonlyrequiredfieldintheORCsegmentanditisthemostimportantfield.Itcontainsatwocharacter“controlcode”todeterminethestatusoftheorder.Therearetoomany order control codes so I am just going to list the three categories that they aregroupedunder.

•RequestfromPlacer(NewOrder-NW,CancelOrder-CAetc.)

•AcknowledgementfromFiller(OrderAccepted-OK,CancelledasRequested-CRetc.)

•Notificationfromfiller(OrderCancelled-OC,UnabletoCancel-UCetc.)

ORC-2&ORC-3:PlacerOrderNumber/FillerOrderNumber

ORC-2(PlacerOrderNumber)istheuniqueordernumberassignedbytheplaceroftheorder. This field is duplicated in the OBR segment (OBR-2). Either the ORC-2 or theOBR-2shouldalwaysbevalued.Bothofthemcannotbeempty.However,itisallrightifbothfieldsarepopulated,aslongastheyhavethesamevalue.

SimilarlyORC-3(FillerOrderNumber)istheuniqueordernumberassignedbythefillersystem.ThisfieldalsohasaduplicateintheOBRsegment(OBR-3)andifitisnotvaluedintheORC,thenitshouldbepopulatedintheOBR.

ORC-7:Quantity/Timing

Thisfieldisnotusedanymore.Twonewsegments,TQ1andTQ2havetakenovertherole of defining the amount of medication, the frequency, the interval, the duration ofadministrationandotherdetailsofanorder.

These details become important for orders that involve activities like dispensingmedication,makingobservationsorcollectingspecimens.

ThefieldisduplicatedintheOBRsegment(OBR-27).

ORC-12:OrderingProvider

This field contains the identifying information of the doctor/healthcare providerwhoplaced the order. It is duplicated in theOBR segment (OBR-16) and should always bevalued. If it is not present in the ORC, then it should definitely be there in the OBRsegment.

Page 75: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

ORC-21,22,23:OrderingFacility’sContactInformation

Thesefieldsareoptional.Theycontainthename,addressandthephonenumberoftheorganization that placed the order. In other words, it contains the placer’s contactinformation.Thesefieldsbecomerelevantiftheorderisgoingtoanexternalorganizationforprocessing,forexampleaprivatelab.

OBR–OrderDetailSegmentTherearemanydifferentflavorsoforderdetailsegmentbutthemostcommonflavoris

theOBRsegment,whichwewilldiscusshere.Itisusedextensivelyinlab,radiologyandothergeneralordermessages.

AnOBRcanbeseenasabridgesegmentbetweenorderand resultmessages. It isliketherequisitionformthatgoeswithanorderandcomesbacksignedandfilledwiththeresult.

Some important fields in the OBR segment, from the placer point of view, arediscussedbelow.

OBR-2&OBR-3:PlacerOrderNumber/FillerOrderNumber

Asdiscussedearlier,OBR-2(PlacerOrderNumber)isaduplicateoftheORC-2field.Itholdstheuniqueplacerordernumber.

Similarly, OBR-3 (Filler Order Number) is the unique filler order number. It is aduplicateoftheORC-3field.

OBR-4:UniversalServiceIdentifier

This is the most important field in an order message. It is a required field and ismandatory because it holds the order code forwhatever is being ordered.Without thiscode,fillerwon’tknowwhattheorderisfor.

OBR-7&OBR-8:ObservationDate/Time&ObservationEndDate/Time

These fields are relevant only in situationswhere a sample is being collected for anorder(bloodforablood test)oranobservation isbeing taken(bodytemperature,bloodpressure, etc.). If the observation is taken over a period of time, then bothOBR-7 andOBR-8arepopulated.For cases that are a singlepoint in time, such asgetting abloodsample,thenonlyOBR-7ispopulated.

OBR-16:OrderingProvider

This field contains the identifying information of the doctor/healthcare providerwho

Page 76: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

placed theorder. It isaduplicateofORC-12.Theorderingprovider informationshouldalwaysbepresent in anordermessage. If it is notpresent in theORCsegment, then itshoulddefinitelybevaluedintheOBRsegment(OBR-16).

OBRsegmenthasmanyotherimportantandcommonlyusedfields,suchasOBR-22(ResultStatusChangeDate/Time)andOBR-25(ResultStatus)buttheyarepopulatedbythe filler system and sent back with the result message.We discuss them in the resultmessage.

ResultMessage–ObservationReportingResultmessages complete the communication loop between the placer and the filler

applications.Earlier,wesawordermessagesbeingusedbyplacerstoelectronicallyorderforsuppliesandservices.Manyoftheseordersgenerateobservationsandresultsthatthefillersendsbacktotheplacer.HL7messagesthatcarrytheseresultsareknownasresultmessages.

Unlike orders, there is just one type of result message, ORU^R01 (UnsolicitedObservationMessage). This message type is used extensively for sending all kinds ofresults - lab results, patient observations, clinical reports and many others. There isanother typeofresultmessage,OUL^R21,forautomatinglabsystems,butIhaveneverseenitused.Wedon’tneedtowastetimeonit.

TheresultmessageiscoveredindetailinChapter7oftheHL7spec.Itusesmanyofthe same segments used by othermessage types (PID, PV1,ORC andOBR) but alsodefinesaveryimportantsegment,theOBX(Observation/ResultSegment).OBXsegmentisforthedatainaresult.

Togetagoodhandleontheresultmessage,youwillneedtoknowhowresultsareorganizedinanHL7message.

There are two ways in which a result/observation is reported through HL7. Textorientedreports(Narratives)andstructuredreports.Textorientedreportsareformattedforhuman readability, so they are like a paper report with sentences and paragraphs.Structuredreports,ontheotherhand,aremeantforprocessingbythesoftware.Here,thecontentofthereportisdistributedwithinthefieldsofthesegments.

BothstructuredandtextorientedreportsaresentasORU^R01messagesandfollowthesamemessagestructure.ThedifferenceliesinthewayOBXsegmentsarepopulated.WewilllookatthisdifferencewhenwediscussOBXsegment.

Information in a result message is organized in a hierarchy. At the top of thehierarchyisthepatient,whichisrepresentedbythePIDsegment.Eachpatient(PID)canhaveoneormoreresult(OBR)inthemessage.

TheOBR segment acts like the report header. It contains attributes common to allresults in a set of tests. For thosewho don’t know, lab tests& diagnostics are usuallyorderedasaset(orabatteryorapanel)ofmanyseparatetests.Whenadoctorordersforthe“vitals”ofapatient,whatsheisaskingforisthebloodpressure,pulseandtemperatureof the patient. An order for an “electrolytes panel”means a blood test tomeasure the

Page 77: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

levels of sodium, potassium, chloride and carbon dioxide in the blood. All these areindividualtestswiththeirownresults.

IndividualtestresultsarewrittenintheOBXsegment.OneOBXsegmentholdstheresult for one test. So, a report for an “electrolytes panel”will have one header (OBR)followed by four OBX segments with the result for sodium, potassium, chloride andcarbondioxidelevelsintheblood.

Torecap,atthetopofthehierarchyisthePIDsegmentrepresentingthepatient.EachPIDcanhaveoneormoreOBRsegments,whichistheheaderforaresultset.EachOBRcanhaveoneormoreOBXsegments to capture the result of individual testswithin anorder.

Thehierarchydoesn’tendhere.YoucanhaveanSPM(Specimen)segmentundertheOBXwhichitselfcanhaveOBXsunderit.Itdoesgetcomplicated,butforanoverviewthePID-OBR-OBXhierarchyisgoodenough.Thisgivesyouthefootholdtolearnfurther.

Let’srevisittheOBRsegmentnowfromthefillerpointofview.

OBR–ObservationRequestSegmentInaresultmessage,anOBRsegmentservesasthereportheaderforatest.Amessage

canhavemultipleOBRsegments,whichjustmeansthat themessagecontainsresult formultipleordersets.

TheOBRsegmentalsoactsliketheturnarounddocumentbetweentheplacerandthefiller systems.TheOBR in theordermessagecontains fieldspopulatedby theorderingsystem(placer).ThefillersystemusesthesameOBRintheresultmessageandpopulatesadditionalfillerfieldsandsendsitbacktotheplacersystem.

A great example is theOBR-2/OBR-3 pair. TheOBR-2 field holds the Placer ID,whichispopulatedbytheplacer.TheOBR-3fieldisleftemptywhenthisordermessageissent.Whenthefillerrespondseitherwithanacknowledgementortheresult,itpopulatestheOBR-3fieldwiththeFillerID.KeepinmindthattheresultmessagealsoretainstheOBR-2valueoriginallypopulatedbytheplacer.

SomeotherfieldscommonlypopulatedbythefillerinanOBRsegmentinclude:

OBR-22:Date/TimeofResultReportorStatusChange

Thisfieldcontains thedate/timewhentheresultbecameavailableor thestatusof theresultchanged.Inotherwords,itrepresentsthereportdate.Itscounterpart,orderdateispopulatedbytheplacerintheOBR-6field.Together,OBR-6andOBR-22canbeusedtocalculatetheturnaroundtimeforanorder.

OBR-24:DiagnosticServiceID

This is another commonly populated field in the result message. It represents thedepartmentthatperformedthetest.Thefieldcontainsatwoorthreelettercodeforvarious

Page 78: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

services.YouwillseevalueslikeMB(microbiology)orRAD(Radiology)inthisfield.

OBR-25:ResultStatus

ThisfieldholdsthestatusoftheresultandisarequiredfieldintheOBRsegmentoftheresultmessage. It is an important field and if you are going to beworkingwith resultmessages,thisisonefieldyouwillbelookingupfrequently.

An important thing to keep in mind is that this field represents the status of aparticularordersetandnotalltheordersinamessage.TherecouldberesultformultipleordersetsinaresultmessageandbecauseofthattherewillbemultipleOBRsegmentsinthemessage.EachOBR-25representsonlytheoverallresultstatusforitsownorderset.

OBX–ObservationResultSegmentIftheOBRsegmentisliketheheaderofanorderedresultthentheOBXsegmentis

thebodyoftheresultandholdstheactualresultdata.SinceoneOBXsegmentcanholdinformationonlyforasingleobservation,eachOBRsegmentisgenerallyassociatedwithmultipleOBXsegments.

OBX-1:SetID

UnlikeothersegmentsthathaveSetID,itisausefulfieldintheOBXsegment.Itisthesequence number,which goes up by one for each successiveOBXunder anOBR. ForOBXsassociatedwithanotherOBR,thenumberingrestartsatone.ThismakesiteasytoreadarawHL7message.

OBX-2:ValueType

Thisfielddefinesthedatatypeoftheresultfield(OBX-5).Iftheresultisintheformofa narrative report, then the value in this field is always TX (code for text data). Forstructuredreports,thevalueisusuallyCE(codedEntry)butitispossiblethatyoumayrunintoadifferentvalue.

OBX-3:ObservationIdentifier

Ifyouremember,ordersetsandindividualordersarerepresentedbycodesinanHL7message.UsuallyLOINCcodesareusedtorepresenttheseorders.

ThecodefortheoverallordersetisintheOBR-4fieldbutforindividualordersthatmakeuptheorderset,theircodesareintheOBX-3field.EachOBX-3holdsthecodeforoneindividualorder.

OBX-5:ObservationValue

Page 79: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Thisisthefieldthatholdstheresultofthetest.Thereisnolimitonthelengthofthisfield. For narrative reports, this is where the sentences of the report go. Sentences arebrokenupintomultipleOBX’ssothatitlookslikeanicelyformattedparagraph.

OBX-6:Units

ThisfieldidentifiestheunitofmeasurementforvaluesintheOBX-5field.Ifsomethingisbeingreportedas“1ml” then“1”willbe in theOBX-5fieldand“ml”willbe in theOBX-6field.

OBX-11:ObservationResultStatus

Thisisarequiredfieldthatisveryimportant.Itcontainsthecodeforthestatusoftheresult.Thisfieldisusedextensivelyinmanagingrecordssuchasupdatinganoldrecord,correctingawrongresultormarkingaresultasfinal.

In real life,youdon’t justgetonemessagewith the resultof theordered test. It ismoretypicaltofirstreceiveapreliminaryresult.Then,maybethereisacorrectiontothattestandacorrectedresult issent.The labmaydecide to run the testsagainand issueafinal result.All these results are sentoneafter theother.So, it isquitepossible that anorderwillspawntwoorthreeresultmessages.

Avalueof“P”inthisfieldmeanstheresultis“Preliminary”.“C”meanstheresultisa“correction”ofapreviouslyreportedresultand“F”meansthisisthefinalvalueoftheresult.

Page 80: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

10.OtherImportantTopicsWehaven’ttouchedonsomeimportantHL7topicsyet.Butthatisintentional.Theyare

important tounderstandingHL7,but inmyopinion, throwinganewcomeroff thedeepend is not the right way to teach someone to swim. Learning doesn’t have to be afrighteningexperience.

Sohereatthedeepend,let’sfirstlookatdatatypes.DatatypesareanintegralpartofHL7.Thereisawholechapter(2A)dedicatedtothemintheHL7spec.

HL7DataTypeInHL7youhaveyourusualdatatypessuchastextandnumericbutthenyoualsohave

datatypesforname,address,visitinghours,frequencyofmedicationandothervaluesthatarenotnormallyconsideredadatatype.

Ifyouarethinkingthatthedatatypefornameshouldbejusttext,thenyoudohaveapoint.However,inHL7,datatypestakeonabiggerrole.Theyareusedtogainaveryfinecontrolover thestructureofafield-howit isdefined,and to imposerestrictionson itscontent.Forregulardata types,youonlyhaverestrictiononthe typeofvalue(Boolean,textornumeric).WithHL7,therestrictionsgowaybeyondjustthetypeofvalue.Thereare restrictions on the length, on how the content is organized,when a value has to bepresentetc.

Rememberthebuildingblocksofamessage?Amessageisacollectionofsegments,whichisacollectionoffields,whichisacollectionofcomponentsandsoon.Datatypescome into play at the field level.Whether a field has components and sub-componentsdependsentirelyonthedatatypeofthatfield.Ifadatatypehasfivecomponentsandtwoof those components are furthermadeupof subcomponents, then the field inherits thatproperty. It can be said that the field has five components and two of those havesubcomponents.

Ifyoulookat theattributetableofanysegment, thethirdcolumnwiththeheadingDTisthedatatypecolumn.Itcontainsthedatatypecodeforfieldsinthatsegment.Thecodesareusuallytwoorthreecharactersinlengthandarealwaysinuppercase.

Chapter 2A of the specification document defines all the data types in HL7. Fordetailsofaparticulardatatype,youwillneedtolookinChapter2A,wheretheyarelistedinthealphabeticalorder.

IconsiderithighlyunlikelybutifyoudospendtimebrowsingChapter2A,youwillnoticethatsomedatatypesareverysimple.Theyhavejustonecomponent.Thesearethefamiliar data types - ST (String),NM (Numeric), TX (Text) etc.Others data types usethesebasictypestoformmorecomplextypesandthenyouhavethescaryoneswhicharemadeupof both simple and complexdata types.They are the poster children forwhatscarespeopleawayfromHL7.

Iliketoorganizedatatypesintobasic,intermediateandcomplexcategories.Basicisthesimplestdatatypewithjustonecomponent.Thenyouhavetheintermediatetypeswith

Page 81: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

multiplecomponentsofbasictypeandfinally,thereisthecomplexdatatype,whichisamixofbothbasicandintermediatetypes.

Let’slookatanexampleofeach.

NM–NumericDataType

This is an example of a basic data type.A fieldwith this data type can only havenumericvalueswithamaximumlengthofsixteencharacters.Italsoallowsaleadingsign(+/-)andadecimalpointwithinthevalue.(Examples:21and+33.90).

NR–NumericRangeDataType

This is an intermediate level data type. It has two components, both ofwhich arebasicNMdata types.A fieldwith this type defines a range of value by specifying thelowestpossibleandthehighestpossiblevalueintherange.

Asyou can see in the table, the first component is always the lowvalue andbothcomponentsareoptional.Forexample ifafield looks like70^110thenthevaluerangesfromalowof70toahighof110.

PTA–Policytypeandamount

This is an example of a complex data type. There aremultiple componentswheresomehavetheirowncomponents(MOP).Acoupleofcomponentsalsohaverestrictionsonthevalue.LookatcolumnTBL#.Thefirsttwocomponentscanonlyhavethevalueslistedinthosetables.

ButIamnotgivingyouatruepictureofcomplexdatatypeswiththisexample.Manyof them, likeXCN andXAD, are trulymonstrous and contain tens of components andsub-components.

UsingDataTypes

Page 82: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

Sofarwehaveonlydealtwiththetheorybehinddatatypes.Inpractice,wedon’tdealwithallthiscomplexity.Let’stakeonecomplexdatatypeandseehowitisreallyusedinarealworldapplication.

ImagineyouaremappingthePIDsegmentforamessage.Sonowyouhavetogetallthepatient related informationmappedout.Whenyoucometo thePID-5field,youseethatit’sthepatientnamefieldandthedatatypeisXPN.Thismeansthepatient’snamehastobewrittenaccordingtoXPNdatatyperequirements.Youcannotjustdropthenameasonelongstring.Thereceivingsystemwillrejectthemessage.

Sohowdoyoumap thepatient’s name? This informationwill be in the interfacespecandinterfacespecsarebasedonHL7specs.Somoreoftenthannot,datatypesaredefinedexactlyaccordinglytoHL7spec.Assumingthatisthecase,letsheadtoChapter2AandscrolldowntowherethecomponenttablefortheXPNdatatypeisdefined.

Whatwe have here is a data typewith fourteen components.A look at the fourthcolumn (OPT),whichdefineswhetheracomponent is requiredoroptional, tellsus thateverything isoptional. (O isoptionalandB isbackwardcompatibility/previousversion,ignoreB).Thisiswhatmakeslifeeasy.

Ifthenameofthepatientis“TommyBoy”thenallyouwillneedtopopulatearethefirsttwocomponentsasBoy^Tommy.Youcanignoretherest.

Why is that?BecauseXPNdata type requires the firstcomponent tobe the familyname.Thenyouhaveacomponentseparator^followedbythegivennameinthesecondcomponent.That’swhyTommyBoy’snameiswrittenasBoy^Tommy.

Byleavingouttherestofthecomponentsinthenamefield,weareindicatingthattheremainingcomponentsareempty.

Let’saddalittletwisttothename.Say,TommyBoy’sfullnameis“TommyBoyJr.”.Nowthereisasuffixinthenameandifyourefertothetableabove,suffixshouldgointhefourthcomponent.Inthiscase,thenamewillbewrittenasBoy^Tommy^^Jr.Therearetwocaretssidebyside(^^) in thisname.This is to indicate that the thirdcomponent isemptyand“Jr.”isthevalueinthefourthcomponent.

Doyou see nowwhy I said youdon’t have to dealwith all the complexity?Mostnamesaresimpleandthatmeansonlythefirstthreeorfourcomponentsarepopulatedandwe ignore the rest. The same is true for other data types. If you do come across an

Page 83: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

unfamiliar component populated in a field, a quick visit to Chapter 2A will solve theproblem.

Also, the80-20 ruleworksverywellwithHL7data types.Onlyahandfulofdatatypes are commonly used. We can safely ignore the vast majority. Here are a fewcommonlyusedexamples.

CodedElement(CE)

This is a very commondata type inHL7, but to theuninitiated, itmeansnothing.Afieldwiththisdatatypecanonlyhaveacodedvalue.AnexamplewouldbeLOINCcodeforlabresult.

Whenlabtestsarereportedelectronically,theydon’tuselongdescriptivesentencestoreporttheirfindings.Instead,alphanumericcodesareusedtorepresentthetypeoftest.It is thesecodesalongwith the resultvalues thataresentacross inanHL7message.Afield with a CE data type means it can only contain valid codes defined by a codingsystem(likeLOINC).YoucanalsodefineyourownlocalcodesandusethatinaCEfield.

Thereareacoupleofvariationstothisdatatype.CNE(CodedwithNoException)datatypemeansthefieldcanonlyhavethosecodesthataredefinedbythecodingsystem.CWE(CodedWithException),on theotherhand,allowscodes tobedefined locally inordertoextendthecodingsystem.

CodedValue(ID–forHL7tables;IS–forusertables)

WheneveryoucomeacrossafieldwithanIDorISdatatype,itmeansthereisatablelinkedtothisfield.Youcanfindthetablenumberintheattributetableforthatdatatype.ItisafourdigitnumberundertheTBL#column.InHL7,everytableisassignedauniquefourdigittablenumber.

Thereasonwehavetablesisbecausetherearemanyfieldswhereitisnecessarytodefineastandardsetofvalues.Forexample,considerthecaseofthe“sex”field.Wecansay that valid values in this field aremale, female and unknown.But if the text is notstandardized,itwillleadtoallkindsofvariations.Guyandgal,forexample.

For some of the fields, HL7 sets the values and defines the table. An example isTable0003,whichcontainsalistofallvalideventcodes.TheEVN-1fieldcanonlytakevaluesfromthistable.

Forothers,HL7definesasuggestedlistofvaluesinatable.Itislefttothesitestodecide if theywant to use those values,modify themor create their ownvalues.Table0001(AdministrativeSex)isagoodexample.

And finally, there are fields like “Pre-Admit Test Indicator” (PV1-12) where thevaluescanonlybedefinedlocally.HL7onlyassignsthetablenumber(0087).

MergeMessages

Page 84: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

MergemessagesareasubsetofADTthatdealspecificallywithmergingpatientrecordsin a database.Thesemessages are for recordhousekeepingbut that shouldnot lull youintothinkingthattheyarenotimportant.Farfromit.Theyareusedoftenandchancesarehigh that youwill encounter them someday.AnyHL7 expertworth his/her salt shouldunderstandmerge. In fact, that is howwe used to test the level of expertise of a newcolleague.

There are three kinds of operations where merge messages are used: merging thecontent of two records into one,moving a child record from one place to another andchangingtheIDofarecord.

Beforewegoanyfurther, let’srecaphowhealthrecordsareorganized.Attheverytopisthepersonrecord.Apersoncouldbeapatient,arelative,adoctor,etc.Ifthepersonisapatient, thenthepatientrecordsitsunderthepersonrecord.Eachpatientrecordcanhaveone ormore account records to track resources used (for example, an account forrecurringdialysisvisitsandaseparateoneforanemergencyvisit).Eachaccountcanhaveoneormorepatientvisitrecordslinkedtoit.Visuallythisiswhatthehierarchywilllooklike.

There are situationswhere thisneat hierarchyof recordsgets tangledup.ConsiderthecaseofMr.RockyRacoon.Hepaysavisittothehospitalwithadislocatedshoulder.The registration clerk looks up the hospital system to see if he has a record.None arefound, so a new patient record is created for Rocky. This is where the problem starts.Rockyhasbeentothathospitalbeforeandhasanexistingpatientrecord.Theregistrationclerksearchedforhisname incorrectlyeven thoughRocky toldhimspecifically thathespellshislastnamewithasinglec-RacoonandnotRaccoon.Ofcourse,thesystemdidnotfindhisname,andnow,therearetwopatientrecordsforRocky.Ifonlywecouldtakethehumanfactorout!

ThisisacaseofmultiplerecordsforthesamepersonanditisresolvedbymergingthenewrecordwithRocky’searlierpatientrecord.Basically,itmeansmovingtheaccountandvisitrecordsfromunderthenewpatientrecordtotheoldpatientrecordanddeletingthenewrecord.

AdifferentsituationcouldbethatthereisanotherguyRockyRaccoonandhedoesspellhisnamewithadoublec.Inthatcase,ourRocky’saccountandvisitinformationisattached to thewrong patient record. This is resolved bymoving the account and visitrecordstothecorrectpatientrecord.Thisisamoveoperation.

Finally, there is the situation of an incorrect identifier assigned to a record. Thisdoesn’t happen anymore because identifiers are assigned automatically by the systems.Butbackinthedayswhenidentifiersweremanuallycreated,thiswasarealissue.Say,a

Page 85: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

hospital required all patient numbers to be seven characters in length and startwith analphabet.Anewemployee,notknowinganybetter,createsarecordwherepatientnumberisonlyfivecharactersinlengthanddoesn’tstartwithanalphabet.Thiswillbeachangeoperation.

Now thatweunderstandwhat is involved inamergeoperation, let’s seehowHL7messagesfacilitatethis.Altogether,eighteendifferenttriggereventsaredefinedformerge,moveandchangeoperations,halfof thoseare just legacy triggers.HL7 isa lot like theDNA,therearemanybasepairs thatdonothingbutprobablywereusefulatsomepointduringevolution.

TriggereventsA18,A30,A34,A35,A36,A39,A46andA48aretheretomaintainbackward compatibility.Of the rest, three trigger events are formerge operation (A40,A41 & A42), three for move (A43, A44 & A45) and the remaining four for changeoperation (A47, A49, A50 & A51). Merge operations are the most important andfrequentlyused,sowewilltakeacloserlookatthem.

Thereare threedifferentmergemessages - eventA40 is formergingat thepatientrecordlevel,A41isformergingat theaccountlevelandA42isformergingat thevisitlevel.

All threehave similarmessage structures and themost important segment in thesemessages is the merge segment (MRG). It has three important fields: MRG-1 (priorpatientID),MRG-3(prioraccountnumber)andMRG-5(priorvisitnumber).Thesefieldsidentifyrecordsthathavetobemerged.

Thisishowthemergeprocessworks.

Everymergemessagehas aPIDandanMRGsegment (andaPV1 segment if themerge is at the visit level). Their content includes the identifiers of the records to bemerged.

The record, which will continue to exist, is called the surviving record and itsidentifieris inthePIDsegment.Therecordthatwillbemergedisthenon-surviving(orprior)recordanditsidentifierisintheMRGsegment.

Foramergeatthepatientrecordlevel,thesurvivingpatientIDisinthePID-3fieldandthenon-survivingIDisintheMRG-1field.OtherMRGfieldsstayempty.ThistellsthereceivingapplicationtokeepthepatientIDinPID-3andmoverecordsunderMRG-1to PID-3. How records are moved is decided by the receiving application. This is adatabaseoperationandHL7leavesitatthediscretionoftheimplementers.

Similarly, if two patient accounts are being merged then the surviving accountnumber goes in PID-18 and the non-surviving account number goes in MRG-3. Formergesatthevisitlevel,thesurvivingvisitnumbergoesinPV1-19andthenon-survivingvisitnumbergoesinMRG-5.

QueryMessagesAlthoughnot aswidely used,HL7querymessages play an important role in clinical

systemcommunication.Theycouldbeusedbyanancillarysystemtoconfirmtheidentity

Page 86: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

ofadoctorwiththeproviderregistryorareportingapplicationcouldusethemtorequestforalistofpatientsvisitingemergencybetweenmidnightand8:00AM.

Thestandardonlydefines thebroadframeworkfor implementingqueryusingHL7messages.Details,liketheinformationtobesharedandtheparameterstobesupplied,arelefttotheimplementerstodecide.

Queriesareimplementedasarequest/responsemessagepair.TherequestingsystemsendsanHL7message to thesourcesystemwithsearchparameters.Thesourcesystemusestheseparameters to lookfor the informationin itsdatabaseandsendsbackanotherHL7messagewiththeinformation(oranerrormessageifnothingwasfound).

Querymessageshavebeenchangingandevolvingovertheyears,andcurrentlythestandarddefinesthreewaysthatarequestorcanaskforinformationandthreewaysthatasourcecanprovidetheinformationbacktotherequestor.

First, lets look atways to ask for the information (defining a query).A requestingsystemcancreateaqueryasaquerybyparameter(QBP),aquerybyexample(QBE)oracomplexexpressionquery(QSC).

Allthreeoptionsuseasegmentcalledparameterdefinitionsegment(QPD),tosupplythe details of the query. For those familiar with databases, the process is similar toinvokingastoredprocedurebysupplyingtheprocedurenameandparameters.Forthoseunfamiliar, a stored procedure is a pre-defined querywith a name. They are useful forfrequentlyusedquerieswhereinsteadofdefiningthequeryagainandagain,youdefineitonce,giveitashortname,andwheneveryouneedtorunit,youjustcalltheshortnamewithparameters.

Here is an example. Suppose all patient demographic records are stored in a tablecalledpt_dem.Ifyouwantalistofpatientsbytheirmaritalstatus,thenyoudefineaquery-“getall lastnameand firstname frompt_dem tablewheremarital status is=x”.Themaritalstatusfield(x)istheparameterthatissuppliedwiththequery.Thisquerycanbesaved as a stored procedure. You can give it a name, for examplepatient_list_by_marital_status,andwheneveryouwantalistofpatientsbymaritalstatus,yourunthisquery.

Now, do you want a list of patients who are single? No problem. Callpatient_list_by_marital_statuswherex=single.Simple!

QuerybyParameter(QBP)

This is thesimplestmethod.Themessagesupplies thequerynameandparameters intheQPDsegment.Thesysteminvokesthequeryandplugsintheparameter,forexample,QPD|Z05^patient_list_by_marital_status||single

QuerybyExample(QBE)

ThismethodissimilartoQBPwiththedifferencethattheparametersarenotsentinaQPDsegment.Theyaresentintheirrespectivesegmentfields.Soinsteadofsendingthe

Page 87: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

value“single”inaQPDsegment,aPIDsegmentwillbeaddedtothemessageandPID-16,which is themaritalstatusfield,willbepopulatedwith thevalueS(forsingle).Forexample,QPD|Z05^patient_list_by_marital_status||

PID||||||||||||||||S

Theadvantageof thismethod is that systemsdon’t have to communicatewhat theparameteris.Inthefirstmethod,thereceivingsystemhastobetoldbeforehandthatQPD-3 is the field formarital status.Otherwise, itwon’t knowwhat thevalue is for and thesituationgetsworseiftherearemultipleparameters.

InthecaseofQBE,thereisnoneedforanyofthis.PID-16isthemaritalstatusfielddefinedbyHL7.Thisisuniversallyknownandthereceivingsystemusesthisknowledgetointelligentlyextracttheparameterfromthemessage.

ComplexExpressionQuery(QSC)

This is the most complex of the three methods. In this case, the requesting systemdefinestheexactsearchcriteriaofthequeryasanexpressionsimilartodatabaselanguageSQL.Thefield,QPD-3,holdstheexpression,butthedatatypeofQPD-3inthiscaseisQSC(QuerySelectionCriteria).

TheQSCdata typehasfourcomponents: fieldname,operator,valueandrelationalconjunction.Thesefourcomponentsareused to formthesearchexpression thatgoes intheQPD-3field.Forourquery,thefieldisPID-16(maritalstatus),theoperatorisequal(EQ) and the value is “single”. There are no relational conjunctions (AND, OR, etc.)thereforethequerysegmentwilllooksomethinglikethis:QPD|Z05^patient_list_by_marital_status||@PID.16^EQ^Single|

Eachmethod has its advantages and disadvantages. If youwant something simpleandstraightforwardtoimplement,yougowithaQBP.Ontheotherhand,aQSCisbestsuited for situations that require a lot of flexibility and the ability to define complexqueriesandextractveryspecificinformation.

Now,let’slookatthreewaystosendtheinformationbacktotherequestingsystem.Theoptionsare–Tabular,DisplayandSegmentPatternformats.

Tabularformatisasimpleandeasytoprocessoption.Dataisreturnedasatableinthemessage.ColumnheadersgointheRDF(TableRowDefinition)segmentandrowsgoinrepeatingRDT(TableRowData)segments.Thismakesitveryeasyforthereceivingsystemtoparsethesegmentsandreconstructthetable.

DisplayformatissimilartoTabularbutisalsopre-formattedforhumanreadability.Itcanbeeasilydisplayedonascreenorprintedout.Theresultcomesacrossas repeatingDSP (DisplayData) segments in the responsemessage.TheDSP-3 field holds the pre-formatteddata,whichcanbesentdirectlytoaprinteroracomputerscreenfordisplay.

Segment Pattern format is different. It sends the result through standard HL7segments.Soifaqueryisforpatientrecords,thoserecordsarereturnedasPIDsegmentsin the responsemessage. If there aremultiple records, thenmultiple PID segments are

Page 88: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

returned.

TheSegmentPatternformatisgreatforcomplexandlargeresults.Forexample,alabresultwhereentiresegmentgroups(OBR,OBXetc.)arereturnedin theresultmessage.But caseswhereonlya few fields areneeded, this formatwill addunnecessaryparsingandprocessingoverhead.

Wearenotgoingtodiscussthesegmentsinvolvedinquerymessages.Thereisalotto learn, especially if you are working with queries. The discussion here is only aprecursorforfurtherreadingonthistopicinChapter5oftheHL7spec.Inthespecyouwill also discover that there are many other message types like financial transaction,schedulingetc.thatwedidn’tdiscussinthisbook.

ThisbookisonlyanattempttopryopentheHL7doorsforyou.Andthetopicswehavediscussedsofar,morethandothejob.Sothisisgoodplacetocallitadayforthisintroductorybook.Ihopeitwasagoodreadandyouenjoyedit.

Idon’tknowwhatmotivatedyoutoreadthisbook.Ifitwasjusttogetfamiliarwiththe subject, then you are done. You can check it off your “to do” list and enjoy thatsatisfying feeling. On the other hand, if this is your first step towards mastering thesubject, thenyouare all set to step into thebravenewworldofHL7andmake it yourown.

WelcometotheworldofHL7!☺

Page 89: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

HL7Book.com

Pleasevisitthecompanionwebsitetoprovideyourfeedbackandsuggestions.

Didyouspotatypo?Oranerror?Pleasedropmealinethroughthefeedbackpage.I’llappreciateit.

Page 90: HL7 for Busy Professionals - DropPDF1.droppdf.com/files/C3Q1f/hl7-for-busy-professionals...Preface After university, I got a job with a busy, Toronto based, healthcare consulting company.

TableofContentsPreface

PartI

1.Introduction

2.WhatisHL7?

3.IntegrationConcepts

4.EvolutionofHL7

PartII

5.BasicConcepts

6.MessageBuildingBlocks

7.WorkingwithaMessage

8.ControlSegments

9.DataSegments

10.OtherImportantTopics