DARIAEngineering/dcaf_case_management

ActiveRecord::RecordInvalid: Validation failed: Procedure cost must be greater than or equal to 0

sentry-io opened this issue · 3 comments

Sentry Issue: DARIA-SERVICES-PRODUCTION-W

ActiveRecord::RecordInvalid: Validation failed: Procedure cost must be greater than or equal to 0
  [FILTERED]:111:in `block in convert_patient'
    archived_patient.save!
  [FILTERED]:110:in `convert_patient'
    PaperTrail.request(whodunnit: patient.created_by_id) do
  [FILTERED]:53:in `block (2 levels) in archive_eligible_patients!'
    ArchivedPatient.convert_patient(patient)
  [FILTERED]:52:in `block in archive_eligible_patients!'
    ActiveRecord::Base.transaction do
  [FILTERED]:50:in `archive_eligible_patients!'
    Patient.all.each do |patient|
...
(50 additional frame(s) were not displayed)

[FILTERED]

@elimbaum can you take a gander at this? I think the thrust of it is that we've got a patient eligible for archiving who has a negative patient.procedure_cost. For weird cases like this, let's please set to nil.

This shouldn't happen anymore because of some data integrity improvements we've made, so not super worried about it being a common case.

How specific do you want this to be?

  • if procedure_cost is negative set it to nil
  • if any numeric value is negative set it to nil
  • if any field fails validation on archiving set it to nil
  • something else?