healthcare_phony 0.5.1 → 0.6.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/README.md +1 -0
- data/VERSION +1 -1
- data/lib/healthcare_phony.rb +14 -1
- data/lib/healthcare_phony/doctor.rb +2 -1
- data/lib/healthcare_phony/patient_visit.rb +2 -1
- data/lib/healthcare_phony/person_name.rb +2 -2
- data/lib/healthcare_phony/templates/adt_example.erb +3 -3
- data/lib/healthcare_phony/visit_discharge.rb +3 -3
- data/lib/healthcare_phony/visit_doctors.rb +5 -5
- data/lib/healthcare_phony/visit_type.rb +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52179664ed49c4f5ddac39695bf24e697078ae4f9e860a2556374fd3cfe55d59
|
4
|
+
data.tar.gz: 47e45882af902b835ae546ff2d472da3270adf07f21d8987eb71bd9ef0001467
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af04102942b12b4a48732fec3ead0cc21285f21ae28f6c5606e96339079aad1fe4db3e83c80492f51a1a6968d060436cfa9f0420bc91fe21e51de24bc29d5af8
|
7
|
+
data.tar.gz: ebea7beb8d35daa149140de9c0409bfd0410bde1dac7ca8cbd935127d41fe2850e6fb9939b35d7f97d4422c853b0693af00cdd0a2eabf4e6edaec4ce1e4e5ae9
|
data/README.md
CHANGED
@@ -147,6 +147,7 @@ The creation of the Patient can be customized by sending the following parameter
|
|
147
147
|
* race_count → By default on Race is generated, this allows you to specify a number > 1.
|
148
148
|
* gender → A Gender object which will be used to generate a Male or Female name if specified.
|
149
149
|
* degree_data_file → Location of YAML file containing a list of potential degrees to choose from. By default the 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).
|
150
|
+
* visit_type → VisitType of this patient's visit
|
150
151
|
|
151
152
|
### Patient Visit
|
152
153
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/lib/healthcare_phony.rb
CHANGED
@@ -19,7 +19,7 @@ module HealthcarePhony
|
|
19
19
|
set_template
|
20
20
|
@hl7_message = Hl7Message.new(@adt_arguments)
|
21
21
|
@patient = Patient.new(@adt_arguments)
|
22
|
-
@visit = PatientVisit.new(@adt_arguments)
|
22
|
+
@visit = PatientVisit.new(@adt_arguments.merge({ visit_type: set_visit_type }))
|
23
23
|
end
|
24
24
|
|
25
25
|
def to_s
|
@@ -40,6 +40,19 @@ module HealthcarePhony
|
|
40
40
|
File.read(@adt_arguments[:template_file])
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
def set_visit_type
|
45
|
+
case @hl7_message.trigger_event
|
46
|
+
when 'A01'
|
47
|
+
HealthcarePhony::VisitType::ADMIT
|
48
|
+
when 'A03'
|
49
|
+
HealthcarePhony::VisitType::DISCHARGE
|
50
|
+
when 'A04'
|
51
|
+
HealthcarePhony::VisitType::REGISTRATION
|
52
|
+
else
|
53
|
+
HealthcarePhony::VisitType::OTHER
|
54
|
+
end
|
55
|
+
end
|
43
56
|
end
|
44
57
|
|
45
58
|
class CsvFile
|
@@ -23,8 +23,9 @@ 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
|
+
# visit_type - VisitType of the patient's visit
|
26
27
|
def initialize(init_args = {})
|
27
|
-
@doctors = VisitDoctors.new
|
28
|
+
@doctors = VisitDoctors.new(init_args)
|
28
29
|
@location = VisitLocation.new(init_args)
|
29
30
|
@admission = VisitAdmission.new(init_args)
|
30
31
|
@bed_status = define_bed_status(init_args)
|
@@ -19,8 +19,8 @@ module HealthcarePhony
|
|
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)
|
22
|
-
@given_name = define_given_name
|
23
|
-
@family_name = define_family_name
|
22
|
+
@given_name = (init_args[:given_name_append].nil? ? '' : init_args[:given_name_append]) + define_given_name
|
23
|
+
@family_name = (init_args[:family_name_append].nil? ? '' : init_args[:family_name_append]) + define_family_name
|
24
24
|
@middle_name = define_middle_name
|
25
25
|
@suffix = define_suffix
|
26
26
|
@prefix = define_prefix
|
@@ -1,6 +1,6 @@
|
|
1
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
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
|
4
|
-
PV1||<%= visit.patient_class %>
|
5
|
-
|
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.language.code %>^<%= patient.language.description %>^<%= patient.language.coding_system %>|<%= patient.marital_status.code %>^<%= patient.marital_status.description %>^<%= patient.marital_status.coding_system %>|<%= patient.religion.code %>^<%= patient.religion.description %>^<%= patient.religion.coding_system %>|<%= patient.account_number.identifier %>|<%= patient.ssn %>
|
4
|
+
PV1||<%= visit.patient_class %>|<%= visit.location.point_of_care %>^<%= visit.location.room %>^<%= visit.location.bed %>^<%= visit.location.facility %>^<%= visit.location.status %>^<%= visit.location.type %>^<%= visit.location.building %>^<%= visit.location.floor %>^<%= visit.location.description %>|<%= visit.admission.type %>|||<%= visit.doctors.attending.identifier %>^<%= visit.doctors.attending.name.family_name %>^<%= visit.doctors.attending.name.given_name %>^<%= visit.doctors.attending.name.middle_name %>^<%= visit.doctors.attending.name.suffix %>^<%= visit.doctors.attending.name.prefix %>^<%= visit.doctors.attending.name.degree %>|<%= visit.doctors.referring.identifier %>^<%= visit.doctors.referring.name.family_name %>^<%= visit.doctors.referring.name.given_name %>^<%= visit.doctors.referring.name.middle_name %>^<%= visit.doctors.referring.name.suffix %>^<%= visit.doctors.referring.name.prefix %>^<%= visit.doctors.referring.name.degree %>|<%= visit.doctors.consulting.identifier %>^<%= visit.doctors.consulting.name.family_name %>^<%= visit.doctors.consulting.name.given_name %>^<%= visit.doctors.consulting.name.middle_name %>^<%= visit.doctors.consulting.name.suffix %>^<%= visit.doctors.consulting.name.prefix %>^<%= visit.doctors.consulting.name.degree %>|<%= visit.hospital_service %>|11|12|<%= visit.readmission_indicator %>|<%= visit.admission.source %>|15|16|<%= visit.doctors.admitting.identifier %>^<%= visit.doctors.admitting.name.family_name %>^<%= visit.doctors.admitting.name.given_name %>^<%= visit.doctors.admitting.name.middle_name %>^<%= visit.doctors.admitting.name.suffix %>^<%= visit.doctors.admitting.name.prefix %>^<%= visit.doctors.admitting.name.degree %>|<%= visit.patient_type %>|<%= visit.visit_number.identifier %>^^^^<%= visit.visit_number.identifier_type_code %>|||||||||||||||||<%= visit.discharge.disposition %>|<%= visit.discharge.location %>|38|39|40|41|42|43|<%= visit.admission.datetime.to_hl7datetime() %>|<%= visit.discharge.datetime.to_hl7datetime() %>
|
5
|
+
PV2|||^<%= visit.admission.reason %>
|
6
6
|
|
@@ -8,14 +8,14 @@ module HealthcarePhony
|
|
8
8
|
:datetime
|
9
9
|
|
10
10
|
# Public: Initializes an EthnicGroup. Pass in hash of different parameters, currently this includes:
|
11
|
-
#
|
11
|
+
# visit_type - VisitType of this patient's visit
|
12
12
|
# discharge_disposition - Array of discharge disposition codes (PV1.36) to randomly choose from. Specified as comma
|
13
13
|
# separated String or Ruby array. Otherwise default HL7 v2.5.1 Table 0112 values are used.
|
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
17
|
def initialize(init_args = {})
|
18
|
-
if init_args[:event_type] == 'A03'
|
18
|
+
if init_args[:visit_type] == HealthcarePhony::VisitType::DISCHARGE # init_args[:event_type] == 'A03'
|
19
19
|
@disposition = define_discharge_disposition(init_args)
|
20
20
|
@location = define_discharge_location(init_args)
|
21
21
|
@datetime = define_discharge_datetime(init_args)
|
@@ -30,7 +30,7 @@ module HealthcarePhony
|
|
30
30
|
|
31
31
|
def define_discharge_disposition(init_args = {})
|
32
32
|
dd_choices = Helper.get_array(init_args[:discharge_disposition])
|
33
|
-
if init_args[:event_type] != 'A03'
|
33
|
+
if init_args[:visit_type] != HealthcarePhony::VisitType::DISCHARGE # init_args[:event_type] != 'A03'
|
34
34
|
''
|
35
35
|
elsif !dd_choices.empty?
|
36
36
|
dd_choices.sample
|
@@ -9,11 +9,11 @@ module HealthcarePhony
|
|
9
9
|
:consulting,
|
10
10
|
:admitting
|
11
11
|
|
12
|
-
def initialize
|
13
|
-
@attending = Doctor.new
|
14
|
-
@referring = Doctor.new
|
15
|
-
@consulting = Doctor.new
|
16
|
-
@admitting = Doctor.new
|
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
17
|
end
|
18
18
|
end
|
19
19
|
end
|
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.6.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-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- lib/healthcare_phony/visit_discharge.rb
|
161
161
|
- lib/healthcare_phony/visit_doctors.rb
|
162
162
|
- lib/healthcare_phony/visit_location.rb
|
163
|
+
- lib/healthcare_phony/visit_type.rb
|
163
164
|
- lib/healthcare_phony/work_phone_number.rb
|
164
165
|
homepage: http://github.com/austinmoody/healthcare_phony
|
165
166
|
licenses:
|