# HealthcarePhony This is an admittedly _rough_ RubyGem used to generate fake data that can be used in creating test HL7, CSV, or other data for healthcare integration testing. ## Installation Add this line to your application's Gemfile: ```ruby gem 'healthcare_phony' ``` And then execute: $ bundle install Or install it yourself as: $ gem install healthcare_phony ## Usage The general purpose of this gem is to generate various pieces of data useful in creating test healthcare integration data. Like HL7 messages or CSV files. The high level objects available are: * Patient * Patient Visit * HL7 Message * Doctor ### Patient ```ruby patient = Patient.new ``` The above will give you a default Patient object: ``` #, @addresses= [#], @birth_order="", @cell_phone= #, @date_of_birth=#, @death_datetime=2007-11-05 15:24:26 -0500, @death_indicator="Y", @ethnic_group= #, @gender= #, @home_phone= #, @language= #, @marital_status= #, @medical_record_number= #, @multiple_birth_indicator="N", @names= [#], @races= [#], @religion= #, @ssn="320-79-1958", @work_phone= #> ``` The creation of the Patient can be customized by sending the following parameters when initializing: * blank → An integer representing the % of times PatientName components should be blank. * names_count → By default one PatientName is generated, this allows you to specify a number > 1. * address_count → By default on Address is generated, this allows you to specify a number > 1. * min_age → A minimum age (in years) for the Patient. * max_age → A maximum age (in years) for the Patient. * race_count → By default on Race is generated, this allows you to specify a number > 1. * gender → A Gender object which will be used to generate a Male or Female name if specified. * 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). ### Patient Visit ```ruby pv = HealthcarePhony::PatientVisit.new ``` The above will give you a default PatientVisit object: ``` #, @ambulatory_status="A6", @bed_status="K", @discharge= #, @doctors= #>, @attending= #>, @consulting= #>, @referring= #>>, @hospital_service="URO", @location= #, @patient_class="I", @patient_type="", @readmission_indicator="", @vip_indicator="", @visit_number= #> ``` The creation of the PatientVisit can be customized by sending the following parameters when initializing: * hospital_service → Array of Hospital Service codes (PV1.10) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise default HL7 v2.5.1 Table 0069 values are used. * patient_class → Array of Patient Class codes (PV1.2) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise default HL7 v2.5.1 Table 0004 values are used. * ambulatory_status → Array of Ambulatory Status codes (PV1.15) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise default HL7 v2.5.1 Table 0009 values are used. * bed_status → Array of Bed Status codes (PV1.40) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise default HL7 v2.5.1 Table 0116 values are used. * patient_type → Array of Patient Type codes (PV1.18) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise this field is left blank. * vip_indicator → Array of Patient Type codes (PV1.18) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise this field is left blank. * point_of_care → Array of potential points of care (PV1.3.1) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise random example generated. * room → Array of potential rooms (PV1.3.2) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise a random 3 digit number is generated. * bed → Array of potential beds (PV1.3.3) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise a 3 character sequence is created. * facility → Array of potential facility names (PV1.3.4) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise a random string is generated. * location_status → Array of potential location statuses (PV1.3.5) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise a random uppercase letter is generated to use. * person_location_type → Array of potential person location types (PV1.3.6) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise values from HL7 v2.5.1 Table 0305 will be used. * building → Array of potential building information (PV1.3.7) to randomly choose from. Specified as a comma separated String or Ruby array. Otherwise a random digit 1-9 is used. * floor → Array of potential floor information (PV1.3.8) to randomly choose from. Specified as a comma separated String or Ruby array. Otherwise a random 2 digit number is used. * location_description → Array of potential location descriptions (PV1.3.9) to randomly choose from. Specified as a comma separated String or Ruby array. Otherwise a random string is generated. * admit_source → Array of Admit Source codes (PV1.14) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise default HL7 v2.5.1 Table 0023 values are used. * admission_type → Array of Admission Type (PV1.4) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise default HL7 v2.5.1. Table 0007 values are used. * admit_reason → Array of values to use as Admit Reason (PV2.3) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise a string of data is generated with Faker::Lorem.sentence * event_type → The HL7 trigger event type that this visit is associated with. * discharge_disposition → Array of discharge disposition codes (PV1.36) to randomly choose from. Specified as comma separated String or Ruby array. Otherwise default HL7 v2.5.1 Table 0112 values are used. * discharge_location → Array of discharge locations to randomly choose from. Specified as comma separated String or Ruby array. Otherwise a string of data is generated with Faker::Lorem.sentence * admit_datetime → The admit date/time associated with this visit. If not specified the current date/time is used. ### Hl7 Message ```ruby hl7 = HealthcarePhony::Hl7Message.new ``` The above will give you a default Hl7Message object: ``` # ``` The creation of the Hl7Message object can be customized by sending the following parameters when initializing: * message_version - HL7v2 version (MSH.12) * message_processing_id - Typically P or T (MSH.11) * message_types - Array of Message Types (MSH.9.1) to randomly choose from. Specified as comma separated String or Ruby array. * message_type_file - Location of file containing Message Types (MSH.9.1). If not specified then included [hl7_message_types.yml](https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/hl7_message_types.yml) file will be used. * message_events - Generic array of Trigger Events (MSH.9.2) to randomly choose from. Specified as command separated String or Ruby array. * adt_events - Array of ADT Trigger Events (MSH.9.2) to randomly choose from. Used (if specified) if the Message type for the message is ADT. ADT events from [adt_event_types.yml](https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/adt_event_types.yml) will be used by default. * oru_events - Array of ORU Trigger Events (MSH.9.2) to randomly choose from. Used (if specified) if the Message type for the message is ORU. ORU events from [oru_event_types.yml](https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/adt_event_types.yml) will be used by default. * mdm_events - Array of MDM Trigger Events (MSH.9.2) to randomly choose from. Used (if specified) if the Message type for the message is MDM. MDM events from [mdm_event_types.yml](https://github.com/austinmoody/healthcare_phony/blob/main/lib/healthcare_phony/data_files/adt_event_types.yml) will be used by default. * message_control_id_pattern - Regex pattern used to randomly generate MSH.10 values. Default is PHONY\d{10} which will generate a value like: PHONY6850295805 * message_sending_facility - Array of Sending Facilities (MSH.4) to randomly choose from. Specified as comma separated String or Ruby Array. * message_sending_application - Array of Sending Applications (MSH.3) to randomly choose from. Specified as comma separated String or Ruby Array. * message_receiving_application - Array of Receiving Applications (MSH.5) to randomly choose from. Specified as comma separated String or Ruby Array. * message_receiving_facility - Array of Receiving Facilities (MSH.6) to randomly choose from. Specified as comma separated String or Ruby Array. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/austinmoody/healthcare_phony. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/healthcare_phony/blob/master/CODE_OF_CONDUCT.md). ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the HealthcarePhony project's codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/austinmoody/healthcare_phony/blob/master/CODE_OF_CONDUCT.md).