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.132 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.131 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.130 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.129 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.128 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.127 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.126 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.125 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.124 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.123 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.121 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.120 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.119 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.118 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.117 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.116 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.115 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.113 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.112 app/models/renalware/clinical/body_composition.rb
renalware-core-2.0.111 app/models/renalware/clinical/body_composition.rb