healthcare_phony 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/healthcare_phony.rb +20 -14
- data/lib/healthcare_phony/address.rb +1 -1
- data/lib/healthcare_phony/cell_phone_number.rb +1 -1
- data/lib/healthcare_phony/doctor.rb +1 -1
- data/lib/healthcare_phony/email.rb +1 -1
- data/lib/healthcare_phony/ethnic_group.rb +1 -1
- data/lib/healthcare_phony/gender.rb +1 -1
- data/lib/healthcare_phony/hl7_message.rb +14 -14
- data/lib/healthcare_phony/home_phone_number.rb +1 -1
- data/lib/healthcare_phony/identifier.rb +1 -1
- data/lib/healthcare_phony/language.rb +1 -1
- data/lib/healthcare_phony/patient.rb +7 -7
- data/lib/healthcare_phony/patient_visit.rb +7 -7
- data/lib/healthcare_phony/person_name.rb +3 -3
- data/lib/healthcare_phony/phone_number.rb +1 -1
- data/lib/healthcare_phony/race.rb +2 -1
- data/lib/healthcare_phony/religion.rb +1 -1
- data/lib/healthcare_phony/visit_admission.rb +4 -4
- data/lib/healthcare_phony/visit_discharge.rb +4 -4
- data/lib/healthcare_phony/visit_location.rb +10 -10
- data/lib/healthcare_phony/work_phone_number.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bdfa5957ba72b641eea38c4c61d96c6cea69b33889f010e8b0fa58e61e48683
|
4
|
+
data.tar.gz: bbbc2532c8092dc625d2be9a20cb108dbba97701eb5f510b218932421ec3bcd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b86d2d6978257091dd388b8c1e9f64fa40079484cdb66efd7400f50bb239cb99f6c270fe48185d9a8269e44dc96e73ce150dfcc2c56175322c8d6f2e17526a9
|
7
|
+
data.tar.gz: 7283bf0ce04e1b7fa23fa32feb8d0a6bd10a4cdf232446b66def8b32d6294a8d4dab8a50fee713dd37623c41e63571a67922f4863d06d945fe2feb00769884c6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/healthcare_phony.rb
CHANGED
@@ -11,29 +11,35 @@ Faker::Config.locale = 'en-US'
|
|
11
11
|
|
12
12
|
module HealthcarePhony
|
13
13
|
class Adt
|
14
|
-
attr_reader :template, :adt_arguments
|
14
|
+
attr_reader :template, :adt_arguments, :hl7_message, :patient, :visit
|
15
15
|
|
16
|
-
def initialize(
|
16
|
+
def initialize(init_args = {})
|
17
17
|
@adt_arguments = init_args
|
18
18
|
@adt_arguments[:message_types] = 'ADT'
|
19
|
-
|
20
|
-
|
19
|
+
set_template
|
20
|
+
@hl7_message = Hl7Message.new(@adt_arguments)
|
21
|
+
@patient = Patient.new(@adt_arguments)
|
22
|
+
@visit = PatientVisit.new(@adt_arguments)
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
erb_template = ERB.new(@template)
|
27
|
+
erb_template.result_with_hash({ patient: @patient, hl7: @hl7_message, visit: @visit })
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def set_template
|
33
|
+
unless @adt_arguments[:template].nil?
|
34
|
+
@template = @adt_arguments[:template]
|
21
35
|
return
|
22
36
|
end
|
23
|
-
@template = if adt_arguments[:template_file].nil?
|
37
|
+
@template = if @adt_arguments[:template_file].nil?
|
24
38
|
File.read(File.join(File.dirname(__FILE__), 'healthcare_phony', 'templates', 'adt_example.erb'))
|
25
39
|
else
|
26
|
-
File.read(adt_arguments[:template_file])
|
40
|
+
File.read(@adt_arguments[:template_file])
|
27
41
|
end
|
28
42
|
end
|
29
|
-
|
30
|
-
def to_s
|
31
|
-
template = ERB.new(@template)
|
32
|
-
message = Hl7Message.new(@adt_arguments)
|
33
|
-
patient = Patient.new(@adt_arguments)
|
34
|
-
visit = PatientVisit.new(@adt_arguments)
|
35
|
-
template.result_with_hash({ patient: patient, hl7: message, visit: visit })
|
36
|
-
end
|
37
43
|
end
|
38
44
|
|
39
45
|
class CsvFile
|
@@ -13,7 +13,7 @@ module HealthcarePhony
|
|
13
13
|
# address_type_data_file - YAML file containing address types to randomly choose from if different options than
|
14
14
|
# those that come with gem are desired.
|
15
15
|
# See {address_type.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/address_type.yml]
|
16
|
-
def initialize(
|
16
|
+
def initialize(init_args = {})
|
17
17
|
@set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == ''
|
18
18
|
@state = init_args[:state]
|
19
19
|
@country = init_args[:country]
|
@@ -9,7 +9,7 @@ module HealthcarePhony
|
|
9
9
|
# blank - An integer representing the % of times phone number components should be blank.
|
10
10
|
# use_code - Allows specification of the phone use code (PID.13.2)
|
11
11
|
# equipment_type - Allows specification of the phone equipment type (PID.13.3)
|
12
|
-
def initialize(
|
12
|
+
def initialize(init_args = {})
|
13
13
|
super(init_args)
|
14
14
|
@use_code = init_args[:use_code].nil? ? 'ORN' : init_args[:use_code]
|
15
15
|
@use_code = '' unless @set_blank == false
|
@@ -11,7 +11,7 @@ module HealthcarePhony
|
|
11
11
|
# Public: Initialize a Doctor. Pass in hash of different parameters, currently this includes:
|
12
12
|
#
|
13
13
|
# identifier - Allows you to specify an identifier for this Doctor instead of having it randomly generated.
|
14
|
-
def initialize(
|
14
|
+
def initialize(init_args = {})
|
15
15
|
@identifier = if !init_args[:identifier].nil?
|
16
16
|
init_args[:identifier]
|
17
17
|
else
|
@@ -7,7 +7,7 @@ module HealthcarePhony
|
|
7
7
|
:use_code,
|
8
8
|
:equipment_type
|
9
9
|
|
10
|
-
def initialize(
|
10
|
+
def initialize(init_args = {})
|
11
11
|
@set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == ''
|
12
12
|
@email_address = Faker::Internet.email
|
13
13
|
@email_address = '' unless @set_blank == false
|
@@ -12,7 +12,7 @@ module HealthcarePhony
|
|
12
12
|
# ethnic_group_data_file - YAML file containing ethnic group information to randomly choose from if different options than
|
13
13
|
# those that come with gem are desired. See {ethnic_group.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/ethnic_group.yml]
|
14
14
|
# for default values.
|
15
|
-
def initialize(
|
15
|
+
def initialize(init_args = {})
|
16
16
|
@set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == ''
|
17
17
|
data_file = if !init_args[:ethnic_group_data_file].nil?
|
18
18
|
init_args[:ethnic_group_data_file]
|
@@ -8,7 +8,7 @@ module HealthcarePhony
|
|
8
8
|
|
9
9
|
# Public: Initializes a Gender. Pass in hash of different parameters, currently this includes:
|
10
10
|
# blank - An integer representing the % of times Address components should be blank.
|
11
|
-
def initialize(
|
11
|
+
def initialize(init_args = {})
|
12
12
|
@description = %w[Female Male Unknown].sample
|
13
13
|
|
14
14
|
@description = if !init_args[:blank].nil?
|
@@ -42,7 +42,7 @@ module HealthcarePhony
|
|
42
42
|
# separated String or Ruby Array.
|
43
43
|
# message_receiving_facility - Array of Receiving Facilities (MSH.6) to randomly choose from. Specified as comma separated
|
44
44
|
# String or Ruby Array.
|
45
|
-
def initialize(
|
45
|
+
def initialize(init_args)
|
46
46
|
define_message_type(init_args)
|
47
47
|
define_trigger_event(init_args)
|
48
48
|
define_control_id(init_args)
|
@@ -60,7 +60,7 @@ module HealthcarePhony
|
|
60
60
|
|
61
61
|
private
|
62
62
|
|
63
|
-
def define_message_type(
|
63
|
+
def define_message_type(init_args = {})
|
64
64
|
file_name = "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/hl7_message_types.yml"
|
65
65
|
file_name = init_args[:message_type_file] unless init_args[:message_type_file].nil?
|
66
66
|
hl7_message_types = if !init_args[:message_types].nil?
|
@@ -71,7 +71,7 @@ module HealthcarePhony
|
|
71
71
|
@message_type = hl7_message_types.nil? ? '' : hl7_message_types.sample
|
72
72
|
end
|
73
73
|
|
74
|
-
def define_trigger_event(
|
74
|
+
def define_trigger_event(init_args = {})
|
75
75
|
@trigger_event = Helper.get_array(init_args[:message_events]).sample
|
76
76
|
return unless @trigger_event.nil?
|
77
77
|
|
@@ -85,22 +85,22 @@ module HealthcarePhony
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
def define_adt_trigger_event(
|
88
|
+
def define_adt_trigger_event(init_args = {})
|
89
89
|
event_types = get_adt_events(init_args)
|
90
90
|
event_types&.sample
|
91
91
|
end
|
92
92
|
|
93
|
-
def define_oru_trigger_event(
|
93
|
+
def define_oru_trigger_event(init_args = {})
|
94
94
|
event_types = get_oru_events(init_args)
|
95
95
|
event_types&.sample
|
96
96
|
end
|
97
97
|
|
98
|
-
def define_mdm_trigger_event(
|
98
|
+
def define_mdm_trigger_event(init_args = {})
|
99
99
|
event_types = get_mdm_events(init_args)
|
100
100
|
event_types&.sample
|
101
101
|
end
|
102
102
|
|
103
|
-
def get_adt_events(
|
103
|
+
def get_adt_events(init_args = {})
|
104
104
|
file_name = "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/adt_event_types.yml"
|
105
105
|
if init_args[:adt_events].nil?
|
106
106
|
Psych.load_file(file_name)
|
@@ -109,7 +109,7 @@ module HealthcarePhony
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
def get_oru_events(
|
112
|
+
def get_oru_events(init_args = {})
|
113
113
|
file_name = "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/oru_event_types.yml"
|
114
114
|
if init_args[:oru_events].nil?
|
115
115
|
Psych.load_file(file_name)
|
@@ -118,7 +118,7 @@ module HealthcarePhony
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
def get_mdm_events(
|
121
|
+
def get_mdm_events(init_args = {})
|
122
122
|
file_name = "#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/mdm_event_types.yml"
|
123
123
|
if init_args[:mdm_events].nil?
|
124
124
|
Psych.load_file(file_name)
|
@@ -127,7 +127,7 @@ module HealthcarePhony
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
-
def define_control_id(
|
130
|
+
def define_control_id(init_args = {})
|
131
131
|
control_id_pattern = if init_args[:message_control_id_pattern].nil?
|
132
132
|
'PHONY\d{10}'
|
133
133
|
else
|
@@ -136,22 +136,22 @@ module HealthcarePhony
|
|
136
136
|
@message_control_id = Regexp.new(control_id_pattern).random_example
|
137
137
|
end
|
138
138
|
|
139
|
-
def define_sending_facility(
|
139
|
+
def define_sending_facility(init_args = {})
|
140
140
|
sf_choices = Helper.get_array(init_args[:message_sending_facility])
|
141
141
|
@sending_facility = !sf_choices.empty? ? sf_choices.sample : ''
|
142
142
|
end
|
143
143
|
|
144
|
-
def define_sending_application(
|
144
|
+
def define_sending_application(init_args = {})
|
145
145
|
sa_choices = Helper.get_array(init_args[:message_sending_application])
|
146
146
|
@sending_application = !sa_choices.empty? ? sa_choices.sample : ''
|
147
147
|
end
|
148
148
|
|
149
|
-
def define_receiving_application(
|
149
|
+
def define_receiving_application(init_args = {})
|
150
150
|
ra_choices = Helper.get_array(init_args[:message_receiving_application])
|
151
151
|
@receiving_application = !ra_choices.empty? ? ra_choices.sample : ''
|
152
152
|
end
|
153
153
|
|
154
|
-
def define_receiving_facility(
|
154
|
+
def define_receiving_facility(init_args = {})
|
155
155
|
rf_choices = Helper.get_array(init_args[:message_receiving_facility])
|
156
156
|
@receiving_facility = !rf_choices.empty? ? rf_choices.sample : ''
|
157
157
|
end
|
@@ -9,7 +9,7 @@ module HealthcarePhony
|
|
9
9
|
# blank - An integer representing the % of times phone number components should be blank.
|
10
10
|
# use_code - Allows specification of the phone use code (PID.13.2)
|
11
11
|
# equipment_type - Allows specification of the phone equipment type (PID.13.3)
|
12
|
-
def initialize(
|
12
|
+
def initialize(init_args = {})
|
13
13
|
super(init_args)
|
14
14
|
@use_code = init_args[:use_code].nil? ? 'PRN' : init_args[:use_code]
|
15
15
|
@use_code = '' unless @set_blank == false
|
@@ -12,7 +12,7 @@ module HealthcarePhony
|
|
12
12
|
# type_code - Identifier Type Code, example PID.3.5. HL7 Data Table 0203
|
13
13
|
# pattern - Regex pattern used to randomly generate the identifier. Default is \d{10} which would generate an
|
14
14
|
# identifier like 5992657933.
|
15
|
-
def initialize(
|
15
|
+
def initialize(init_args = {})
|
16
16
|
@identifier_type_code = init_args[:type_code].nil? ? '' : init_args[:type_code]
|
17
17
|
|
18
18
|
identifier_pattern = init_args[:pattern].nil? ? '\d{10}' : init_args[:pattern]
|
@@ -10,7 +10,7 @@ module HealthcarePhony
|
|
10
10
|
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
11
11
|
# language_data_file - Location of YAML file containing Language data (Code, Description, and Coding System) if a
|
12
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(
|
13
|
+
def initialize(init_args = {})
|
14
14
|
# TODO: allow a way for caller to pass in a custom set of codes to choose from.
|
15
15
|
# TODO: allow a way for caller to pass in % blank
|
16
16
|
|
@@ -25,7 +25,7 @@ module HealthcarePhony
|
|
25
25
|
:death_indicator,
|
26
26
|
:death_datetime
|
27
27
|
|
28
|
-
def initialize(
|
28
|
+
def initialize(init_args = {})
|
29
29
|
define_gender(init_args)
|
30
30
|
define_names(init_args)
|
31
31
|
define_addresses(init_args)
|
@@ -40,7 +40,7 @@ module HealthcarePhony
|
|
40
40
|
|
41
41
|
private
|
42
42
|
|
43
|
-
def define_gender(
|
43
|
+
def define_gender(init_args = {})
|
44
44
|
@gender = if !init_args[:gender].nil? && init_args[:gender].is_a?(HealthcarePhony::Gender)
|
45
45
|
init_args[:gender]
|
46
46
|
else
|
@@ -48,7 +48,7 @@ module HealthcarePhony
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def define_names(
|
51
|
+
def define_names(init_args = {})
|
52
52
|
init_args[:gender] = @gender
|
53
53
|
names_count = init_args[:names_count].nil? || init_args[:names_count] < 1 ? 1 : init_args[:names_count]
|
54
54
|
@names = []
|
@@ -58,7 +58,7 @@ module HealthcarePhony
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
def define_addresses(
|
61
|
+
def define_addresses(init_args = {})
|
62
62
|
address_count = init_args[:address_count].nil? || init_args[:address_count] < 1 ? 1 : init_args[:address_count]
|
63
63
|
@addresses = []
|
64
64
|
while address_count.positive?
|
@@ -67,19 +67,19 @@ module HealthcarePhony
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
def define_phones(
|
70
|
+
def define_phones(init_args = {})
|
71
71
|
@home_phone = HomePhoneNumber.new(init_args)
|
72
72
|
@cell_phone = CellPhoneNumber.new(init_args)
|
73
73
|
@work_phone = WorkPhoneNumber.new(init_args)
|
74
74
|
end
|
75
75
|
|
76
|
-
def define_dob(
|
76
|
+
def define_dob(init_args = {})
|
77
77
|
min_age = init_args[:min_age].nil? ? 1 : init_args[:min_age]
|
78
78
|
max_age = init_args[:max_age].nil? ? 99 : init_args[:max_age]
|
79
79
|
@date_of_birth = Faker::Date.birthday(min_age: min_age, max_age: max_age)
|
80
80
|
end
|
81
81
|
|
82
|
-
def define_race(
|
82
|
+
def define_race(init_args = {})
|
83
83
|
races_count = init_args[:race_count].nil? || init_args[:race_count] < 1 ? 1 : init_args[:race_count]
|
84
84
|
@races = []
|
85
85
|
while races_count.positive?
|
@@ -23,7 +23,7 @@ module HealthcarePhony
|
|
23
23
|
# or Ruby array. Otherwise this field is left blank.
|
24
24
|
# vip_indicator - Array of Patient Type codes (PV1.18) to randomly choose from. Specified as comma separated String
|
25
25
|
# or Ruby array. Otherwise this field is left blank.
|
26
|
-
def initialize(
|
26
|
+
def initialize(init_args = {})
|
27
27
|
@doctors = VisitDoctors.new
|
28
28
|
@location = VisitLocation.new(init_args)
|
29
29
|
@admission = VisitAdmission.new(init_args)
|
@@ -40,7 +40,7 @@ module HealthcarePhony
|
|
40
40
|
|
41
41
|
private
|
42
42
|
|
43
|
-
def define_hospital_service(
|
43
|
+
def define_hospital_service(init_args = {})
|
44
44
|
standard_hospital_service = %w[CAR MED PUL SUR URO]
|
45
45
|
hs_choices = Helper.get_array(init_args[:hospital_service])
|
46
46
|
if !hs_choices.empty?
|
@@ -50,13 +50,13 @@ module HealthcarePhony
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def define_patient_class(
|
53
|
+
def define_patient_class(init_args = {})
|
54
54
|
standard_pc_choices = %w[B C E I N O P R U]
|
55
55
|
pc_choices = Helper.get_array(init_args[:patient_class])
|
56
56
|
!pc_choices.empty? ? pc_choices.sample : standard_pc_choices.sample
|
57
57
|
end
|
58
58
|
|
59
|
-
def define_ambulatory_status(
|
59
|
+
def define_ambulatory_status(init_args = {})
|
60
60
|
standard_ambulatory_status = %w[A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 B1 B2 B3 B4 B5 B6]
|
61
61
|
as_choices = Helper.get_array(init_args[:ambulatory_status])
|
62
62
|
if !as_choices.empty?
|
@@ -66,7 +66,7 @@ module HealthcarePhony
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
def define_bed_status(
|
69
|
+
def define_bed_status(init_args = {})
|
70
70
|
bs_choices = Helper.get_array(init_args[:bed_status])
|
71
71
|
if !bs_choices.empty?
|
72
72
|
bs_choices.sample
|
@@ -75,7 +75,7 @@ module HealthcarePhony
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
def define_patient_type(
|
78
|
+
def define_patient_type(init_args = {})
|
79
79
|
pt_choices = Helper.get_array(init_args[:patient_type])
|
80
80
|
if !pt_choices.empty?
|
81
81
|
pt_choices.sample
|
@@ -84,7 +84,7 @@ module HealthcarePhony
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
def define_vip(
|
87
|
+
def define_vip(init_args = {})
|
88
88
|
vip_choices = Helper.get_array(init_args[:vip_indicator])
|
89
89
|
if !vip_choices.empty?
|
90
90
|
vip_choices.sample
|
@@ -15,7 +15,7 @@ module HealthcarePhony
|
|
15
15
|
# gender - A Gender object which will be used to generate a Male or Female name if specified.
|
16
16
|
# degree_data_file - Location of YAML file containing a list of potential degrees to choose from. By default the
|
17
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(
|
18
|
+
def initialize(init_args = {})
|
19
19
|
@set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == ''
|
20
20
|
@gender = init_args[:gender]
|
21
21
|
@degree_data_file = get_degree_data_file(init_args)
|
@@ -33,7 +33,7 @@ module HealthcarePhony
|
|
33
33
|
attr_accessor :set_blank
|
34
34
|
attr_accessor :degree_data_file
|
35
35
|
|
36
|
-
def get_degree_data_file(
|
36
|
+
def get_degree_data_file(init_args = {})
|
37
37
|
if !init_args[:degree_data_file].nil?
|
38
38
|
init_args[:degree_data_file]
|
39
39
|
else
|
@@ -85,7 +85,7 @@ module HealthcarePhony
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
def define_degree(
|
88
|
+
def define_degree(init_args = {})
|
89
89
|
if @set_blank
|
90
90
|
''
|
91
91
|
elsif !init_args[:degree].nil?
|
@@ -11,7 +11,7 @@ module HealthcarePhony
|
|
11
11
|
:use_code,
|
12
12
|
:equipment_type
|
13
13
|
|
14
|
-
def initialize(
|
14
|
+
def initialize(init_args = {})
|
15
15
|
# Public: Initializes a home phone number. Pass in hash of different parameters, currently this includes:
|
16
16
|
# blank - An integer representing the % of times phone number components should be blank.
|
17
17
|
# use_code_data_file - YAML file containing use codes to randomly choose from. If not specified then values from
|
@@ -6,10 +6,11 @@ module HealthcarePhony
|
|
6
6
|
attr_accessor :code,
|
7
7
|
:description,
|
8
8
|
:coding_system
|
9
|
+
|
9
10
|
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
10
11
|
# race_data_file - Location of YAML file containing a list of potential degrees to choose from. By default the
|
11
12
|
# 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(
|
13
|
+
def initialize(init_args = {})
|
13
14
|
# TODO: allow a way for caller to pass in % blank
|
14
15
|
# TODO: set coding system
|
15
16
|
|
@@ -11,7 +11,7 @@ module HealthcarePhony
|
|
11
11
|
# religion_data_file - YAML file containing religion information to randomly choose from if different options than
|
12
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
13
|
# for default values.
|
14
|
-
def initialize(
|
14
|
+
def initialize(init_args = {})
|
15
15
|
# TODO: allow a way for caller to pass in a custom set of codes to choose from
|
16
16
|
# TODO: allow a way for caller to pass in % blank
|
17
17
|
|
@@ -12,7 +12,7 @@ module HealthcarePhony
|
|
12
12
|
# Ruby array. Otherwise default HL7 v2.5.1. Table 0007 values are used.
|
13
13
|
# admit_reason - Array of values to use as Admit Reason (PV2.3) to randomly choose from. Specified as comma
|
14
14
|
# separated String or Ruby array. Otherwise a string of data is generated with Faker::Lorem.sentence
|
15
|
-
def initialize(
|
15
|
+
def initialize(init_args = {})
|
16
16
|
@source = define_source(init_args)
|
17
17
|
@type = define_type(init_args)
|
18
18
|
@datetime = Faker::Time.backward(days: Faker::Number.number(digits: 1))
|
@@ -21,7 +21,7 @@ module HealthcarePhony
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
def define_source(
|
24
|
+
def define_source(init_args = {})
|
25
25
|
standard_admit_source = '123456789'.split('')
|
26
26
|
as_choices = Helper.get_array(init_args[:admit_source])
|
27
27
|
if !as_choices.empty?
|
@@ -31,7 +31,7 @@ module HealthcarePhony
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
def define_type(
|
34
|
+
def define_type(init_args = {})
|
35
35
|
standard_admission_types = %w[A C E L N R U]
|
36
36
|
at_choices = Helper.get_array(init_args[:admission_type])
|
37
37
|
if !at_choices.empty?
|
@@ -41,7 +41,7 @@ module HealthcarePhony
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def define_reason(
|
44
|
+
def define_reason(init_args = {})
|
45
45
|
ar_choices = Helper.get_array(init_args[:admit_reason])
|
46
46
|
if !ar_choices.empty?
|
47
47
|
ar_choices.sample
|
@@ -14,7 +14,7 @@ module HealthcarePhony
|
|
14
14
|
# discharge_location - Array of discharge locations to randomly choose from. Specified as comma separated String or
|
15
15
|
# Ruby array. Otherwise a string of data is generated with Faker::Lorem.sentence
|
16
16
|
# admit_datetime - The admit date/time associated with this visit. If not specified the current date/time is used.
|
17
|
-
def initialize(
|
17
|
+
def initialize(init_args = {})
|
18
18
|
if init_args[:event_type] == 'A03'
|
19
19
|
@disposition = define_discharge_disposition(init_args)
|
20
20
|
@location = define_discharge_location(init_args)
|
@@ -28,7 +28,7 @@ module HealthcarePhony
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
def define_discharge_disposition(
|
31
|
+
def define_discharge_disposition(init_args = {})
|
32
32
|
dd_choices = Helper.get_array(init_args[:discharge_disposition])
|
33
33
|
if init_args[:event_type] != 'A03'
|
34
34
|
''
|
@@ -41,7 +41,7 @@ module HealthcarePhony
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
def define_discharge_location(
|
44
|
+
def define_discharge_location(init_args = {})
|
45
45
|
dl_choices = Helper.get_array(init_args[:discharge_location])
|
46
46
|
if !dl_choices.empty?
|
47
47
|
dl_choices.sample
|
@@ -50,7 +50,7 @@ module HealthcarePhony
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def define_discharge_datetime(
|
53
|
+
def define_discharge_datetime(init_args = {})
|
54
54
|
from_datetime = if init_args[:admit_datetime].nil?
|
55
55
|
Time.now
|
56
56
|
else
|
@@ -32,7 +32,7 @@ module HealthcarePhony
|
|
32
32
|
# String or Ruby array. Otherwise a random 2 digit number is used.
|
33
33
|
# location_description - Array of potential location descriptions (PV1.3.9) to randomly choose from. Specified as
|
34
34
|
# a comma separated String or Ruby array. Otherwise a random string is generated.
|
35
|
-
def initialize(
|
35
|
+
def initialize(init_args = {})
|
36
36
|
@point_of_care = define_point_of_care(init_args)
|
37
37
|
@room = define_room(init_args)
|
38
38
|
@bed = define_bed(init_args)
|
@@ -46,12 +46,12 @@ module HealthcarePhony
|
|
46
46
|
|
47
47
|
private
|
48
48
|
|
49
|
-
def define_point_of_care(
|
49
|
+
def define_point_of_care(init_args = {})
|
50
50
|
poc_choices = Helper.get_array(init_args[:point_of_care])
|
51
51
|
!poc_choices.empty? ? poc_choices.sample : /[A-Z]{10}/.random_example
|
52
52
|
end
|
53
53
|
|
54
|
-
def define_room(
|
54
|
+
def define_room(init_args = {})
|
55
55
|
room_choices = Helper.get_array(init_args[:room])
|
56
56
|
if !room_choices.empty?
|
57
57
|
room_choices.sample
|
@@ -60,7 +60,7 @@ module HealthcarePhony
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
def define_bed(
|
63
|
+
def define_bed(init_args = {})
|
64
64
|
bed_choices = Helper.get_array(init_args[:bed])
|
65
65
|
if !bed_choices.empty?
|
66
66
|
bed_choices.sample
|
@@ -69,32 +69,32 @@ module HealthcarePhony
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
def define_facility(
|
72
|
+
def define_facility(init_args = {})
|
73
73
|
fac_choices = Helper.get_array(init_args[:facility])
|
74
74
|
!fac_choices.empty? ? fac_choices.sample : Faker::Lorem.sentence
|
75
75
|
end
|
76
76
|
|
77
|
-
def define_status(
|
77
|
+
def define_status(init_args = {})
|
78
78
|
ls_choices = Helper.get_array(init_args[:location_status])
|
79
79
|
!ls_choices.empty? ? ls_choices.sample : /[A-Z]/.random_example
|
80
80
|
end
|
81
81
|
|
82
|
-
def define_type(
|
82
|
+
def define_type(init_args = {})
|
83
83
|
plt_choices = Helper.get_array(init_args[:person_location_type])
|
84
84
|
!plt_choices.empty? ? plt_choices.sample : %w[C D H N O P S].sample
|
85
85
|
end
|
86
86
|
|
87
|
-
def define_building(
|
87
|
+
def define_building(init_args = {})
|
88
88
|
building_choices = Helper.get_array(init_args[:building])
|
89
89
|
!building_choices.empty? ? building_choices.sample : /[1-9]/.random_example
|
90
90
|
end
|
91
91
|
|
92
|
-
def define_floor(
|
92
|
+
def define_floor(init_args = {})
|
93
93
|
floor_choices = Helper.get_array(init_args[:floor])
|
94
94
|
!floor_choices.empty? ? floor_choices.sample : /[0-9]{2}/.random_example
|
95
95
|
end
|
96
96
|
|
97
|
-
def define_description(
|
97
|
+
def define_description(init_args = {})
|
98
98
|
ld_choices = Helper.get_array(init_args[:location_description])
|
99
99
|
if !ld_choices.empty?
|
100
100
|
ld_choices.sample
|
@@ -9,7 +9,7 @@ module HealthcarePhony
|
|
9
9
|
# blank - An integer representing the % of times phone number components should be blank.
|
10
10
|
# use_code - Allows specification of the phone use code (PID.13.2)
|
11
11
|
# equipment_type - Allows specification of the phone equipment type (PID.13.3)
|
12
|
-
def initialize(
|
12
|
+
def initialize(init_args = {})
|
13
13
|
super(init_args)
|
14
14
|
@use_code = init_args[:use_code].nil? ? 'WPN' : init_args[:use_code]
|
15
15
|
@use_code = '' unless @set_blank == false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: healthcare_phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Moody
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|