Sidebar

What is base64 encoding?

0 votes
3.3K views
asked Dec 17, 2013 by gary-t-8719 (14,860 points)
What is base64 encoding and can you provide an example?

1 Answer

0 votes

Base64 encoding is a way to encode textual data like HL7 messages and CCD's. The technical description describes it as a way to take binary data (HL7 Messages and CCD) and representing it in a textual form, but I find this description hard to translate for how we use it in the healthcare community.

So let's look at an HL7 message. AT times you may find trading partners embedding a RTF, PDF, or HTML documents in the 5th field of an OBX segment. If these documents were not encoded with in the HL7 message they could cause problems if the document happens to have characters in it that are part of the HL7 reserved characters (e.g. |^~\&). So to protect against the RTF, PDF, or HTML documents interfering with a HL7 parser the documents would are Base64 encoded and then placed into the OBX-5 field.

In the case of a CCD interface the protocol used to transmit the CCD to the trading partners is often done with Web Services using SOAP. SOAP envelopes are simply XML, and consequently CCD’s are also in the XML format. So when sending a CCD via a Web Service using SOAP the CCD needs to be encoded before being embedded into the SOAP envelope so that the CCD XML characters don’t interfere with the Web Service SOAP XML characters.

Keeping these documents from interfering with the HL7 parsers or XML SOAP is possible because Base64 encoding only uses Alpha-numeric characters. For example let's convert the following quote to Base64 encoding.

Quote:

The HL7 special characters are |~^\&, and the special characters for XML are <>&%.

Quote Base64 Encoded:

VGhlIEhMNyBzcGVjaWFsIGNoYXJhY3RlcnMgYXJlIHx+XlwmLCBhbmQgdGhlIHNwZWNpYWwgY2

hhcmFjdGVycyBmb3IgWE1MIGFyZSA8PiYlLg==

 

Notice that the special characters for HL7 and XML are not represented in the Base64 encoded version of the Quote.

There are many Base64 encoders and decoders available online if you would like to encode or decode documents of your own. Qvera has built into the interface engine the ability to encode and decode Base64 data thereby making easy to send or receive Base64 data.

 

answered Jan 3, 2014 by gary-t-8719 (14,860 points)
...