Class: QME::Randomizer::RandomPatientCreator
- Inherits:
-
Object
- Object
- QME::Randomizer::RandomPatientCreator
- Defined in:
- lib/qme/randomizer/random_patient_creator.rb
Class Method Summary collapse
-
.parse_events(event_list) ⇒ Array
Parses a list of event hashes into an array of Entry objects.
-
.parse_hash(patient_hash) ⇒ Record
Parses a patient hash containing demographic and event information.
Class Method Details
.parse_events(event_list) ⇒ Array
Parses a list of event hashes into an array of Entry objects
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/qme/randomizer/random_patient_creator.rb', line 33 def self.parse_events(event_list) event_list.collect do |event| if event.class==String.class # skip String elements in the event list, patient randomization templates # introduce String elements to simplify tailing-comma handling when generating # JSON using ERb nil else Entry.from_event_hash(event) end end.compact end |
.parse_hash(patient_hash) ⇒ Record
Parses a patient hash containing demographic and event information
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/qme/randomizer/random_patient_creator.rb', line 9 def self.parse_hash(patient_hash) patient_record = Record.new patient_record.first = patient_hash['first'] patient_record.last = patient_hash['last'] patient_record.gender = patient_hash['gender'] patient_record.medical_record_number = patient_hash['medical_record_number'] patient_record.birthdate = patient_hash['birthdate'] patient_record.race = patient_hash['race'] patient_record.ethnicity = patient_hash['ethnicity'] # pophealth needs languages... please do not remove patient_record.languages = patient_hash['languages'] #patient_record['addresses'] = patient_hash['addresses'] patient_hash['events'].each do |key, value| patient_record.send("#{key}=".to_sym, parse_events(value)) end patient_record['measures'] = QME::Importer::MeasurePropertiesGenerator.instance.generate_properties(patient_record) patient_record end |