Functions for generating blood types.
Provides utilities to generate random blood groups, blood types, and Rh factors following the ABO and Rh blood group system classification.
Summary
Functions
Returns both possible Rh factors.
Returns all 4 blood types in the ABO system.
Generates a random blood group.
Generates a random blood type in medical notation.
Generates a random Rh factor.
Generates a random blood type.
Functions
@spec all_rh_factors() :: [String.t()]
Returns both possible Rh factors.
Examples
iex> NeoFaker.Blood.all_rh_factors()
["+", "-"]
@spec all_types() :: [String.t()]
Returns all 4 blood types in the ABO system.
Examples
iex> NeoFaker.Blood.all_types()
["A", "B", "AB", "O"]
Generates a random blood group.
Combines a blood type (A, B, AB, or O) with an Rh factor (+ or -).
Options
:format(:group,:type_only, or:rh_only) - which part of the blood group to return. Defaults to:group.
Examples
iex> NeoFaker.Blood.group()
"B+"
iex> NeoFaker.Blood.group(format: :type_only)
"O"
iex> NeoFaker.Blood.group(format: :rh_only)
"-"
Generates a random blood type in medical notation.
Returns a descriptive string combining the ABO type and Rh factor.
Options
:verbose(boolean) - whentrue, uses the full descriptive"Type X, Rh Y"form instead of"X Y". Defaults tofalse.
Examples
iex> NeoFaker.Blood.medical_notation()
"B positive"
iex> NeoFaker.Blood.medical_notation(verbose: true)
"Type AB, Rh positive"
@spec rh_factor() :: String.t()
Generates a random Rh factor.
Returns either "+" (positive) or "-" (negative).
Examples
iex> NeoFaker.Blood.rh_factor()
"+"
@spec type() :: String.t()
Generates a random blood type.
Returns one of the four ABO blood types: "A", "B", "AB", or "O".
Examples
iex> NeoFaker.Blood.type()
"B"