Sha256: 87948ecf6dcdf49a3d81d15c8420932b7d9f81a68a227e4a602752ba5dc4fb02

Contents?: true

Size: 735 Bytes

Versions: 112

Compression:

Stored size: 735 Bytes

Contents

# frozen_string_literal: true

module Renalware

  log "Adding Primary Care Physicians\n" do
    sample_status = "SAMPLE ONLY"
    file_path = File.join(File.dirname(__FILE__), "primary_care_physicians_sample.csv")
    #"id","practice_code","gp_code","name","practice_id"

    CSV.foreach(file_path, headers: true) do |row|
      practice_id = row["practice_id"].to_i

      Patients::PrimaryCarePhysician.find_or_create_by!(code: row["gp_code"]) do |doc|
        doc.name = row["name"]
        doc.practitioner_type = "GP"
        doc.practice_ids = [practice_id]
      end
    end
    log_count = Patients::PrimaryCarePhysician.count
    log "#{log_count} NHS primary care physicians imported #{sample_status}", type: :sub
  end
end

Version data entries

112 entries across 112 versions & 1 rubygems

Version Path
renalware-core-2.0.137 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.136 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.135 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.134 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.133 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.132 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.131 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.130 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.129 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.128 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.127 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.126 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.125 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.124 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.123 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.121 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.120 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.119 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.118 db/seeds/default/practices/primary_care_physicians.rb
renalware-core-2.0.117 db/seeds/default/practices/primary_care_physicians.rb