add active_record to the script, promote the data preprocessing