healthcare_phony 0.6.0 → 0.7s.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +42 -42
- data/.github/workflows/ruby.yml +33 -33
- data/.gitignore +63 -63
- data/.rdoc_options +23 -23
- data/.rubocop.yml +10 -10
- data/CODE_OF_CONDUCT.md +84 -84
- data/Gemfile +8 -8
- data/LICENSE.txt +21 -21
- data/README.md +365 -351
- data/Rakefile +12 -12
- data/VERSION +1 -1
- data/examples/bigger_csv_example.erb +4 -0
- data/examples/phony_adt_sender.rb +111 -111
- data/examples/phony_adt_sender.yml +12 -10
- data/examples/phony_csv.yml +5 -0
- data/healthcare_phony.gemspec +36 -36
- data/lib/healthcare_phony.rb +139 -113
- data/lib/healthcare_phony/address.rb +89 -89
- data/lib/healthcare_phony/assigning_authority.rb +6 -6
- data/lib/healthcare_phony/cell_phone_number.rb +20 -20
- data/lib/healthcare_phony/data_files/address_type.yml +7 -7
- data/lib/healthcare_phony/data_files/adt_event_types.yml +59 -59
- data/lib/healthcare_phony/data_files/degree.yml +9 -9
- data/lib/healthcare_phony/data_files/discharge_disposition.yml +15 -15
- data/lib/healthcare_phony/data_files/ethnic_group.yml +9 -9
- data/lib/healthcare_phony/data_files/hl7_message_types.yml +4 -4
- data/lib/healthcare_phony/data_files/language.yml +7 -7
- data/lib/healthcare_phony/data_files/marital_status.yml +49 -49
- data/lib/healthcare_phony/data_files/mdm_event_types.yml +12 -12
- data/lib/healthcare_phony/data_files/oru_event_types.yml +2 -2
- data/lib/healthcare_phony/data_files/race.yml +13 -13
- data/lib/healthcare_phony/data_files/religion.yml +250 -250
- data/lib/healthcare_phony/data_files/tele_equipment_type.yml +10 -10
- data/lib/healthcare_phony/data_files/tele_use_code.yml +9 -9
- data/lib/healthcare_phony/diagnosis.rb +12 -12
- data/lib/healthcare_phony/doctor.rb +26 -26
- data/lib/healthcare_phony/email.rb +25 -25
- data/lib/healthcare_phony/ethnic_group.rb +34 -34
- data/lib/healthcare_phony/gender.rb +22 -22
- data/lib/healthcare_phony/helper.rb +72 -72
- data/lib/healthcare_phony/hl7_message.rb +159 -159
- data/lib/healthcare_phony/home_phone_number.rb +20 -20
- data/lib/healthcare_phony/identifier.rb +23 -23
- data/lib/healthcare_phony/insurance.rb +6 -6
- data/lib/healthcare_phony/language.rb +30 -30
- data/lib/healthcare_phony/marital_status.rb +31 -31
- data/lib/healthcare_phony/patient.rb +114 -114
- data/lib/healthcare_phony/patient_visit.rb +97 -97
- data/lib/healthcare_phony/person_name.rb +104 -104
- data/lib/healthcare_phony/phone_number.rb +85 -85
- data/lib/healthcare_phony/procedure.rb +6 -6
- data/lib/healthcare_phony/race.rb +31 -31
- data/lib/healthcare_phony/religion.rb +32 -32
- data/lib/healthcare_phony/templates/csv_example.erb +3 -3
- data/lib/healthcare_phony/version.rb +5 -5
- data/lib/healthcare_phony/visit_admission.rb +53 -53
- data/lib/healthcare_phony/visit_discharge.rb +62 -62
- data/lib/healthcare_phony/visit_doctors.rb +19 -19
- data/lib/healthcare_phony/visit_location.rb +106 -106
- data/lib/healthcare_phony/visit_type.rb +8 -8
- data/lib/healthcare_phony/work_phone_number.rb +20 -20
- metadata +9 -7
@@ -1,20 +1,20 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require File.expand_path('phone_number', __dir__)
|
4
|
-
|
5
|
-
module HealthcarePhony
|
6
|
-
# Public: Generates a fake home phone number
|
7
|
-
class HomePhoneNumber < PhoneNumber
|
8
|
-
# Public: Initializes a home phone number. Pass in hash of different parameters, currently this includes:
|
9
|
-
# blank - An integer representing the % of times phone number components should be blank.
|
10
|
-
# use_code - Allows specification of the phone use code (PID.13.2)
|
11
|
-
# equipment_type - Allows specification of the phone equipment type (PID.13.3)
|
12
|
-
def initialize(init_args = {})
|
13
|
-
super(init_args)
|
14
|
-
@use_code = init_args[:use_code].nil? ? 'PRN' : init_args[:use_code]
|
15
|
-
@use_code = '' unless @set_blank == false
|
16
|
-
@equipment_type = init_args[:equipment_type].nil? ? 'PH' : init_args[:equipment_type]
|
17
|
-
@equipment_type = '' unless @set_blank == false
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path('phone_number', __dir__)
|
4
|
+
|
5
|
+
module HealthcarePhony
|
6
|
+
# Public: Generates a fake home phone number
|
7
|
+
class HomePhoneNumber < PhoneNumber
|
8
|
+
# Public: Initializes a home phone number. Pass in hash of different parameters, currently this includes:
|
9
|
+
# blank - An integer representing the % of times phone number components should be blank.
|
10
|
+
# use_code - Allows specification of the phone use code (PID.13.2)
|
11
|
+
# equipment_type - Allows specification of the phone equipment type (PID.13.3)
|
12
|
+
def initialize(init_args = {})
|
13
|
+
super(init_args)
|
14
|
+
@use_code = init_args[:use_code].nil? ? 'PRN' : init_args[:use_code]
|
15
|
+
@use_code = '' unless @set_blank == false
|
16
|
+
@equipment_type = init_args[:equipment_type].nil? ? 'PH' : init_args[:equipment_type]
|
17
|
+
@equipment_type = '' unless @set_blank == false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,23 +1,23 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'regexp-examples'
|
4
|
-
|
5
|
-
module HealthcarePhony
|
6
|
-
# Public: Randomly generates an identifier.
|
7
|
-
class Identifier
|
8
|
-
attr_accessor :identifier,
|
9
|
-
:identifier_type_code
|
10
|
-
|
11
|
-
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
12
|
-
# type_code - Identifier Type Code, example PID.3.5. HL7 Data Table 0203
|
13
|
-
# pattern - Regex pattern used to randomly generate the identifier. Default is \d{10} which would generate an
|
14
|
-
# identifier like 5992657933.
|
15
|
-
def initialize(init_args = {})
|
16
|
-
@identifier_type_code = init_args[:type_code].nil? ? '' : init_args[:type_code]
|
17
|
-
|
18
|
-
identifier_pattern = init_args[:pattern].nil? ? '\d{10}' : init_args[:pattern]
|
19
|
-
|
20
|
-
@identifier = Regexp.new(identifier_pattern).random_example
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'regexp-examples'
|
4
|
+
|
5
|
+
module HealthcarePhony
|
6
|
+
# Public: Randomly generates an identifier.
|
7
|
+
class Identifier
|
8
|
+
attr_accessor :identifier,
|
9
|
+
:identifier_type_code
|
10
|
+
|
11
|
+
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
12
|
+
# type_code - Identifier Type Code, example PID.3.5. HL7 Data Table 0203
|
13
|
+
# pattern - Regex pattern used to randomly generate the identifier. Default is \d{10} which would generate an
|
14
|
+
# identifier like 5992657933.
|
15
|
+
def initialize(init_args = {})
|
16
|
+
@identifier_type_code = init_args[:type_code].nil? ? '' : init_args[:type_code]
|
17
|
+
|
18
|
+
identifier_pattern = init_args[:pattern].nil? ? '\d{10}' : init_args[:pattern]
|
19
|
+
|
20
|
+
@identifier = Regexp.new(identifier_pattern).random_example
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HealthcarePhony
|
4
|
-
class Insurance
|
5
|
-
end
|
6
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HealthcarePhony
|
4
|
+
class Insurance
|
5
|
+
end
|
6
|
+
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HealthcarePhony
|
4
|
-
# Public: Generate random Language using data from YAML file.
|
5
|
-
class Language
|
6
|
-
attr_accessor :code,
|
7
|
-
:description,
|
8
|
-
:coding_system
|
9
|
-
|
10
|
-
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
11
|
-
# language_data_file - Location of YAML file containing Language data (Code, Description, and Coding System) if a
|
12
|
-
# different set of random values is desired. Otherwise the default file {language.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/language.yml] will be used.
|
13
|
-
def initialize(init_args = {})
|
14
|
-
# TODO: allow a way for caller to pass in a custom set of codes to choose from.
|
15
|
-
# TODO: allow a way for caller to pass in % blank
|
16
|
-
|
17
|
-
data_file = if !init_args[:language_data_file].nil?
|
18
|
-
init_args[:language_data_file]
|
19
|
-
else
|
20
|
-
"#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/language.yml"
|
21
|
-
end
|
22
|
-
language_array = Psych.load_file(data_file)
|
23
|
-
random_language = language_array.nil? ? '' : language_array.sample
|
24
|
-
|
25
|
-
@code = random_language[:code]
|
26
|
-
@description = random_language[:description]
|
27
|
-
@coding_system = random_language[:coding_system]
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HealthcarePhony
|
4
|
+
# Public: Generate random Language using data from YAML file.
|
5
|
+
class Language
|
6
|
+
attr_accessor :code,
|
7
|
+
:description,
|
8
|
+
:coding_system
|
9
|
+
|
10
|
+
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
11
|
+
# language_data_file - Location of YAML file containing Language data (Code, Description, and Coding System) if a
|
12
|
+
# different set of random values is desired. Otherwise the default file {language.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/language.yml] will be used.
|
13
|
+
def initialize(init_args = {})
|
14
|
+
# TODO: allow a way for caller to pass in a custom set of codes to choose from.
|
15
|
+
# TODO: allow a way for caller to pass in % blank
|
16
|
+
|
17
|
+
data_file = if !init_args[:language_data_file].nil?
|
18
|
+
init_args[:language_data_file]
|
19
|
+
else
|
20
|
+
"#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/language.yml"
|
21
|
+
end
|
22
|
+
language_array = Psych.load_file(data_file)
|
23
|
+
random_language = language_array.nil? ? '' : language_array.sample
|
24
|
+
|
25
|
+
@code = random_language[:code]
|
26
|
+
@description = random_language[:description]
|
27
|
+
@coding_system = random_language[:coding_system]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,31 +1,31 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HealthcarePhony
|
4
|
-
# Public: Generates a random MaritalStatus using data from a YAML file.
|
5
|
-
class MaritalStatus
|
6
|
-
attr_accessor :code,
|
7
|
-
:description,
|
8
|
-
:coding_system
|
9
|
-
|
10
|
-
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
11
|
-
# marital_status_data_file - Location of YAML file containing Language data (Code, Description, and Coding System)
|
12
|
-
# if a different set of random values is desired. Otherwise the default file {marital_status.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/marital_status.yml] will be used.
|
13
|
-
def initialize(**init_args)
|
14
|
-
# TODO: allow a way for caller to pass in a custom set of codes to choose from
|
15
|
-
# TODO: allow a way for caller to pass in % blank
|
16
|
-
|
17
|
-
data_file = if !init_args[:marital_status_data_file].nil?
|
18
|
-
init_args[:marital_status_data_file]
|
19
|
-
else
|
20
|
-
"#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/marital_status.yml"
|
21
|
-
end
|
22
|
-
ms_array = Psych.load_file(data_file)
|
23
|
-
|
24
|
-
random_ms = ms_array.nil? ? '' : ms_array.sample
|
25
|
-
|
26
|
-
@code = random_ms[:code]
|
27
|
-
@description = random_ms[:description]
|
28
|
-
@coding_system = random_ms[:coding_system]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HealthcarePhony
|
4
|
+
# Public: Generates a random MaritalStatus using data from a YAML file.
|
5
|
+
class MaritalStatus
|
6
|
+
attr_accessor :code,
|
7
|
+
:description,
|
8
|
+
:coding_system
|
9
|
+
|
10
|
+
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
11
|
+
# marital_status_data_file - Location of YAML file containing Language data (Code, Description, and Coding System)
|
12
|
+
# if a different set of random values is desired. Otherwise the default file {marital_status.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/marital_status.yml] will be used.
|
13
|
+
def initialize(**init_args)
|
14
|
+
# TODO: allow a way for caller to pass in a custom set of codes to choose from
|
15
|
+
# TODO: allow a way for caller to pass in % blank
|
16
|
+
|
17
|
+
data_file = if !init_args[:marital_status_data_file].nil?
|
18
|
+
init_args[:marital_status_data_file]
|
19
|
+
else
|
20
|
+
"#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/marital_status.yml"
|
21
|
+
end
|
22
|
+
ms_array = Psych.load_file(data_file)
|
23
|
+
|
24
|
+
random_ms = ms_array.nil? ? '' : ms_array.sample
|
25
|
+
|
26
|
+
@code = random_ms[:code]
|
27
|
+
@description = random_ms[:description]
|
28
|
+
@coding_system = random_ms[:coding_system]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,114 +1,114 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HealthcarePhony
|
4
|
-
# Public: Randomly generate a Patient
|
5
|
-
class Patient
|
6
|
-
attr_accessor :names,
|
7
|
-
:medical_record_number,
|
8
|
-
:account_number,
|
9
|
-
:addresses,
|
10
|
-
:date_of_birth,
|
11
|
-
:gender,
|
12
|
-
:races,
|
13
|
-
:home_phone, # TODO: allow for > 1
|
14
|
-
:cell_phone, # TODO: allow for > 1
|
15
|
-
:work_phone, # TODO: allow for > 1
|
16
|
-
:email,
|
17
|
-
:language,
|
18
|
-
:marital_status,
|
19
|
-
:religion,
|
20
|
-
:ssn,
|
21
|
-
:drivers_license,
|
22
|
-
:ethnic_group,
|
23
|
-
:multiple_birth_indicator,
|
24
|
-
:birth_order,
|
25
|
-
:death_indicator,
|
26
|
-
:death_datetime
|
27
|
-
|
28
|
-
def initialize(init_args = {})
|
29
|
-
define_gender(init_args)
|
30
|
-
define_names(init_args)
|
31
|
-
define_addresses(init_args)
|
32
|
-
define_phones(init_args)
|
33
|
-
define_dob(init_args)
|
34
|
-
define_race(init_args)
|
35
|
-
define_other
|
36
|
-
define_identifiers
|
37
|
-
define_birth_order
|
38
|
-
define_death
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def define_gender(init_args = {})
|
44
|
-
@gender = if !init_args[:gender].nil? && init_args[:gender].is_a?(HealthcarePhony::Gender)
|
45
|
-
init_args[:gender]
|
46
|
-
else
|
47
|
-
HealthcarePhony::Gender.new(init_args)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def define_names(init_args = {})
|
52
|
-
init_args[:gender] = @gender
|
53
|
-
names_count = init_args[:names_count].nil? || init_args[:names_count] < 1 ? 1 : init_args[:names_count]
|
54
|
-
@names = []
|
55
|
-
while names_count.positive?
|
56
|
-
@names.push(PersonName.new(init_args))
|
57
|
-
names_count -= 1
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def define_addresses(init_args = {})
|
62
|
-
address_count = init_args[:address_count].nil? || init_args[:address_count] < 1 ? 1 : init_args[:address_count]
|
63
|
-
@addresses = []
|
64
|
-
while address_count.positive?
|
65
|
-
@addresses.push(Address.new)
|
66
|
-
address_count -= 1
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def define_phones(init_args = {})
|
71
|
-
@home_phone = HomePhoneNumber.new(init_args)
|
72
|
-
@cell_phone = CellPhoneNumber.new(init_args)
|
73
|
-
@work_phone = WorkPhoneNumber.new(init_args)
|
74
|
-
end
|
75
|
-
|
76
|
-
def define_dob(init_args = {})
|
77
|
-
min_age = init_args[:min_age].nil? ? 1 : init_args[:min_age]
|
78
|
-
max_age = init_args[:max_age].nil? ? 99 : init_args[:max_age]
|
79
|
-
@date_of_birth = Faker::Date.birthday(min_age: min_age, max_age: max_age)
|
80
|
-
end
|
81
|
-
|
82
|
-
def define_race(init_args = {})
|
83
|
-
races_count = init_args[:race_count].nil? || init_args[:race_count] < 1 ? 1 : init_args[:race_count]
|
84
|
-
@races = []
|
85
|
-
while races_count.positive?
|
86
|
-
@races.push(Race.new)
|
87
|
-
races_count -= 1
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def define_identifiers
|
92
|
-
@medical_record_number = Identifier.new(type_code: 'MR')
|
93
|
-
@account_number = Identifier.new(type_code: 'AN')
|
94
|
-
@ssn = Faker::IDNumber.ssn_valid
|
95
|
-
end
|
96
|
-
|
97
|
-
def define_death
|
98
|
-
@death_indicator = %w[Y N].sample
|
99
|
-
@death_datetime = @death_indicator == 'Y' ? Faker::Time.between(from: @date_of_birth.to_date, to: Time.now) : ''
|
100
|
-
end
|
101
|
-
|
102
|
-
def define_birth_order
|
103
|
-
@multiple_birth_indicator = %w[Y N].sample
|
104
|
-
@birth_order = @multiple_birth_indicator == 'Y' ? /[1-2]/.random_example : ''
|
105
|
-
end
|
106
|
-
|
107
|
-
def define_other
|
108
|
-
@language = Language.new
|
109
|
-
@marital_status = MaritalStatus.new
|
110
|
-
@religion = Religion.new
|
111
|
-
@ethnic_group = EthnicGroup.new
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HealthcarePhony
|
4
|
+
# Public: Randomly generate a Patient
|
5
|
+
class Patient
|
6
|
+
attr_accessor :names,
|
7
|
+
:medical_record_number,
|
8
|
+
:account_number,
|
9
|
+
:addresses,
|
10
|
+
:date_of_birth,
|
11
|
+
:gender,
|
12
|
+
:races,
|
13
|
+
:home_phone, # TODO: allow for > 1
|
14
|
+
:cell_phone, # TODO: allow for > 1
|
15
|
+
:work_phone, # TODO: allow for > 1
|
16
|
+
:email,
|
17
|
+
:language,
|
18
|
+
:marital_status,
|
19
|
+
:religion,
|
20
|
+
:ssn,
|
21
|
+
:drivers_license,
|
22
|
+
:ethnic_group,
|
23
|
+
:multiple_birth_indicator,
|
24
|
+
:birth_order,
|
25
|
+
:death_indicator,
|
26
|
+
:death_datetime
|
27
|
+
|
28
|
+
def initialize(init_args = {})
|
29
|
+
define_gender(init_args)
|
30
|
+
define_names(init_args)
|
31
|
+
define_addresses(init_args)
|
32
|
+
define_phones(init_args)
|
33
|
+
define_dob(init_args)
|
34
|
+
define_race(init_args)
|
35
|
+
define_other
|
36
|
+
define_identifiers
|
37
|
+
define_birth_order
|
38
|
+
define_death
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def define_gender(init_args = {})
|
44
|
+
@gender = if !init_args[:gender].nil? && init_args[:gender].is_a?(HealthcarePhony::Gender)
|
45
|
+
init_args[:gender]
|
46
|
+
else
|
47
|
+
HealthcarePhony::Gender.new(init_args)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def define_names(init_args = {})
|
52
|
+
init_args[:gender] = @gender
|
53
|
+
names_count = init_args[:names_count].nil? || init_args[:names_count] < 1 ? 1 : init_args[:names_count]
|
54
|
+
@names = []
|
55
|
+
while names_count.positive?
|
56
|
+
@names.push(PersonName.new(init_args))
|
57
|
+
names_count -= 1
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def define_addresses(init_args = {})
|
62
|
+
address_count = init_args[:address_count].nil? || init_args[:address_count] < 1 ? 1 : init_args[:address_count]
|
63
|
+
@addresses = []
|
64
|
+
while address_count.positive?
|
65
|
+
@addresses.push(Address.new)
|
66
|
+
address_count -= 1
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def define_phones(init_args = {})
|
71
|
+
@home_phone = HomePhoneNumber.new(init_args)
|
72
|
+
@cell_phone = CellPhoneNumber.new(init_args)
|
73
|
+
@work_phone = WorkPhoneNumber.new(init_args)
|
74
|
+
end
|
75
|
+
|
76
|
+
def define_dob(init_args = {})
|
77
|
+
min_age = init_args[:min_age].nil? ? 1 : init_args[:min_age]
|
78
|
+
max_age = init_args[:max_age].nil? ? 99 : init_args[:max_age]
|
79
|
+
@date_of_birth = Faker::Date.birthday(min_age: min_age, max_age: max_age)
|
80
|
+
end
|
81
|
+
|
82
|
+
def define_race(init_args = {})
|
83
|
+
races_count = init_args[:race_count].nil? || init_args[:race_count] < 1 ? 1 : init_args[:race_count]
|
84
|
+
@races = []
|
85
|
+
while races_count.positive?
|
86
|
+
@races.push(Race.new)
|
87
|
+
races_count -= 1
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def define_identifiers
|
92
|
+
@medical_record_number = Identifier.new(type_code: 'MR')
|
93
|
+
@account_number = Identifier.new(type_code: 'AN')
|
94
|
+
@ssn = Faker::IDNumber.ssn_valid
|
95
|
+
end
|
96
|
+
|
97
|
+
def define_death
|
98
|
+
@death_indicator = %w[Y N].sample
|
99
|
+
@death_datetime = @death_indicator == 'Y' ? Faker::Time.between(from: @date_of_birth.to_date, to: Time.now) : ''
|
100
|
+
end
|
101
|
+
|
102
|
+
def define_birth_order
|
103
|
+
@multiple_birth_indicator = %w[Y N].sample
|
104
|
+
@birth_order = @multiple_birth_indicator == 'Y' ? /[1-2]/.random_example : ''
|
105
|
+
end
|
106
|
+
|
107
|
+
def define_other
|
108
|
+
@language = Language.new
|
109
|
+
@marital_status = MaritalStatus.new
|
110
|
+
@religion = Religion.new
|
111
|
+
@ethnic_group = EthnicGroup.new
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|