Sha256: ffa950879a48305d3a3216dbbc8d4681775a5d4b1532be5f1af20c8aac98b1f9

Contents?: true

Size: 905 Bytes

Versions: 6

Compression:

Stored size: 905 Bytes

Contents

module Renalware
  log "Adding Pathology Request Descriptions" do

    file_path = File.join(File.dirname(__FILE__), "pathology_request_descriptions.csv")
    labs = Pathology::Lab.all.index_by(&:name)

    Pathology::RequestDescription.transaction do
      CSV.foreach(file_path, headers: true) do |row|
        observation_description =
          if row["required_observation_description_code"].present?
            Pathology::ObservationDescription.find_by!(
              code: row["required_observation_description_code"]
            )
          end

        Pathology::RequestDescription.find_or_create_by!(
          code: row["code"],
          name: row["name"],
          lab: labs[row["lab"]],
          required_observation_description: observation_description,
          expiration_days: row["expiration_days"],
          bottle_type: row["bottle_type"]
        )
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta9 db/seeds/default/pathology/pathology_request_descriptions.rb
renalware-core-2.0.0.pre.beta8 db/seeds/default/pathology/pathology_request_descriptions.rb
renalware-core-2.0.0.pre.beta7 db/seeds/default/pathology/pathology_request_descriptions.rb
renalware-core-2.0.0.pre.beta6 db/seeds/default/pathology/pathology_request_descriptions.rb
renalware-core-2.0.0.pre.beta5 db/seeds/default/pathology/pathology_request_descriptions.rb
renalware-core-2.0.0.pre.beta4 db/seeds/default/pathology/pathology_request_descriptions.rb