HL7v2.Type.AD (HL7v2 v3.10.1)

Copy Markdown View Source

Address (AD) -- HL7v2 composite data type.

A simpler address type used in older HL7 versions. Superseded by XAD in v2.3+.

8 components:

  1. Street Address (ST)
  2. Other Designation (ST)
  3. City (ST)
  4. State or Province (ST)
  5. Zip or Postal Code (ST)
  6. Country (ID) -- Table 0399
  7. Address Type (ID) -- Table 0190
  8. Other Geographic Designation (ST)

Summary

Functions

Encodes an AD to a list of component strings.

Parses an AD from a list of components.

Types

t()

@type t() :: %HL7v2.Type.AD{
  address_type: binary() | nil,
  city: binary() | nil,
  country: binary() | nil,
  other_designation: binary() | nil,
  other_geographic_designation: binary() | nil,
  state_or_province: binary() | nil,
  street_address: binary() | nil,
  zip_or_postal_code: binary() | nil
}

Functions

encode(ad)

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

Encodes an AD to a list of component strings.

Examples

iex> HL7v2.Type.AD.encode(%HL7v2.Type.AD{street_address: "123 Main St", city: "Springfield", state_or_province: "IL"})
["123 Main St", "", "Springfield", "IL"]

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

parse(components)

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

Parses an AD from a list of components.

Examples

iex> HL7v2.Type.AD.parse(["123 Main St", "Suite 100", "Springfield", "IL", "62704", "USA"])
%HL7v2.Type.AD{street_address: "123 Main St", other_designation: "Suite 100", city: "Springfield", state_or_province: "IL", zip_or_postal_code: "62704", country: "USA"}

iex> HL7v2.Type.AD.parse(["456 Oak Ave"])
%HL7v2.Type.AD{street_address: "456 Oak Ave"}

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