ZSchemas.Flat.Contact (Portico/Z v0.1.0)

Data structure + validation for flat Contacts

"Flat" means that it combines a lot of tables into one, either for analytics or lookup purposes. In the case of Contacts, we're pulling related address, email, phone, etc. data right into one simple data structure for ease-of-use around the system, when the full set of related information isn't necessary.

Schema Diagram

schema diagram | dot | pdf | png | svg

Link to this section Summary

Link to this section Functions

Link to this function

first_and_preferred_last_name(contact)

Return Elixir.ZSchemas.Flat.Contact first, preferred, and last name

Examples

iex> ZSchemas.Flat.Contact.first_and_preferred_last_name(%ZSchemas.Flat.Contact{first_name: "William", preferred_name: "Billy", last_name: "Longfellow"})
"William (Billy) Longfellow"

iex> ZSchemas.Flat.Contact.first_and_preferred_last_name(%ZSchemas.Flat.Contact{first_name: "Henry", last_name: "Thoreau"})
"Henry Thoreau"
Link to this function

first_or_preferred_last_initial_name(contact)

Return Elixir.ZSchemas.Flat.Contact first/preferred name, and last initial

Examples

iex> ZSchemas.Flat.Contact.first_or_preferred_last_initial_name(%ZSchemas.Flat.Contact{first_name: "William", preferred_name: "Billy", last_name: "Zane"})
"Billy Z."
Link to this function

first_or_preferred_last_initial_name_city(contact)

Return Elixir.ZSchemas.Flat.Contact first/preferred name, last initial, and city

Examples

iex> ZSchemas.Flat.Contact.first_or_preferred_last_initial_name_city(%ZSchemas.Flat.Contact{first_name: "David", preferred_name: "Davey", last_name: "Lynch", city: "Miami"})
"Davey L. from Miami"
Link to this function

first_or_preferred_name(map)

Return Elixir.ZSchemas.Flat.Contact preferred name, or first name if empty.

Examples

iex> ZSchemas.Flat.Contact.first_or_preferred_name(%ZSchemas.Flat.Contact{first_name: "Barack", preferred_name: "Bobby"})
"Bobby"
Link to this function

first_or_preferred_name_last(contact)

Return Elixir.ZSchemas.Flat.Contact first/preferred and last name

Examples

iex> ZSchemas.Flat.Contact.first_or_preferred_name_last(%ZSchemas.Flat.Contact{first_name: "Eleanor", preferred_name: "Madge", last_name: "Roosevelt"})
"Madge Roosevelt"

Return Elixir.ZSchemas.Flat.Contact full name.

Shorthand for first_or_preferred_name_last/1

Examples

iex> ZSchemas.Flat.Contact.name(%ZSchemas.Flat.Contact{first_name: "Wendy", preferred_name: "Madonna", last_name: "of Nazareth"})
"Madonna of Nazareth"