Sha256: 6fcb6476cd5c9ec0910baaa37e7ca8802eff49689f94e47fece7c55bcb406e28

Contents?: true

Size: 948 Bytes

Versions: 57

Compression:

Stored size: 948 Bytes

Contents

module HealthDataStandards
  module Export
    module CommaSV
      # Builds a CSV row representing the patient.
      #
      # @return csv representation of patient data
      def export(patient,header)
      
       
        csv = header ? [generate_header,extract_patient_data(patient)] : extract_patient_data(patient)           
      
       
      end
      
      def generate_header
        ["patient_id", "first name", "last name", "gender","race","ethnicity","birthdate"]
      end
      
      def extract_patient_data(patient)
        race = ''
        ethnicity = ''
        race = patient.race['name'] || patient.race if !patient.race.nil?
        ethnicity = patient.ethnicity['name'] || patient.ethnicity if !patient.ethnicity.nil?
        
       [patient.patient_id, patient.first, patient.last, patient.gender, race, ethnicity, Time.at(patient.birthdate).strftime('%m/%d/%Y')]
      end

      extend self
    
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
health-data-standards-3.5.0 lib/health-data-standards/export/csv.rb
health-data-standards-3.4.6 lib/health-data-standards/export/csv.rb
health-data-standards-3.4.5 lib/health-data-standards/export/csv.rb
health-data-standards-3.4.4 lib/health-data-standards/export/csv.rb
health-data-standards-3.4.3 lib/health-data-standards/export/csv.rb
health-data-standards-3.4.2 lib/health-data-standards/export/csv.rb
health-data-standards-3.4.1 lib/health-data-standards/export/csv.rb
health-data-standards-3.4.0 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.12 lib/health-data-standards/export/csv.rb
health-data-standards-3.3.0 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.11 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.10 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.8 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.7 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.6 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.5 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.4 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.3 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.2 lib/health-data-standards/export/csv.rb
health-data-standards-3.2.1 lib/health-data-standards/export/csv.rb