healthcare_phony 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +1 -0
  3. data/.github/workflows/gem-push.yml +42 -0
  4. data/.github/workflows/ruby.yml +33 -0
  5. data/.gitignore +64 -0
  6. data/.rdoc_options +23 -0
  7. data/.rubocop.yml +10 -0
  8. data/CODE_OF_CONDUCT.md +84 -0
  9. data/Gemfile +8 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.md +285 -0
  12. data/Rakefile +12 -0
  13. data/VERSION +1 -0
  14. data/healthcare_phony.gemspec +36 -0
  15. data/lib/healthcare_phony.rb +88 -0
  16. data/lib/healthcare_phony/address.rb +89 -0
  17. data/lib/healthcare_phony/assigning_authority.rb +6 -0
  18. data/lib/healthcare_phony/cell_phone_number.rb +20 -0
  19. data/lib/healthcare_phony/data_files/address_type.yml +7 -0
  20. data/lib/healthcare_phony/data_files/adt_event_types.yml +59 -0
  21. data/lib/healthcare_phony/data_files/degree.yml +9 -0
  22. data/lib/healthcare_phony/data_files/discharge_disposition.yml +15 -0
  23. data/lib/healthcare_phony/data_files/ethnic_group.yml +10 -0
  24. data/lib/healthcare_phony/data_files/hl7_message_types.yml +4 -0
  25. data/lib/healthcare_phony/data_files/language.yml +7 -0
  26. data/lib/healthcare_phony/data_files/marital_status.yml +49 -0
  27. data/lib/healthcare_phony/data_files/mdm_event_types.yml +12 -0
  28. data/lib/healthcare_phony/data_files/oru_event_types.yml +2 -0
  29. data/lib/healthcare_phony/data_files/race.yml +13 -0
  30. data/lib/healthcare_phony/data_files/religion.yml +250 -0
  31. data/lib/healthcare_phony/data_files/tele_equipment_type.yml +10 -0
  32. data/lib/healthcare_phony/data_files/tele_use_code.yml +9 -0
  33. data/lib/healthcare_phony/diagnosis.rb +12 -0
  34. data/lib/healthcare_phony/doctor.rb +25 -0
  35. data/lib/healthcare_phony/email.rb +25 -0
  36. data/lib/healthcare_phony/ethnic_group.rb +34 -0
  37. data/lib/healthcare_phony/gender.rb +22 -0
  38. data/lib/healthcare_phony/helper.rb +72 -0
  39. data/lib/healthcare_phony/hl7_message.rb +136 -0
  40. data/lib/healthcare_phony/home_phone_number.rb +20 -0
  41. data/lib/healthcare_phony/identifier.rb +23 -0
  42. data/lib/healthcare_phony/insurance.rb +6 -0
  43. data/lib/healthcare_phony/language.rb +30 -0
  44. data/lib/healthcare_phony/marital_status.rb +31 -0
  45. data/lib/healthcare_phony/patient.rb +114 -0
  46. data/lib/healthcare_phony/patient_visit.rb +96 -0
  47. data/lib/healthcare_phony/person_name.rb +104 -0
  48. data/lib/healthcare_phony/phone_number.rb +85 -0
  49. data/lib/healthcare_phony/procedure.rb +6 -0
  50. data/lib/healthcare_phony/race.rb +30 -0
  51. data/lib/healthcare_phony/religion.rb +32 -0
  52. data/lib/healthcare_phony/templates/adt_example.erb +6 -0
  53. data/lib/healthcare_phony/templates/csv_example.erb +4 -0
  54. data/lib/healthcare_phony/version.rb +5 -0
  55. data/lib/healthcare_phony/visit_admission.rb +53 -0
  56. data/lib/healthcare_phony/visit_discharge.rb +62 -0
  57. data/lib/healthcare_phony/visit_doctors.rb +19 -0
  58. data/lib/healthcare_phony/visit_location.rb +106 -0
  59. data/lib/healthcare_phony/work_phone_number.rb +20 -0
  60. metadata +185 -0
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ # Public: Randomly generates a patient name.
5
+ class PersonName
6
+ attr_accessor :family_name,
7
+ :given_name,
8
+ :middle_name,
9
+ :suffix,
10
+ :prefix,
11
+ :degree
12
+
13
+ # Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
14
+ # blank - An integer representing the % of times PatientName components should be blank.
15
+ # gender - A Gender object which will be used to generate a Male or Female name if specified.
16
+ # degree_data_file - Location of YAML file containing a list of potential degrees to choose from. By default the
17
+ # gem supplied file will be used. The default file {degree.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/degree.yml].
18
+ def initialize(**init_args)
19
+ @set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == ''
20
+ @gender = init_args[:gender]
21
+ @degree_data_file = get_degree_data_file(init_args)
22
+ @given_name = define_given_name
23
+ @family_name = define_family_name
24
+ @middle_name = define_middle_name
25
+ @suffix = define_suffix
26
+ @prefix = define_prefix
27
+ @degree = define_degree(init_args)
28
+ end
29
+
30
+ private
31
+
32
+ # Private: Boolean set during initialization if Address components should be set to blank.
33
+ attr_accessor :set_blank
34
+ attr_accessor :degree_data_file
35
+
36
+ def get_degree_data_file(**init_args)
37
+ if !init_args[:degree_data_file].nil?
38
+ init_args[:degree_data_file]
39
+ else
40
+ "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/degree.yml"
41
+ end
42
+ end
43
+
44
+ def define_given_name
45
+ if @set_blank
46
+ ''
47
+ elsif !@gender.nil? && @gender.code == 'M'
48
+ Faker::Name.male_first_name
49
+ elsif !@gender.nil? && @gender.code == 'F'
50
+ Faker::Name.female_first_name
51
+ else
52
+ Faker::Name.first_name
53
+ end
54
+ end
55
+
56
+ def define_family_name
57
+ if @set_blank
58
+ ''
59
+ else
60
+ Faker::Name.last_name
61
+ end
62
+ end
63
+
64
+ def define_middle_name
65
+ if @set_blank
66
+ ''
67
+ else
68
+ Faker::Name.middle_name
69
+ end
70
+ end
71
+
72
+ def define_suffix
73
+ if @set_blank
74
+ ''
75
+ else
76
+ Faker::Name.suffix
77
+ end
78
+ end
79
+
80
+ def define_prefix
81
+ if @set_blank
82
+ ''
83
+ else
84
+ Faker::Name.prefix
85
+ end
86
+ end
87
+
88
+ def define_degree(**init_args)
89
+ if @set_blank
90
+ ''
91
+ elsif !init_args[:degree].nil?
92
+ degree_choices = Helper.get_array(init_args[:degree])
93
+ degree_choices.sample unless degree_choices.empty?
94
+ else
95
+ degrees_from_file
96
+ end
97
+ end
98
+
99
+ def degrees_from_file
100
+ degrees = Psych.load_file(@degree_data_file)
101
+ degrees.nil? ? '' : degrees.sample
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ # Public: Generates a fake phone number
5
+ class PhoneNumber
6
+ attr_accessor :number,
7
+ :country_code,
8
+ :area_code,
9
+ :exchange_code,
10
+ :subscriber_number,
11
+ :use_code,
12
+ :equipment_type
13
+
14
+ def initialize(**init_args)
15
+ # Public: Initializes a home phone number. Pass in hash of different parameters, currently this includes:
16
+ # blank - An integer representing the % of times phone number components should be blank.
17
+ # use_code_data_file - YAML file containing use codes to randomly choose from. If not specified then values from
18
+ # {tele_use_code.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/tele_use_code.yml] are used.
19
+ # equipment_type_data_file - YAML file containing equipment type codes to randomly choose from. If not specified
20
+ # then values {tele_equipment_type}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/tele_equipment_type.yml] will be used.
21
+ @set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == ''
22
+ @use_code_data_file = init_args[:use_code_data_file]
23
+ @equipment_type_data_file = init_args[:equipment_type_data_file]
24
+ define_country_code
25
+ define_area_code
26
+ define_exchange_code
27
+ define_subscriber_number
28
+ define_use_code
29
+ define_equipment_type
30
+ end
31
+
32
+ private
33
+
34
+ # Private: Boolean set during initialization if Address components should be set to blank.
35
+ attr_accessor :set_blank
36
+
37
+ # Private: Location of data file of use codes
38
+ attr_accessor :use_code_data_file
39
+
40
+ # Private: Location of data file of equipment types
41
+ attr_accessor :equipment_type_data_file
42
+
43
+ def define_country_code
44
+ @country_code = Faker::PhoneNumber.country_code
45
+ @country_code = '' unless @set_blank == false
46
+ end
47
+
48
+ def define_area_code
49
+ @area_code = Faker::PhoneNumber.area_code
50
+ @area_code = '' unless @set_blank == false
51
+ end
52
+
53
+ def define_exchange_code
54
+ @exchange_code = Faker::PhoneNumber.exchange_code
55
+ @exchange_code = '' unless @set_blank == false
56
+ end
57
+
58
+ def define_subscriber_number
59
+ @subscriber_number = Faker::PhoneNumber.subscriber_number
60
+ @subscriber_number = '' unless @set_blank == false
61
+ end
62
+
63
+ def define_use_code
64
+ data_file = if !@use_code_data_file.nil?
65
+ @use_code_data_file
66
+ else
67
+ "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/tele_use_code.yml"
68
+ end
69
+ use_codes = Psych.load_file(data_file)
70
+ @use_code = use_codes.nil? ? '' : use_codes.sample
71
+ @use_code = '' unless @set_blank == false
72
+ end
73
+
74
+ def define_equipment_type
75
+ data_file = if !@equipment_type_data_file.nil?
76
+ @equipment_type_data_file
77
+ else
78
+ "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/tele_equipment_type.yml"
79
+ end
80
+ equipment_types = Psych.load_file(data_file)
81
+ @equipment_type = equipment_types.nil? ? '' : equipment_types.sample
82
+ @equipment_type = '' unless @set_blank == false
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ class Procedure
5
+ end
6
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ # Public: Creates a Race by randomly choosing values from a YAML file.
5
+ class Race
6
+ attr_accessor :code,
7
+ :description,
8
+ :coding_system
9
+ # Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
10
+ # race_data_file - Location of YAML file containing a list of potential degrees to choose from. By default the
11
+ # gem supplied file will be used. The default file {race.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/race.yml].
12
+ def initialize(**init_args)
13
+ # TODO: allow a way for caller to pass in % blank
14
+ # TODO: set coding system
15
+
16
+ data_file = if !init_args[:race_data_file].nil?
17
+ init_args[:race_data_file]
18
+ else
19
+ "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/race.yml"
20
+ end
21
+ race_array = Psych.load_file(data_file)
22
+
23
+ random_race = race_array.nil? ? '' : race_array.sample
24
+
25
+ @code = random_race[:code]
26
+ @description = random_race[:description]
27
+ @coding_system = ''
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ # Public: Creates a Religion object for a Patient by randomly choosing a value from a YAML file.
5
+ class Religion
6
+ attr_accessor :code,
7
+ :description,
8
+ :coding_system
9
+
10
+ # Public: Initializes an EthnicGroup. Pass in hash of different parameters, currently this includes:
11
+ # religion_data_file - YAML file containing religion information to randomly choose from if different options than
12
+ # those that come with gem are desired. See {religion.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/religion.yml]
13
+ # for default values.
14
+ def initialize(**init_args)
15
+ # TODO: allow a way for caller to pass in a custom set of codes to choose from
16
+ # TODO: allow a way for caller to pass in % blank
17
+
18
+ data_file = if !init_args[:religion_data_file].nil?
19
+ init_args[:religion_data_file]
20
+ else
21
+ "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/religion.yml"
22
+ end
23
+ r_array = Psych.load_file(data_file)
24
+
25
+ random_religion = r_array.nil? ? '' : r_array.sample
26
+
27
+ @code = random_religion[:code]
28
+ @description = random_religion[:description]
29
+ @coding_system = random_religion[:coding_system]
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,6 @@
1
+ MSH|^~\&|<%= hl7.sending_application %>|<%= hl7.sending_facility %>|<%= hl7.receiving_application %>|<%= hl7.receiving_facility %>|<%= hl7.message_datetime.to_hl7datetime() %>||<%= hl7.message_type %>^<%= hl7.trigger_event %>|<%= hl7.message_control_id %>|<%= hl7.processing_id %>|<%= hl7.version %>
2
+ EVN|<%= hl7.trigger_event %>|<%= hl7.message_datetime.to_hl7datetime() %>
3
+ PID|||<%= patient.medical_record_number.identifier %>||<%= patient.names[0].family_name %>^<%= patient.names[0].given_name %>^<%= patient.names[0].middle_name%>^||<%= patient.date_of_birth.to_hl7date %>|<%= patient.gender.code %>||<%= patient.races[0].code %>|<%= patient.addresses[0].address_line1 %>^<%= patient.addresses[0].address_line2 %>^<%= patient.addresses[0].city %>^<%= patient.addresses[0].state %>^<%= patient.addresses[0].postal_code %>||(<%= patient.home_phone.area_code %>)<%= patient.home_phone.exchange_code %>-<%= patient.home_phone.subscriber_number %>~(<%= patient.cell_phone.area_code %>)<%= patient.cell_phone.exchange_code %>-<%= patient.cell_phone.subscriber_number %>|(<%= patient.work_phone.area_code %>)<%= patient.work_phone.exchange_code %>-<%= patient.work_phone.subscriber_number %>||||<%= patient.account_number.identifier %>|<%= patient.ssn %>
4
+ PV1||<%= visit.patient_class %>
5
+
6
+
@@ -0,0 +1,4 @@
1
+ <% if write_header %>
2
+ MRN,FIRST_NAME,LAST_NAME
3
+ <% end %>
4
+ "<%= patient.medical_record_number.identifier %>","<%= patient.names[0].given_name %>","<%= patient.names[0].family_name %>"
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ VERSION = File.read(File.expand_path('../../VERSION', __dir__)).strip.freeze
5
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ # Public: Creates admission information for a patient visit.
5
+ class VisitAdmission
6
+ attr_accessor :type, :datetime, :source, :reason
7
+
8
+ # Public: Initializes an EthnicGroup. Pass in hash of different parameters, currently this includes:
9
+ # admit_source - Array of Admit Source codes (PV1.14) to randomly choose from. Specified as comma separated
10
+ # String or Ruby array. Otherwise default HL7 v2.5.1 Table 0023 values are used.
11
+ # admission_type - Array of Admission Type (PV1.4) to randomly choose from. Specified as comma separated String or
12
+ # Ruby array. Otherwise default HL7 v2.5.1. Table 0007 values are used.
13
+ # admit_reason - Array of values to use as Admit Reason (PV2.3) to randomly choose from. Specified as comma
14
+ # separated String or Ruby array. Otherwise a string of data is generated with Faker::Lorem.sentence
15
+ def initialize(**init_args)
16
+ @source = define_source(init_args)
17
+ @type = define_type(init_args)
18
+ @datetime = Faker::Time.backward(days: Faker::Number.number(digits: 1))
19
+ @reason = define_reason(init_args)
20
+ end
21
+
22
+ private
23
+
24
+ def define_source(**init_args)
25
+ standard_admit_source = '123456789'.split('')
26
+ as_choices = Helper.get_array(init_args[:admit_source])
27
+ if !as_choices.empty?
28
+ as_choices.sample
29
+ else
30
+ standard_admit_source.sample
31
+ end
32
+ end
33
+
34
+ def define_type(**init_args)
35
+ standard_admission_types = %w[A C E L N R U]
36
+ at_choices = Helper.get_array(init_args[:admission_type])
37
+ if !at_choices.empty?
38
+ at_choices.sample
39
+ else
40
+ standard_admission_types.sample
41
+ end
42
+ end
43
+
44
+ def define_reason(**init_args)
45
+ ar_choices = Helper.get_array(init_args[:admit_reason])
46
+ if !ar_choices.empty?
47
+ ar_choices.sample
48
+ else
49
+ Faker::Lorem.sentence
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ # Public: Creates discharge information for a patient visit.
5
+ class VisitDischarge
6
+ attr_accessor :disposition,
7
+ :location,
8
+ :datetime
9
+
10
+ # Public: Initializes an EthnicGroup. Pass in hash of different parameters, currently this includes:
11
+ # event_type - The HL7 trigger event type that this visit is associated with.
12
+ # discharge_disposition - Array of discharge disposition codes (PV1.36) to randomly choose from. Specified as comma
13
+ # separated String or Ruby array. Otherwise default HL7 v2.5.1 Table 0112 values are used.
14
+ # discharge_location - Array of discharge locations to randomly choose from. Specified as comma separated String or
15
+ # Ruby array. Otherwise a string of data is generated with Faker::Lorem.sentence
16
+ # admit_datetime - The admit date/time associated with this visit. If not specified the current date/time is used.
17
+ def initialize(**init_args)
18
+ if init_args[:event_type] == 'A03'
19
+ @disposition = define_discharge_disposition(init_args)
20
+ @location = define_discharge_location(init_args)
21
+ @datetime = define_discharge_datetime(init_args)
22
+ else
23
+ @disposition = ''
24
+ @location = ''
25
+ @datetime = nil
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def define_discharge_disposition(**init_args)
32
+ dd_choices = Helper.get_array(init_args[:discharge_disposition])
33
+ if init_args[:event_type] != 'A03'
34
+ ''
35
+ elsif !dd_choices.empty?
36
+ dd_choices.sample
37
+ else
38
+ data_file = "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/discharge_disposition.yml"
39
+ file_based_choices = Psych.load_file(data_file)
40
+ file_based_choices.nil? ? '' : file_based_choices.sample
41
+ end
42
+ end
43
+
44
+ def define_discharge_location(**init_args)
45
+ dl_choices = Helper.get_array(init_args[:discharge_location])
46
+ if !dl_choices.empty?
47
+ dl_choices.sample
48
+ else
49
+ Faker::Lorem.sentence
50
+ end
51
+ end
52
+
53
+ def define_discharge_datetime(**init_args)
54
+ from_datetime = if init_args[:admit_datetime].nil?
55
+ Time.now
56
+ else
57
+ init_args[:admit_datetime]
58
+ end
59
+ Faker::Time.between(from: from_datetime, to: DateTime.now)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ # Public: Creates providers associated with visit. Attending (PV1.7), Referring (PV1.8), Consulting (PV1.9), and
5
+ # Admitting (PV1.17)
6
+ class VisitDoctors
7
+ attr_accessor :attending,
8
+ :referring,
9
+ :consulting,
10
+ :admitting
11
+
12
+ def initialize
13
+ @attending = Doctor.new
14
+ @referring = Doctor.new
15
+ @consulting = Doctor.new
16
+ @admitting = Doctor.new
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HealthcarePhony
4
+ # Public: Generates various location information associated with a visit.
5
+ class VisitLocation
6
+ attr_accessor :point_of_care,
7
+ :room,
8
+ :bed,
9
+ :facility,
10
+ :status,
11
+ :type,
12
+ :building,
13
+ :floor,
14
+ :description
15
+
16
+ # Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
17
+ # point_of_care - Array of potential points of care (PV1.3.1) to randomly choose from. Specified as comma separated
18
+ # String or Ruby array. Otherwise random example generated.
19
+ # room - Array of potential rooms (PV1.3.2) to randomly choose from. Specified as comma separated String or Ruby
20
+ # array. Otherwise a random 3 digit number is generated.
21
+ # bed - Array of potential beds (PV1.3.3) to randomly choose from. Specified as comma separated String or Ruby
22
+ # array. Otherwise a 3 character sequence is created.
23
+ # facility - Array of potential facility names (PV1.3.4) to randomly choose from. Specified as comma separated
24
+ # String or Ruby array. Otherwise a random string is generated.
25
+ # location_status - Array of potential location statuses (PV1.3.5) to randomly choose from. Specified as comma
26
+ # separated String or Ruby array. Otherwise a random uppercase letter is generated to use.
27
+ # person_location_type - Array of potential person location types (PV1.3.6) to randomly choose from. Specified as
28
+ # comma separated String or Ruby array. Otherwise values from HL7 v2.5.1 Table 0305 will be used.
29
+ # building - Array of potential building information (PV1.3.7) to randomly choose from. Specified as a comma
30
+ # separated String or Ruby array. Otherwise a random digit 1-9 is used.
31
+ # floor - Array of potential floor information (PV1.3.8) to randomly choose from. Specified as a comma separated
32
+ # String or Ruby array. Otherwise a random 2 digit number is used.
33
+ # location_description - Array of potential location descriptions (PV1.3.9) to randomly choose from. Specified as
34
+ # a comma separated String or Ruby array. Otherwise a random string is generated.
35
+ def initialize(**init_args)
36
+ @point_of_care = define_point_of_care(init_args)
37
+ @room = define_room(init_args)
38
+ @bed = define_bed(init_args)
39
+ @facility = define_facility(init_args)
40
+ @status = define_status(init_args)
41
+ @type = define_type(init_args)
42
+ @building = define_building(init_args)
43
+ @floor = define_floor(init_args)
44
+ @description = define_description(init_args)
45
+ end
46
+
47
+ private
48
+
49
+ def define_point_of_care(**init_args)
50
+ poc_choices = Helper.get_array(init_args[:point_of_care])
51
+ !poc_choices.empty? ? poc_choices.sample : /[A-Z]{10}/.random_example
52
+ end
53
+
54
+ def define_room(**init_args)
55
+ room_choices = Helper.get_array(init_args[:room])
56
+ if !room_choices.empty?
57
+ room_choices.sample
58
+ else
59
+ Faker::Alphanumeric.alphanumeric(number: 3, min_alpha: 0, min_numeric: 3)
60
+ end
61
+ end
62
+
63
+ def define_bed(**init_args)
64
+ bed_choices = Helper.get_array(init_args[:bed])
65
+ if !bed_choices.empty?
66
+ bed_choices.sample
67
+ else
68
+ Faker::Alphanumeric.alphanumeric(number: 3, min_alpha: 1, min_numeric: 2)
69
+ end
70
+ end
71
+
72
+ def define_facility(**init_args)
73
+ fac_choices = Helper.get_array(init_args[:facility])
74
+ !fac_choices.empty? ? fac_choices.sample : Faker::Lorem.sentence
75
+ end
76
+
77
+ def define_status(**init_args)
78
+ ls_choices = Helper.get_array(init_args[:location_status])
79
+ !ls_choices.empty? ? ls_choices.sample : /[A-Z]/.random_example
80
+ end
81
+
82
+ def define_type(**init_args)
83
+ plt_choices = Helper.get_array(init_args[:person_location_type])
84
+ !plt_choices.empty? ? plt_choices.sample : %w[C D H N O P S].sample
85
+ end
86
+
87
+ def define_building(**init_args)
88
+ building_choices = Helper.get_array(init_args[:building])
89
+ !building_choices.empty? ? building_choices.sample : /[1-9]/.random_example
90
+ end
91
+
92
+ def define_floor(**init_args)
93
+ floor_choices = Helper.get_array(init_args[:floor])
94
+ !floor_choices.empty? ? floor_choices.sample : /[0-9]{2}/.random_example
95
+ end
96
+
97
+ def define_description(**init_args)
98
+ ld_choices = Helper.get_array(init_args[:location_description])
99
+ if !ld_choices.empty?
100
+ ld_choices.sample
101
+ else
102
+ Faker::Lorem.sentence
103
+ end
104
+ end
105
+ end
106
+ end