class ImmunisationImport
Schema Information
Table name: immunisation_imports
id :bigint not null, primary key
changed_record_count :integer
csv_data :text
csv_filename :text not null
csv_removed_at :datetime
exact_duplicate_record_count :integer
ignored_record_count :integer
new_record_count :integer
processed_at :datetime
rows_count :integer
serialized_errors :jsonb
status :integer default("pending_import"), not null
type :integer not null
created_at :datetime not null
updated_at :datetime not null
team_id :bigint not null
uploaded_by_user_id :bigint not null
Indexes
index_immunisation_imports_on_team_id (team_id) index_immunisation_imports_on_uploaded_by_user_id (uploaded_by_user_id)
Foreign Keys
fk_rails_... (team_id => teams.id) fk_rails_... (uploaded_by_user_id => users.id)
Public Instance Methods
Source
# File app/models/immunisation_import.rb, line 67 def process! raise "'rows' are empty. Call parse_rows! before processing." if rows.nil? counts = count_columns.index_with(0) @vaccination_records_batch = Set.new @patients_batch = Set.new @patient_locations_batch = Set.new @archive_reasons_batch = Set.new ActiveRecord::Base.transaction do rows.each do |row| count_column_to_increment = process_row(row) counts[count_column_to_increment] += 1 bulk_import(rows: 100) end bulk_import(rows: :all) postprocess_rows! end post_commit! update_columns(processed_at: Time.zone.now, status: :processed, **counts) end
Source
# File app/models/immunisation_import.rb, line 59 def records_count if national_reporting? vaccination_records.count + (ignored_record_count || 0) else vaccination_records.count end end
Source
# File app/models/immunisation_import.rb, line 51 def show_approved_reviewers? false end
Source
# File app/models/immunisation_import.rb, line 55 def show_cancelled_reviewer? false end
Source
# File app/models/immunisation_import.rb, line 47 def type_label "Vaccination records" end