Sha256: 4f8c2a3ac559a14c97ef56194ab133adc22e119d4c4d4101cb549cea0a384fe7

Contents?: true

Size: 885 Bytes

Versions: 10

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/patients"
require "attr_extras"

module Renalware
  module Patients
    class ClearPatientUKRDCData
      pattr_initialize [:patient!, :by!]

      def self.call(**args)
        new(**args).call
      end

      # Note that we want to avoid any patient validation errors (email is invalid etc)
      # at this important stage, so we use validate: false. While we validate patient data
      # entered thorugh the UI, its possible that some migrated data might be invalid
      # and would cause an error to be raised during a callback in save!
      def call
        patient.send_to_rpv = false
        patient.rpv_decision_on = Time.zone.today
        patient.rpv_recorded_by = by.to_s
        patient.skip_death_validations = true
        patient.by = by
        patient.save!(validate: false)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
renalware-core-2.0.159 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.158 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.157 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.156 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.155 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.153 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.152 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.151 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.149 app/models/renalware/patients/clear_patient_ukrdc_data.rb
renalware-core-2.0.148 app/models/renalware/patients/clear_patient_ukrdc_data.rb