healthcare_phony 0.7s.0 → 0.7.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/.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 -365
- data/Rakefile +12 -12
- data/VERSION +1 -1
- data/examples/bigger_csv_example.erb +3 -3
- data/examples/phony_adt_sender.rb +111 -111
- data/examples/phony_adt_sender.yml +11 -11
- data/examples/phony_csv.yml +4 -4
- data/healthcare_phony.gemspec +36 -36
- data/lib/healthcare_phony.rb +138 -139
- 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 +5 -5
@@ -1,6 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HealthcarePhony
|
4
|
-
class Procedure
|
5
|
-
end
|
6
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HealthcarePhony
|
4
|
+
class Procedure
|
5
|
+
end
|
6
|
+
end
|
@@ -1,31 +1,31 @@
|
|
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
|
-
|
10
|
-
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
11
|
-
# race_data_file - Location of YAML file containing a list of potential degrees to choose from. By default the
|
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].
|
13
|
-
def initialize(init_args = {})
|
14
|
-
# TODO: allow a way for caller to pass in % blank
|
15
|
-
# TODO: set coding system
|
16
|
-
|
17
|
-
data_file = if !init_args[:race_data_file].nil?
|
18
|
-
init_args[:race_data_file]
|
19
|
-
else
|
20
|
-
"#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/race.yml"
|
21
|
-
end
|
22
|
-
race_array = Psych.load_file(data_file)
|
23
|
-
|
24
|
-
random_race = race_array.nil? ? '' : race_array.sample
|
25
|
-
|
26
|
-
@code = random_race[:code]
|
27
|
-
@description = random_race[:description]
|
28
|
-
@coding_system = ''
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
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
|
+
|
10
|
+
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
11
|
+
# race_data_file - Location of YAML file containing a list of potential degrees to choose from. By default the
|
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].
|
13
|
+
def initialize(init_args = {})
|
14
|
+
# TODO: allow a way for caller to pass in % blank
|
15
|
+
# TODO: set coding system
|
16
|
+
|
17
|
+
data_file = if !init_args[:race_data_file].nil?
|
18
|
+
init_args[:race_data_file]
|
19
|
+
else
|
20
|
+
"#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/race.yml"
|
21
|
+
end
|
22
|
+
race_array = Psych.load_file(data_file)
|
23
|
+
|
24
|
+
random_race = race_array.nil? ? '' : race_array.sample
|
25
|
+
|
26
|
+
@code = random_race[:code]
|
27
|
+
@description = random_race[:description]
|
28
|
+
@coding_system = ''
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,32 +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
|
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
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if write_header %>
|
2
|
-
MRN,FIRST_NAME,LAST_NAME
|
3
|
-
<% end %>
|
1
|
+
<% if write_header %>
|
2
|
+
MRN,FIRST_NAME,LAST_NAME
|
3
|
+
<% end %>
|
4
4
|
"<%= patient.medical_record_number.identifier %>","<%= patient.names[0].given_name %>","<%= patient.names[0].family_name %>"
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HealthcarePhony
|
4
|
-
VERSION = File.read(File.expand_path('../../VERSION', __dir__)).strip.freeze
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HealthcarePhony
|
4
|
+
VERSION = File.read(File.expand_path('../../VERSION', __dir__)).strip.freeze
|
5
|
+
end
|
@@ -1,53 +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
|
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
|
@@ -1,62 +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
|
-
# visit_type - VisitType of this patient's visit
|
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[:visit_type] == HealthcarePhony::VisitType::DISCHARGE # 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[:visit_type] != HealthcarePhony::VisitType::DISCHARGE # 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
|
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
|
+
# visit_type - VisitType of this patient's visit
|
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[:visit_type] == HealthcarePhony::VisitType::DISCHARGE # 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[:visit_type] != HealthcarePhony::VisitType::DISCHARGE # 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
|
@@ -1,19 +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(init_args = {})
|
13
|
-
@attending = Doctor.new(init_args)
|
14
|
-
@referring = Doctor.new(init_args)
|
15
|
-
@consulting = Doctor.new(init_args)
|
16
|
-
@admitting = Doctor.new(init_args)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
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(init_args = {})
|
13
|
+
@attending = Doctor.new(init_args)
|
14
|
+
@referring = Doctor.new(init_args)
|
15
|
+
@consulting = Doctor.new(init_args)
|
16
|
+
@admitting = Doctor.new(init_args)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,106 +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
|
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
|