Encapsulated Data (ED) -- HL7v2 composite data type.
Used for transmitting encapsulated data from other standards (e.g., PDF, JPEG, DICOM, CDA). Common in OBX-5 when value_type is "ED".
5 components:
- Source Application (HD) -- sub-components delimited by
& - Type of Data (ID) -- Table 0191: e.g., "Application", "Audio", "Image", "TEXT"
- Data Subtype (ID) -- Table 0291: e.g., "PDF", "RTF", "JPEG", "DICOM", "x-hl7-cda-level-one"
- Encoding (ID) -- Table 0299: "A" (no encoding), "Hex", "Base64"
- Data (TX) -- the actual encoded data
Summary
Types
@type t() :: %HL7v2.Type.ED{ data: binary() | nil, data_subtype: binary() | nil, encoding: binary() | nil, source_application: HL7v2.Type.HD.t() | nil, type_of_data: binary() | nil }
Functions
Encodes an ED to a list of component strings.
Examples
iex> HL7v2.Type.ED.encode(%HL7v2.Type.ED{
...> source_application: %HL7v2.Type.HD{namespace_id: "LAB"},
...> type_of_data: "Application",
...> data_subtype: "PDF",
...> encoding: "Base64",
...> data: "JVBER..."
...> })
["LAB", "Application", "PDF", "Base64", "JVBER..."]
iex> HL7v2.Type.ED.encode(%HL7v2.Type.ED{type_of_data: "TEXT", data_subtype: "plain", encoding: "A", data: "Hello"})
["", "TEXT", "plain", "A", "Hello"]
iex> HL7v2.Type.ED.encode(nil)
[]
Parses an ED from a list of components.
Examples
iex> HL7v2.Type.ED.parse(["LAB&1.2.3&ISO", "Application", "PDF", "Base64", "JVBER..."])
%HL7v2.Type.ED{
source_application: %HL7v2.Type.HD{namespace_id: "LAB", universal_id: "1.2.3", universal_id_type: "ISO"},
type_of_data: "Application",
data_subtype: "PDF",
encoding: "Base64",
data: "JVBER..."
}
iex> HL7v2.Type.ED.parse(["", "TEXT", "plain", "A", "Hello world"])
%HL7v2.Type.ED{type_of_data: "TEXT", data_subtype: "plain", encoding: "A", data: "Hello world"}
iex> HL7v2.Type.ED.parse([])
%HL7v2.Type.ED{}