The hl7-parser Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The hl7-parser Reference Manual

This is the hl7-parser Reference Manual, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 11:56:46 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Common Lisp HL7-Parser

HL7-Parser for HL7 Version 2 Messages (decode / encode) for Common Lisp.

The HL7 Version 2 Messaging Standard — Application Protocol for Electronic Data Exchange in Healthcare Environments — is considered to be the workhorse of data exchange in healthcare and is the most widely implemented standard for healthcare information in the world.

Source: http://www.hl7.org/about/FAQs/index.cfm?ref=nav ("General HL7 FAQ" > "Version 2" > "What is Version 2?")

License

http://opensource.org/licenses/BSD-3-Clause

Implementation

SBCL and CCL on Debian GNU/Linux

Installation

HL7-Parser is 'quickloadable':

(ql:quickload "hl7-parser")

Usage

(defun decode (string-or-stream)

hl7-parser:decode

(defun encode (message-list &key (delimiter "|^~\\&") (message-delimiter nil))

hl7-parser:encode

(defun test-parser (in-file out-file &key (external-format :iso-8859-1) (output-delimiters "|^~\\&"))

hl7-test:test-parser

Exeptionhandling and validation

Every String or Stream with at least eight Characters is parsed in a more or less reasonable way.

There are no syntax or HL7-Structure checking mechanisms.

Escaping

The HL7-Escaping works like in the most programming languages but in this case this is the wrong way.

The following escape sequences are defined in the HL7 2.5 Standard in Chapter 2.7.1:

\H\        start highlighting
\N\        normal text (end highlighting)
\F\        field separator
\S\        component separator
\T\        subcomponent separator
\R\        repetition separator
\E\        escape character
\Xdddd...\ hexadecimal data
\Zdddd...\ locally defined escape sequence

These escape sequences are not recognized correctly by the parser:

CL-USER> (hl7-parser:decode (format nil "MSH|^~~\\&|test|te\\F\\st^test|~cEVN||123~c~c" #\Return #\Return #\Newline ))
;; Evaluates to:
((:MESSAGE
  (:SEGMENT (:FIELD "MSH" "|^~\\&" "test" (:COMPONENT "te\\F\\st" "test") "")
   (:FIELD "EVN" "" "123"))))
;; Should evaluate to:
((:MESSAGE
  (:SEGMENT (:FIELD "MSH" "|^~\\&" "test" (:COMPONENT "te|st" "test") "")
   (:FIELD "EVN" "" "123"))))

The double-backslashes are needed because they are used within a string.

Issue: https://github.com/MartinEnders/hl7-parser/issues/1

Example

CL-USER> (hl7-parser:decode (format nil "MSH|^~~\\&|test|test^test|~cEVN||123~c~c" #\Return #\Return #\Newline ))
((:MESSAGE
  (:SEGMENT (:FIELD "MSH" "|^~\\&" "test" (:COMPONENT "test" "test") "")
   (:FIELD "EVN" "" "123") "")))

CL-USER> (hl7-parser:encode (hl7-parser:decode (format nil "MSH|^~~\\&|test|test^test|~cEVN||123~c~c" #\Return #\Return #\Newline )))
("MSH|^~\\&|test|test^test|^MEVN||123^M") ; ^M -> #\Return

CL-USER> (hl7-parser:encode (hl7-parser:decode (format nil "MSH|^~~\\&|test|test^test|~cEVN||123~c~c" #\Return #\Return #\Newline )) :message-delimiter t)
("MSH|^~\\&|test|test^test|^MEVN||123^M
") ; ^M -> #\Return

How to set Delimiters for encoding:

CL-USER> (hl7-parser:decode (format nil "MSH#^~~\\&#test#test^test#~c" #\Newline ))
((:MESSAGE (:FIELD "MSH" "#^~\\&" "test" (:COMPONENT "test" "test") "")))

CL-USER> (hl7-parser:encode (hl7-parser:decode (format nil "MSH|^~~\\&|test|test^test|~c" #\Newline )) :delimiter "#^~\\&")
("MSH#^~\\&#test#test^test#")

Pay attention to the character escaping (~ in format directive and backslas


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 hl7-parser

Author

Martin R. Enders <martin@martin-enders.de>

License

BSD

Description

Decoder and Encoder for ER7 formatted HL7-Messages

Source

hl7-parser.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 hl7-parser.asd

Location

hl7-parser.asd

Systems

hl7-parser (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 hl7-parser/package.lisp

Parent

hl7-parser (system)

Location

package.lisp

Packages

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 hl7-parser/hl7-parser.lisp

Dependency

package.lisp (file)

Parent

hl7-parser (system)

Location

hl7-parser.lisp

Exported Definitions
Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.4 hl7-parser/hl7-parser-test.lisp

Dependency

hl7-parser.lisp (file)

Parent

hl7-parser (system)

Location

hl7-parser-test.lisp

Exported Definitions

test-parser (function)


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 hl7-parser-test

Source

package.lisp (file)

Use List
Exported Definitions

test-parser (function)


Previous: , Up: Packages   [Contents][Index]

4.2 hl7-parser

Source

package.lisp (file)

Use List

common-lisp

Used By List

hl7-parser-test

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: decode STRING-OR-STREAM

Returns List of HL7-Messages from String

Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: encode MESSAGE-LIST &key DELIMITER MESSAGE-DELIMITER

Requires list of Messages, Returns list of HL7-Messages in Strings

Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: test-parser IN-FILE OUT-FILE &key EXTERNAL-FORMAT OUTPUT-DELIMITERS
Package

hl7-parser-test

Source

hl7-parser-test.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: correct-msh STRING DELIMITER-STRING
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: delimiter-p CHAR DELIMITER
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: delimiter-to-keyword CHAR DELIMITER
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: escape-delimiter-p CHAR DELIMITER
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: get-next-delimiter STREAM DELIMITER
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: get-next-token STREAM DELIMITER
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: get-precedence TOKEN
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: get-string-from-stream STREAM NUMBER-OF-CHARACTERS
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: hl7-output MESSAGE DELIMITER
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: hl7-writer HL7-MESSAGES &key DELIMITER-STRING MESSAGE-DELIMITER
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: lexer STREAM
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: logging &rest REST
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: operand= A B
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: operand> A B
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: operand>= A B
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: parse-2 TOKENS
Package

hl7-parser

Source

hl7-parser.lisp (file)

Function: string-to-next-delimiter STREAM DELIMITER
Package

hl7-parser

Source

hl7-parser.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   H   L  
Index Entry  Section

F
File, Lisp, hl7-parser.asd: The hl7-parser<dot>asd file
File, Lisp, hl7-parser/hl7-parser-test.lisp: The hl7-parser/hl7-parser-test<dot>lisp file
File, Lisp, hl7-parser/hl7-parser.lisp: The hl7-parser/hl7-parser<dot>lisp file
File, Lisp, hl7-parser/package.lisp: The hl7-parser/package<dot>lisp file

H
hl7-parser.asd: The hl7-parser<dot>asd file
hl7-parser/hl7-parser-test.lisp: The hl7-parser/hl7-parser-test<dot>lisp file
hl7-parser/hl7-parser.lisp: The hl7-parser/hl7-parser<dot>lisp file
hl7-parser/package.lisp: The hl7-parser/package<dot>lisp file

L
Lisp File, hl7-parser.asd: The hl7-parser<dot>asd file
Lisp File, hl7-parser/hl7-parser-test.lisp: The hl7-parser/hl7-parser-test<dot>lisp file
Lisp File, hl7-parser/hl7-parser.lisp: The hl7-parser/hl7-parser<dot>lisp file
Lisp File, hl7-parser/package.lisp: The hl7-parser/package<dot>lisp file

Jump to:   F   H   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   D   E   F   G   H   L   O   P   S   T  
Index Entry  Section

C
correct-msh: Internal functions

D
decode: Exported functions
delimiter-p: Internal functions
delimiter-to-keyword: Internal functions

E
encode: Exported functions
escape-delimiter-p: Internal functions

F
Function, correct-msh: Internal functions
Function, decode: Exported functions
Function, delimiter-p: Internal functions
Function, delimiter-to-keyword: Internal functions
Function, encode: Exported functions
Function, escape-delimiter-p: Internal functions
Function, get-next-delimiter: Internal functions
Function, get-next-token: Internal functions
Function, get-precedence: Internal functions
Function, get-string-from-stream: Internal functions
Function, hl7-output: Internal functions
Function, hl7-writer: Internal functions
Function, lexer: Internal functions
Function, logging: Internal functions
Function, operand=: Internal functions
Function, operand>: Internal functions
Function, operand>=: Internal functions
Function, parse-2: Internal functions
Function, string-to-next-delimiter: Internal functions
Function, test-parser: Exported functions

G
get-next-delimiter: Internal functions
get-next-token: Internal functions
get-precedence: Internal functions
get-string-from-stream: Internal functions

H
hl7-output: Internal functions
hl7-writer: Internal functions

L
lexer: Internal functions
logging: Internal functions

O
operand=: Internal functions
operand>: Internal functions
operand>=: Internal functions

P
parse-2: Internal functions

S
string-to-next-delimiter: Internal functions

T
test-parser: Exported functions

Jump to:   C   D   E   F   G   H   L   O   P   S   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   H   P   S  
Index Entry  Section

H
hl7-parser: The hl7-parser system
hl7-parser: The hl7-parser package
hl7-parser-test: The hl7-parser-test package

P
Package, hl7-parser: The hl7-parser package
Package, hl7-parser-test: The hl7-parser-test package

S
System, hl7-parser: The hl7-parser system

Jump to:   H   P   S