Sha256: 192e0ce163411e3ce741c4043e7068b5c9bbb36942ae60f265c0d42213f9840f
Contents?: true
Size: 943 Bytes
Versions: 139
Compression:
Stored size: 943 Bytes
Contents
# frozen_string_literal: true 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", inverse_of: :observations validates :description, presence: true validates :result, presence: true, unless: ->(obs) { obs.cancelled? } validates :observed_at, presence: true scope :ordered, -> { order(observed_at: :desc) } scope :for_description, ->(description) { where(description: description) } scope :having_a_loinc_code, -> { joins(:description).where("loinc_code is not null") } def observed_on observed_at.to_date end delegate :to_s, to: :result end end end
Version data entries
139 entries across 139 versions & 1 rubygems