HL7v2.Type.CWE (HL7v2 v3.10.1)

Copy Markdown View Source

Coded with Exceptions (CWE) -- HL7v2 composite data type.

Replaces CE in v2.5+. Used when multiple coding systems may apply, the table can be extended locally, or free text may substitute for a code.

9 components:

  1. Identifier (ST)
  2. Text (ST)
  3. Name of Coding System (ID) -- Table 0396
  4. Alternate Identifier (ST)
  5. Alternate Text (ST)
  6. Name of Alternate Coding System (ID) -- Table 0396
  7. Coding System Version ID (ST)
  8. Alternate Coding System Version ID (ST)
  9. Original Text (ST)

If only free text is available, populate component 9 and leave 1-3 empty.

Summary

Functions

Encodes a CWE to a list of component strings.

Parses a CWE from a list of components.

Types

t()

@type t() :: %HL7v2.Type.CWE{
  alternate_coding_system_version_id: binary() | nil,
  alternate_identifier: binary() | nil,
  alternate_text: binary() | nil,
  coding_system_version_id: binary() | nil,
  identifier: binary() | nil,
  name_of_alternate_coding_system: binary() | nil,
  name_of_coding_system: binary() | nil,
  original_text: binary() | nil,
  text: binary() | nil
}

Functions

encode(cwe)

@spec encode(t() | nil) :: list()

Encodes a CWE to a list of component strings.

Examples

iex> HL7v2.Type.CWE.encode(%HL7v2.Type.CWE{identifier: "I48.0", text: "Paroxysmal atrial fibrillation", name_of_coding_system: "I10"})
["I48.0", "Paroxysmal atrial fibrillation", "I10"]

iex> HL7v2.Type.CWE.encode(nil)
[]

parse(components)

@spec parse(list()) :: t()

Parses a CWE from a list of components.

Examples

iex> HL7v2.Type.CWE.parse(["I48.0", "Paroxysmal atrial fibrillation", "I10"])
%HL7v2.Type.CWE{identifier: "I48.0", text: "Paroxysmal atrial fibrillation", name_of_coding_system: "I10"}

iex> HL7v2.Type.CWE.parse([])
%HL7v2.Type.CWE{}