Sha256: 7e0a666ce314da568d7221e2f9ff4117e5ca8d0b76d5d7b19138a685063199e7

Contents?: true

Size: 1.83 KB

Versions: 79

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

require_dependency "renalware/clinical"
require "document/base"

module Renalware
  module Clinical
    class BodyComposition < ApplicationRecord
      include PatientScope
      include Accountable

      belongs_to :patient, class_name: "Renalware::Clinical::Patient", touch: true
      belongs_to :assessor, class_name: "User", foreign_key: "assessor_id"
      belongs_to :modality_description, class_name: "Modalities::Description"

      has_paper_trail class_name: "Renalware::Clinical::Version", on: [:create, :update, :destroy]

      scope :ordered, -> { order(assessed_on: :desc, created_at: :desc) }

      validates :patient, presence: true
      validates :assessor, presence: true
      validates :overhydration, presence: true, numeric_inclusion: { in: -20..20 }
      validates :volume_of_distribution, presence: true, numeric_inclusion: { in: 5..150 }
      validates :total_body_water, presence: true, numeric_inclusion: { in: 0..150 }
      validates :extracellular_water, presence: true, numeric_inclusion: { in: 0..150 }
      validates :intracellular_water, presence: true, numeric_inclusion: { in: 0..150 }
      validates :lean_tissue_index, presence: true, numeric_inclusion: { in: 0..150 }
      validates :fat_tissue_index, presence: true, numeric_inclusion: { in: 0..150 }
      validates :lean_tissue_mass, presence: true, numeric_inclusion: { in: 0..150 }
      validates :fat_tissue_mass, presence: true, numeric_inclusion: { in: 0..150 }
      validates :adipose_tissue_mass, presence: true, numeric_inclusion: { in: 0..100 }
      validates :body_cell_mass, presence: true, numeric_inclusion: { in: 0..150 }
      validates :quality_of_reading, presence: true, numeric_inclusion: { in: 50..100 }
      validates :assessed_on, presence: true, timeliness: { type: :date, allow_blank: false }
    end
  end
end

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
renalware-core-2.0.89 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.88 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.87 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.86 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.85 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.84 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.83 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.82 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.81 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.80 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.79 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.78 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.77 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.76 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.75 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.74 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.73 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.72 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.71 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.70 app/models/renalware/clinical/body_composition.rb