Sha256: 29bc3149f2f3dd5d72af6469e5c90fccaf77f5a1d11abf192778c2825a1e9b8e
Contents?: true
Size: 1.32 KB
Versions: 75
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true require_dependency "renalware/ukrdc" module Renalware module UKRDC module TreatmentTimeline module Generic # Handles creating a treatment record for any modality that has not been handled in a more # specific way. Note that we only create a Treatment if we find a ukrdc_modality_code_id # in the modality's description row in the database. Some modalities will not have that # id so we just ignore them. class Generator pattr_initialize :modality def call create_treatment if ukrdc_modality_code.present? end private def ukrdc_modality_code @ukrdc_modality_code ||= begin UKRDC::ModalityCode.find_by( id: modality.description.ukrdc_modality_code_id ) end end def create_treatment Treatment.create!( patient: modality.patient, clinician: modality.created_by, started_on: modality.started_on, modality_id: modality.id, modality_description_id: modality.description_id, ended_on: modality.ended_on, modality_code: ukrdc_modality_code ) end end end end end end
Version data entries
75 entries across 75 versions & 1 rubygems