ex_l7 v0.2.0 ExL7.Validation

Module to check if HL7 messages are valid.

Summary

Functions

Checks if an HL7 message is valid

Functions

validate(hl7, segment_delimiter \\ "\r")

Checks if an HL7 message is valid.

Parameters

  • hl7: HL7 message to validate.
  • segment_delimiter: An alternative value other than \r to split message segments.

Examples

iex> ExL7.Validation.validate("")
{:error, "No Data"}

iex> ExL7.Validation.validate("MSH|")
{:error, "Invalid Header"}

iex> ExL7.Validation.validate("MSH|")
{:error, "Invalid Header"}

iex> ExL7.Validation.validate("MSH|^~\\&|ExL7|iWT Health||1|||ORU^R01||T|2.4")
{:error, "No Segments Found"}

iex> ExL7.Validation.validate("MSH|^~\\&|ExL7|iWT Health||1|||ORU^R01||T|2.4\rPI\rPIDD")
{:error, "Invalid Segment(s)"}

iex> ExL7.Validation.validate("MSH|^~\\&|ExL7|iWT Health||1|||ORU^R01||T|2.4\rPID\rXFA")
{:ok, nil}