class HealthcarePhony::Patient
Public: Randomly generate a Patient
Attributes
account_number[RW]
addresses[RW]
birth_order[RW]
cell_phone[RW]
date_of_birth[RW]
death_datetime[RW]
death_indicator[RW]
drivers_license[RW]
email[RW]
ethnic_group[RW]
gender[RW]
home_phone[RW]
language[RW]
marital_status[RW]
medical_record_number[RW]
multiple_birth_indicator[RW]
names[RW]
races[RW]
religion[RW]
ssn[RW]
work_phone[RW]
Public Class Methods
new(init_args = {})
click to toggle source
# File lib/healthcare_phony/patient.rb, line 28 def initialize(init_args = {}) define_gender(init_args) define_names(init_args) define_addresses(init_args) define_phones(init_args) define_dob(init_args) define_race(init_args) define_other define_identifiers define_birth_order define_death end
Private Instance Methods
define_addresses(init_args = {})
click to toggle source
# File lib/healthcare_phony/patient.rb, line 61 def define_addresses(init_args = {}) address_count = init_args[:address_count].nil? || init_args[:address_count] < 1 ? 1 : init_args[:address_count] @addresses = [] while address_count.positive? @addresses.push(Address.new) address_count -= 1 end end
define_birth_order()
click to toggle source
# File lib/healthcare_phony/patient.rb, line 102 def define_birth_order @multiple_birth_indicator = %w[Y N].sample @birth_order = @multiple_birth_indicator == 'Y' ? /[1-2]/.random_example : '' end
define_death()
click to toggle source
# File lib/healthcare_phony/patient.rb, line 97 def define_death @death_indicator = %w[Y N].sample @death_datetime = @death_indicator == 'Y' ? Faker::Time.between(from: @date_of_birth.to_date, to: Time.now) : '' end
define_dob(init_args = {})
click to toggle source
# File lib/healthcare_phony/patient.rb, line 76 def define_dob(init_args = {}) min_age = init_args[:min_age].nil? ? 1 : init_args[:min_age] max_age = init_args[:max_age].nil? ? 99 : init_args[:max_age] @date_of_birth = Faker::Date.birthday(min_age: min_age, max_age: max_age) end
define_gender(init_args = {})
click to toggle source
# File lib/healthcare_phony/patient.rb, line 43 def define_gender(init_args = {}) @gender = if !init_args[:gender].nil? && init_args[:gender].is_a?(HealthcarePhony::Gender) init_args[:gender] else HealthcarePhony::Gender.new(init_args) end end
define_identifiers()
click to toggle source
# File lib/healthcare_phony/patient.rb, line 91 def define_identifiers @medical_record_number = Identifier.new(type_code: 'MR') @account_number = Identifier.new(type_code: 'AN') @ssn = Faker::IDNumber.ssn_valid end
define_names(init_args = {})
click to toggle source
# File lib/healthcare_phony/patient.rb, line 51 def define_names(init_args = {}) init_args[:gender] = @gender names_count = init_args[:names_count].nil? || init_args[:names_count] < 1 ? 1 : init_args[:names_count] @names = [] while names_count.positive? @names.push(PersonName.new(init_args)) names_count -= 1 end end
define_other()
click to toggle source
# File lib/healthcare_phony/patient.rb, line 107 def define_other @language = Language.new @marital_status = MaritalStatus.new @religion = Religion.new @ethnic_group = EthnicGroup.new end
define_phones(init_args = {})
click to toggle source
# File lib/healthcare_phony/patient.rb, line 70 def define_phones(init_args = {}) @home_phone = HomePhoneNumber.new(init_args) @cell_phone = CellPhoneNumber.new(init_args) @work_phone = WorkPhoneNumber.new(init_args) end
define_race(init_args = {})
click to toggle source
# File lib/healthcare_phony/patient.rb, line 82 def define_race(init_args = {}) races_count = init_args[:race_count].nil? || init_args[:race_count] < 1 ? 1 : init_args[:race_count] @races = [] while races_count.positive? @races.push(Race.new) races_count -= 1 end end