Sha256: 626e1e56ca5f675e0f7344ed60080c1b0a85219a05931e7b40605aa00bb84481

Contents?: true

Size: 671 Bytes

Versions: 6

Compression:

Stored size: 671 Bytes

Contents

require_dependency "renalware/pathology"

module Renalware
  module Pathology
    class Observation < ApplicationRecord
      belongs_to :request, class_name: "ObservationRequest", touch: true, inverse_of: :observations
      belongs_to :description, class_name: "ObservationDescription"

      validates :description, presence: true
      validates :result, presence: true
      validates :observed_at, presence: true

      scope :ordered, -> { order(observed_at: :desc) }
      scope :for_description, ->(description) { where(description: description) }

      def observed_on
        observed_at.to_date
      end

      delegate :to_s, to: :result
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc8 app/models/renalware/pathology/observation.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/pathology/observation.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/pathology/observation.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/pathology/observation.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/pathology/observation.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/pathology/observation.rb