Class: Lab::Lims::OrderDTO

Inherits:
ActiveSupport::HashWithIndifferentAccess
  • Object
show all
Includes:
Utils
Defined in:
app/services/lab/lims/order_dto.rb

Overview

LIMS’ Data Transfer Object for orders

Constant Summary

Constants included from Utils

Utils::LIMS_LOG_PATH, Utils::TEST_NAME_MAPPINGS

Instance Method Summary collapse

Methods included from Utils

find_concept_by_name, lab_user, #logger, parse_date, structify, translate_test_name

Instance Method Details

#to_order_service_params(patient_id:) ⇒ Object

Unpacks a LIMS order into an object that OrdersService can handle



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/lab/lims/order_dto.rb', line 14

def to_order_service_params(patient_id:)
  ActiveSupport::HashWithIndifferentAccess.new(
    program_id: lab_program.program_id,
    accession_number: self['tracking_number'],
    patient_id: patient_id,
    specimen: { concept_id: specimen_type_id },
    tests: self['tests']&.map { |test| { concept_id: test_type_id(test) } },
    requesting_clinician: requesting_clinician,
    date: start_date,
    target_lab: facility_name(self['receiving_facility']),
    order_location: facility_name(self['sending_facility']),
    reason_for_test_id: reason_for_test
  )
end