Sha256: cebda01087480ffa9722ba7b0f299a99b56d399152dfd255cc939f6d01ff7328

Contents?: true

Size: 912 Bytes

Versions: 17

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/pathology"

module Renalware
  module Pathology
    class ObservationDescription < ApplicationRecord
      belongs_to :measurement_unit
      has_many :observations,
               class_name: "Pathology::Observation",
               inverse_of: :description,
               dependent: :restrict_with_exception
      has_many :code_group_memberships,
               foreign_key: :observation_description_id,
               dependent: :destroy
      has_many :code_groups,
               through: :code_group_memberships

      scope :in_display_order, lambda {
        where("display_group is not null and display_order is not null")
        .order([:display_group, :display_order])
      }

      def self.for(codes)
        ObservationDescriptionsByCodeQuery.new(codes: codes).call
      end

      def to_s
        code
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
renalware-core-2.0.94 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.93 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.92 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.91 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.90 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.89 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.88 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.87 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.86 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.85 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.84 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.83 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.82 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.81 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.80 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.79 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.78 app/models/renalware/pathology/observation_description.rb