healthcare_phony 0.7s.0 → 0.7.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 -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,89 +1,89 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HealthcarePhony
|
4
|
-
# Public: Generates a fake Address
|
5
|
-
class Address
|
6
|
-
attr_accessor :address_line1, :address_line2, :city, :state, :postal_code, :country, :address_type
|
7
|
-
|
8
|
-
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
9
|
-
# blank - An integer representing the % of times Address components should be blank.
|
10
|
-
# state - Allows specification of the Address state instead of randomly being chosen.
|
11
|
-
# country - Allows specification of the Address country. Is blank by default.
|
12
|
-
# address_type - Allows specification of the Address type.
|
13
|
-
# address_type_data_file - YAML file containing address types to randomly choose from if different options than
|
14
|
-
# those that come with gem are desired.
|
15
|
-
# See {address_type.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/address_type.yml]
|
16
|
-
def initialize(init_args = {})
|
17
|
-
@set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == ''
|
18
|
-
@state = init_args[:state]
|
19
|
-
@country = init_args[:country]
|
20
|
-
@address_type_data_file = init_args[:address_type_data_file]
|
21
|
-
@address_type = init_args[:address_type]
|
22
|
-
define_address_line1
|
23
|
-
define_address_line2
|
24
|
-
define_city
|
25
|
-
define_state
|
26
|
-
define_postal_code
|
27
|
-
define_country
|
28
|
-
define_address_type
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
# Private: Boolean set during initialization if Address components should be set to blank.
|
34
|
-
attr_accessor :set_blank
|
35
|
-
# Private: File containing address types to randomly choose from.
|
36
|
-
attr_accessor :address_type_data_file
|
37
|
-
|
38
|
-
# Private: Randomly generates the street address (address_line1)
|
39
|
-
def define_address_line1
|
40
|
-
@address_line1 = Faker::Address.street_address
|
41
|
-
@address_line1 = '' unless @set_blank == false
|
42
|
-
end
|
43
|
-
|
44
|
-
# Private: Randomly generates a second part of the street address (address_line2)
|
45
|
-
def define_address_line2
|
46
|
-
@address_line2 = Faker::Address.secondary_address
|
47
|
-
@address_line2 = '' unless @set_blank == false
|
48
|
-
end
|
49
|
-
|
50
|
-
# Private: Randomly generates the city.
|
51
|
-
def define_city
|
52
|
-
@city = Faker::Address.city
|
53
|
-
@city = '' unless @set_blank == false
|
54
|
-
end
|
55
|
-
|
56
|
-
# Private: Randomly generates the state unless state was specified during initialization.
|
57
|
-
def define_state
|
58
|
-
@state = Faker::Address.state_abbr if @state.nil?
|
59
|
-
@state = '' unless @set_blank == false
|
60
|
-
end
|
61
|
-
|
62
|
-
# Private: Randomly generates the postal/zip code.
|
63
|
-
def define_postal_code
|
64
|
-
@postal_code = Faker::Address.zip_code(state_abbreviation: @state)
|
65
|
-
@postal_code = '' unless @set_blank == false
|
66
|
-
end
|
67
|
-
|
68
|
-
def define_country
|
69
|
-
@country = '' if @country.nil?
|
70
|
-
@country = '' unless @set_blank == false
|
71
|
-
end
|
72
|
-
|
73
|
-
# Private: Sets the address type, either by the address type specified during initialization, by randomly choosing
|
74
|
-
# a value from the address_type.yml file, or by a random value from a file specified by address_type_data_file
|
75
|
-
# during initialization.
|
76
|
-
def define_address_type
|
77
|
-
if @address_type.nil?
|
78
|
-
data_file = if !@address_type_data_file.nil?
|
79
|
-
@address_type_data_file
|
80
|
-
else
|
81
|
-
"#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/address_type.yml"
|
82
|
-
end
|
83
|
-
address_types = Psych.load_file(data_file)
|
84
|
-
@address_type = address_types.sample unless address_types.nil?
|
85
|
-
end
|
86
|
-
@address_type = '' unless @set_blank == false
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HealthcarePhony
|
4
|
+
# Public: Generates a fake Address
|
5
|
+
class Address
|
6
|
+
attr_accessor :address_line1, :address_line2, :city, :state, :postal_code, :country, :address_type
|
7
|
+
|
8
|
+
# Public: Initializes an Address. Pass in hash of different parameters, currently this includes:
|
9
|
+
# blank - An integer representing the % of times Address components should be blank.
|
10
|
+
# state - Allows specification of the Address state instead of randomly being chosen.
|
11
|
+
# country - Allows specification of the Address country. Is blank by default.
|
12
|
+
# address_type - Allows specification of the Address type.
|
13
|
+
# address_type_data_file - YAML file containing address types to randomly choose from if different options than
|
14
|
+
# those that come with gem are desired.
|
15
|
+
# See {address_type.yml}[https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/address_type.yml]
|
16
|
+
def initialize(init_args = {})
|
17
|
+
@set_blank = !init_args[:blank].nil? && Helper.random_with_blank('X', init_args[:blank]) == ''
|
18
|
+
@state = init_args[:state]
|
19
|
+
@country = init_args[:country]
|
20
|
+
@address_type_data_file = init_args[:address_type_data_file]
|
21
|
+
@address_type = init_args[:address_type]
|
22
|
+
define_address_line1
|
23
|
+
define_address_line2
|
24
|
+
define_city
|
25
|
+
define_state
|
26
|
+
define_postal_code
|
27
|
+
define_country
|
28
|
+
define_address_type
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
# Private: Boolean set during initialization if Address components should be set to blank.
|
34
|
+
attr_accessor :set_blank
|
35
|
+
# Private: File containing address types to randomly choose from.
|
36
|
+
attr_accessor :address_type_data_file
|
37
|
+
|
38
|
+
# Private: Randomly generates the street address (address_line1)
|
39
|
+
def define_address_line1
|
40
|
+
@address_line1 = Faker::Address.street_address
|
41
|
+
@address_line1 = '' unless @set_blank == false
|
42
|
+
end
|
43
|
+
|
44
|
+
# Private: Randomly generates a second part of the street address (address_line2)
|
45
|
+
def define_address_line2
|
46
|
+
@address_line2 = Faker::Address.secondary_address
|
47
|
+
@address_line2 = '' unless @set_blank == false
|
48
|
+
end
|
49
|
+
|
50
|
+
# Private: Randomly generates the city.
|
51
|
+
def define_city
|
52
|
+
@city = Faker::Address.city
|
53
|
+
@city = '' unless @set_blank == false
|
54
|
+
end
|
55
|
+
|
56
|
+
# Private: Randomly generates the state unless state was specified during initialization.
|
57
|
+
def define_state
|
58
|
+
@state = Faker::Address.state_abbr if @state.nil?
|
59
|
+
@state = '' unless @set_blank == false
|
60
|
+
end
|
61
|
+
|
62
|
+
# Private: Randomly generates the postal/zip code.
|
63
|
+
def define_postal_code
|
64
|
+
@postal_code = Faker::Address.zip_code(state_abbreviation: @state)
|
65
|
+
@postal_code = '' unless @set_blank == false
|
66
|
+
end
|
67
|
+
|
68
|
+
def define_country
|
69
|
+
@country = '' if @country.nil?
|
70
|
+
@country = '' unless @set_blank == false
|
71
|
+
end
|
72
|
+
|
73
|
+
# Private: Sets the address type, either by the address type specified during initialization, by randomly choosing
|
74
|
+
# a value from the address_type.yml file, or by a random value from a file specified by address_type_data_file
|
75
|
+
# during initialization.
|
76
|
+
def define_address_type
|
77
|
+
if @address_type.nil?
|
78
|
+
data_file = if !@address_type_data_file.nil?
|
79
|
+
@address_type_data_file
|
80
|
+
else
|
81
|
+
"#{::File.expand_path(::File.join("..", "data_files"), __FILE__)}/address_type.yml"
|
82
|
+
end
|
83
|
+
address_types = Psych.load_file(data_file)
|
84
|
+
@address_type = address_types.sample unless address_types.nil?
|
85
|
+
end
|
86
|
+
@address_type = '' unless @set_blank == false
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HealthcarePhony
|
4
|
-
class AssigningAuthority
|
5
|
-
end
|
6
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HealthcarePhony
|
4
|
+
class AssigningAuthority
|
5
|
+
end
|
6
|
+
end
|
@@ -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 cell phone number
|
7
|
-
class CellPhoneNumber < PhoneNumber
|
8
|
-
# Public: Initializes a cell 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? ? 'ORN' : init_args[:use_code]
|
15
|
-
@use_code = '' unless @set_blank == false
|
16
|
-
@equipment_type = init_args[:equipment_type].nil? ? 'CP' : 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 cell phone number
|
7
|
+
class CellPhoneNumber < PhoneNumber
|
8
|
+
# Public: Initializes a cell 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? ? 'ORN' : init_args[:use_code]
|
15
|
+
@use_code = '' unless @set_blank == false
|
16
|
+
@equipment_type = init_args[:equipment_type].nil? ? 'CP' : init_args[:equipment_type]
|
17
|
+
@equipment_type = '' unless @set_blank == false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
- H
|
3
|
-
- L
|
4
|
-
- M
|
5
|
-
- P
|
6
|
-
- O
|
7
|
-
- C
|
1
|
+
---
|
2
|
+
- H
|
3
|
+
- L
|
4
|
+
- M
|
5
|
+
- P
|
6
|
+
- O
|
7
|
+
- C
|
@@ -1,59 +1,59 @@
|
|
1
|
-
---
|
2
|
-
- A01
|
3
|
-
- A02
|
4
|
-
- A03
|
5
|
-
- A04
|
6
|
-
- A05
|
7
|
-
- A06
|
8
|
-
- A07
|
9
|
-
- A08
|
10
|
-
- A09
|
11
|
-
- A10
|
12
|
-
- A11
|
13
|
-
- A12
|
14
|
-
- A13
|
15
|
-
- A14
|
16
|
-
- A15
|
17
|
-
- A16
|
18
|
-
- A17
|
19
|
-
- A18
|
20
|
-
- A19
|
21
|
-
- A20
|
22
|
-
- A21
|
23
|
-
- A22
|
24
|
-
- A23
|
25
|
-
- A24
|
26
|
-
- A25
|
27
|
-
- A26
|
28
|
-
- A27
|
29
|
-
- A28
|
30
|
-
- A29
|
31
|
-
- A30
|
32
|
-
- A31
|
33
|
-
- A32
|
34
|
-
- A33
|
35
|
-
- A34
|
36
|
-
- A35
|
37
|
-
- A36
|
38
|
-
- A37
|
39
|
-
- A38
|
40
|
-
- A39
|
41
|
-
- A40
|
42
|
-
- A41
|
43
|
-
- A42
|
44
|
-
- A43
|
45
|
-
- A44
|
46
|
-
- A45
|
47
|
-
- A46
|
48
|
-
- A47
|
49
|
-
- A48
|
50
|
-
- A49
|
51
|
-
- A50
|
52
|
-
- A51
|
53
|
-
- A52
|
54
|
-
- A53
|
55
|
-
- A54
|
56
|
-
- A55
|
57
|
-
- A60
|
58
|
-
- A61
|
59
|
-
- A62
|
1
|
+
---
|
2
|
+
- A01
|
3
|
+
- A02
|
4
|
+
- A03
|
5
|
+
- A04
|
6
|
+
- A05
|
7
|
+
- A06
|
8
|
+
- A07
|
9
|
+
- A08
|
10
|
+
- A09
|
11
|
+
- A10
|
12
|
+
- A11
|
13
|
+
- A12
|
14
|
+
- A13
|
15
|
+
- A14
|
16
|
+
- A15
|
17
|
+
- A16
|
18
|
+
- A17
|
19
|
+
- A18
|
20
|
+
- A19
|
21
|
+
- A20
|
22
|
+
- A21
|
23
|
+
- A22
|
24
|
+
- A23
|
25
|
+
- A24
|
26
|
+
- A25
|
27
|
+
- A26
|
28
|
+
- A27
|
29
|
+
- A28
|
30
|
+
- A29
|
31
|
+
- A30
|
32
|
+
- A31
|
33
|
+
- A32
|
34
|
+
- A33
|
35
|
+
- A34
|
36
|
+
- A35
|
37
|
+
- A36
|
38
|
+
- A37
|
39
|
+
- A38
|
40
|
+
- A39
|
41
|
+
- A40
|
42
|
+
- A41
|
43
|
+
- A42
|
44
|
+
- A43
|
45
|
+
- A44
|
46
|
+
- A45
|
47
|
+
- A46
|
48
|
+
- A47
|
49
|
+
- A48
|
50
|
+
- A49
|
51
|
+
- A50
|
52
|
+
- A51
|
53
|
+
- A52
|
54
|
+
- A53
|
55
|
+
- A54
|
56
|
+
- A55
|
57
|
+
- A60
|
58
|
+
- A61
|
59
|
+
- A62
|
@@ -1,9 +1,9 @@
|
|
1
|
-
---
|
2
|
-
- MD
|
3
|
-
- CANP
|
4
|
-
- CMA
|
5
|
-
- CNM
|
6
|
-
- CNP
|
7
|
-
- CNS
|
8
|
-
- CPNP
|
9
|
-
- CRN
|
1
|
+
---
|
2
|
+
- MD
|
3
|
+
- CANP
|
4
|
+
- CMA
|
5
|
+
- CNM
|
6
|
+
- CNP
|
7
|
+
- CNS
|
8
|
+
- CPNP
|
9
|
+
- CRN
|
@@ -1,15 +1,15 @@
|
|
1
|
-
---
|
2
|
-
- '01'
|
3
|
-
- '02'
|
4
|
-
- '03'
|
5
|
-
- '04'
|
6
|
-
- '05'
|
7
|
-
- '06'
|
8
|
-
- '07'
|
9
|
-
- '08'
|
10
|
-
- '09'
|
11
|
-
- '20'
|
12
|
-
- '30'
|
13
|
-
- '40'
|
14
|
-
- '41'
|
15
|
-
- '42'
|
1
|
+
---
|
2
|
+
- '01'
|
3
|
+
- '02'
|
4
|
+
- '03'
|
5
|
+
- '04'
|
6
|
+
- '05'
|
7
|
+
- '06'
|
8
|
+
- '07'
|
9
|
+
- '08'
|
10
|
+
- '09'
|
11
|
+
- '20'
|
12
|
+
- '30'
|
13
|
+
- '40'
|
14
|
+
- '41'
|
15
|
+
- '42'
|
@@ -1,10 +1,10 @@
|
|
1
|
-
---
|
2
|
-
- :code: H
|
3
|
-
:description: 'Hispanic or Latino'
|
4
|
-
:coding_system: HL70189
|
5
|
-
- :code: N
|
6
|
-
:description: 'Not Hispanic or Latino'
|
7
|
-
:coding_system: HL70189
|
8
|
-
- :code: U
|
9
|
-
:description: Unknown
|
1
|
+
---
|
2
|
+
- :code: H
|
3
|
+
:description: 'Hispanic or Latino'
|
4
|
+
:coding_system: HL70189
|
5
|
+
- :code: N
|
6
|
+
:description: 'Not Hispanic or Latino'
|
7
|
+
:coding_system: HL70189
|
8
|
+
- :code: U
|
9
|
+
:description: Unknown
|
10
10
|
:coding_system: HL70189
|
@@ -1,4 +1,4 @@
|
|
1
|
-
---
|
2
|
-
- ADT
|
3
|
-
- ORU
|
4
|
-
- MDM
|
1
|
+
---
|
2
|
+
- ADT
|
3
|
+
- ORU
|
4
|
+
- MDM
|