Sha256: 06b55ca121c08d3f3baf2a0971c37c801b0a74ae33f3c9e38b8a5483be94ed1c

Contents?: true

Size: 696 Bytes

Versions: 20

Compression:

Stored size: 696 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/ukrdc"
require "attr_extras"

module Renalware
  module UKRDC
    class PathologyObservationRequestsQuery
      pattr_initialize [:patient_id!, :changes_since!]

      def call
        observation_requests
      end

      private

      def observation_requests
        Pathology::ObservationRequest
          .where(id: Pathology::ObservationRequest.distinct_for_patient_id(patient_id))
          .where("requested_at >= ?", changes_since)
          .where("loinc_code is not null")
          .eager_load(
            :description,
            observations: { description: :measurement_unit }
          )
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
renalware-core-2.0.96 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.94 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.93 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.92 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.91 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.90 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.89 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.88 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.87 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.86 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.85 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.84 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.83 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.82 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.81 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.80 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.79 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.78 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.77 app/models/renalware/ukrdc/pathology_observation_requests_query.rb
renalware-core-2.0.76 app/models/renalware/ukrdc/pathology_observation_requests_query.rb