Module: QDM::EntityGeneration
- Defined in:
- lib/generate_entities.rb
Overview
BaseTypeGeneration contains functions to randomly generate basetypes used by PatientGeneration
Class Method Summary collapse
- .generate_care_partner_entity ⇒ Object
- .generate_entities(data_element) ⇒ Object
- .generate_entity ⇒ Object
- .generate_location_entity ⇒ Object
- .generate_organization_entity ⇒ Object
- .generate_patient_entity ⇒ Object
- .generate_practitioner_entity ⇒ Object
Class Method Details
.generate_care_partner_entity ⇒ Object
34 35 36 37 38 39 |
# File 'lib/generate_entities.rb', line 34 def self.generate_care_partner_entity care_partner_entity = QDM::CarePartner.new care_partner_entity.identifier = QDM::BaseTypeGeneration.generate_qdm_id care_partner_entity.relationship = QDM::BaseTypeGeneration.generate_code_field care_partner_entity end |
.generate_entities(data_element) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generate_entities.rb', line 7 def self.generate_entities(data_element) data_element.performer = [generate_entity] if data_element.respond_to? 'performer' data_element.recorder = [generate_entity] if data_element.respond_to? 'recorder' data_element.requester = [generate_entity] if data_element.respond_to? 'requester' data_element.sender = [generate_entity] if data_element.respond_to? 'sender' data_element.recipient = [generate_entity] if data_element.respond_to? 'recipient' data_element.participant = [generate_entity] if data_element.respond_to? 'participant' data_element.prescriber = [generate_entity] if data_element.respond_to? 'prescriber' data_element.dispenser = [generate_entity] if data_element.respond_to? 'dispenser' end |
.generate_entity ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/generate_entities.rb', line 18 def self.generate_entity case Random.rand(5) when 0 then return generate_patient_entity when 1 then return generate_care_partner_entity when 2 then return generate_organization_entity when 3 then return generate_practitioner_entity when 4 then return generate_location_entity end end |
.generate_location_entity ⇒ Object
57 58 59 60 61 62 |
# File 'lib/generate_entities.rb', line 57 def self.generate_location_entity location_entity = QDM::Location.new location_entity.identifier = QDM::BaseTypeGeneration.generate_qdm_id location_entity.locationType = QDM::BaseTypeGeneration.generate_code_field location_entity end |
.generate_organization_entity ⇒ Object
41 42 43 44 45 46 |
# File 'lib/generate_entities.rb', line 41 def self.generate_organization_entity organization_entity = QDM::Organization.new organization_entity.identifier = QDM::BaseTypeGeneration.generate_qdm_id organization_entity.organizationType = QDM::BaseTypeGeneration.generate_code_field organization_entity end |
.generate_patient_entity ⇒ Object
28 29 30 31 32 |
# File 'lib/generate_entities.rb', line 28 def self.generate_patient_entity patient_entity = QDM::PatientEntity.new patient_entity.identifier = QDM::BaseTypeGeneration.generate_qdm_id patient_entity end |
.generate_practitioner_entity ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/generate_entities.rb', line 48 def self.generate_practitioner_entity practitioner_entity = QDM::Practitioner.new practitioner_entity.identifier = QDM::BaseTypeGeneration.generate_qdm_id practitioner_entity.role = QDM::BaseTypeGeneration.generate_code_field practitioner_entity.specialty = QDM::BaseTypeGeneration.generate_code_field practitioner_entity.qualification = QDM::BaseTypeGeneration.generate_code_field practitioner_entity end |