Sha256: 2e5cd669477fa024714e47ed5a6d527a52a65c6db1ffb7edb52c2b71782d2cc8

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require_dependency "renalware/pathology"

module Renalware
  module Pathology
    class CreateObservationsGroupedByDateTable
      attr_reader :patient, :observation_descriptions, :options

      def initialize(patient:, observation_descriptions:, **options)
        @patient = patient
        @observation_descriptions = observation_descriptions
        @options = options
      end

      def call
        if observation_descriptions.blank?
          raise(ArgumentError, "No observation_descriptions supplied")
        end
        create_observations_table
      end

      private

      def fetch_grouped_observations
        ObservationsGroupedByDateQuery.new(
          patient: patient,
          observation_descriptions: observation_descriptions,
          **options
        )
      end

      def create_observations_table
        ObservationsGroupedByDateTable.new(
          relation: fetch_grouped_observations,
          observation_descriptions: observation_descriptions
        )
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc13 app/models/renalware/pathology/create_observations_grouped_by_date_table.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/pathology/create_observations_grouped_by_date_table.rb