Sha256: c2bdc5d38fc281b80c7e35024cbce174122e7fcba647ec922d6f03543de0e99f

Contents?: true

Size: 1.01 KB

Versions: 55

Compression:

Stored size: 1.01 KB

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])
      }

      enum rr_type: { rr_type_simple: 0, rr_type_interpretation: 1 }
      enum rr_coding_standard: { ukrr: 0, pv: 1 }

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

      def to_s
        code
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
renalware-core-2.0.153 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.152 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.151 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.149 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.148 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.147 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.146 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.145 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.144 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.143 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.142 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.141 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.140 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.139 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.138 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.137 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.136 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.135 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.134 app/models/renalware/pathology/observation_description.rb
renalware-core-2.0.133 app/models/renalware/pathology/observation_description.rb