libraries/PlateReaderHelper.rb
# TODO: Error handling when processing and associating upload data
# Associate to the valid container and correct the data. 
Error handling when processing and associating upload data
Associate to the valid container and correct the data.
Error handling when processing and associating upload data Associate to the valid container and correct the data .
def process_and_associate_data(pr:, ops:, dilution_factor: 'None', blanking_sample: nil)
    pr.measurement_data.each do |data|
      mt, day, hour, mitem = data_attributes(data: data)
      key = "#{mt}_#{day}_#{hour}"
      upload = (debug) ? Upload.find(11379) : data[:upload]
      associate_data(object=mitem, key=key, data=upload, opts = {}) 
      ops.each {|op| associate_data(object=op.plan, key=key, data=upload, opts = {})} 
      if pr.measurement_type == 'Calibration'
        create_prm_calibration_associations(ops: ops, upload: upload, mitem: mitem, mt: mt)
      else
        raw_data_matrix = extract_measurement_matrix_from_csv(upload: upload) 
        blanked_data_matrix, corrected_data_matrix = correct_plate_reader_data(
                                                      pr: pr,
                                                      blanking_sample: blanking_sample,
                                                      data_matrix: raw_data_matrix,
                                                      dilution_factor: dilution_factor
                                                    )
        create_prm_part_associations_for_collection(
          collection: pr.measurement_item,
          data_matrix: corrected_data_matrix,
          measurement_type: mt,
          day: day,
          hour: hour
        ) 
        create_prm_part_associations_for_collection(
          collection: pr.experimental_item,
          data_matrix: corrected_data_matrix,
          measurement_type: mt,
          day: day,
          hour: hour
        ) unless !pr.transfer_required
      end
      create_prm_item_association_for_cultures(ops: ops, mt: mt, day: day, hour: hour, corrected_data_matrix: corrected_data_matrix)
      ops.each {|op| associate_data(object=op, key=key, data={upload_id: upload.id}, opts = {})} 
    end
  end
def process_and_associate_data ( pr : , ops : , dilution_factor : 'None' , blanking_sample : nil ) pr . measurement_data . each do | data | mt , day , hour , mitem = data_attributes ( data : data ) key = "#{mt}_#{day}_#{hour}" upload = ( debug ) ? Upload . find ( 11379 ) : data [ :upload ] associate_data ( object = mitem , key = key , data = upload , opts = { } ) ops . each { | op | associate_data ( object = op . plan , key = key , data = upload , opts = { } ) } if pr . measurement_type == 'Calibration' create_prm_calibration_associations ( ops : ops , upload : upload , mitem : mitem , mt : mt ) else raw_data_matrix = extract_measurement_matrix_from_csv ( upload : upload ) blanked_data_matrix , corrected_data_matrix = correct_plate_reader_data ( pr : pr , blanking_sample : blanking_sample , data_matrix : raw_data_matrix , dilution_factor : dilution_factor ) create_prm_part_associations_for_collection ( collection : pr . measurement_item , data_matrix : corrected_data_matrix , measurement_type : mt , day : day , hour : hour ) create_prm_part_associations_for_collection ( collection : pr . experimental_item , data_matrix : corrected_data_matrix , measurement_type : mt , day : day , hour : hour ) unless ! pr . transfer_required end create_prm_item_association_for_cultures ( ops : ops , mt : mt , day : day , hour : hour , corrected_data_matrix : corrected_data_matrix ) ops . each { | op | associate_data ( object = op , key = key , data = { upload_id : upload . id } , opts = { } ) } end end
TODO: Error handling when processing and associating upload data
Associate to the valid container and correct the data.
TODO : Error handling when processing and associating upload data Associate to the valid container and correct the data .
# Associate upload to object #=> Standard Libs/AssociationManagement # Associates upload to plans # Process data and create standard curve and optical item volume correction factor # Process upload into corrected_data_matrix # Associate to collection # Filters operations that have a culture as input # Associates upload_id to operation
pr
ops
dilution_factor
blanking_sample