Sha256: a6c8973bebe0306380646a47e7d09ff93cc85ecaa9be46631a82a7605ab673be

Contents?: true

Size: 1.75 KB

Versions: 11

Compression:

Stored size: 1.75 KB

Contents

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"
      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"

      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

11 entries across 11 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc11 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.rc1 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.0.pre.beta12 app/models/renalware/clinical/body_composition.rb