Tripal
|
Functions | |
tripal_bulk_loader_add_loader_job_form ($form, &$form_state, $node) | |
tripal_bulk_loader_add_loader_job_form_submit ($form, $form_state) | |
tripal_bulk_loader_load_data ($nid, $job_id) | |
process_data_array_for_line ($priority, &$data, &$default_data, $addt) | |
tripal_bulk_loader_add_spreadsheetdata_to_values ($values, $line, $field2column) | |
tripal_bulk_loader_add_foreignkey_to_values ($table_array, $values, $data, $record2priority, $nid, $priority, $default_data) | |
tripal_bulk_loader_regex_tranform_values ($values, $table_data, $line) | |
tripal_bulk_loader_flatten_array ($values) | |
tripal_bulk_loader_progress_bar ($current=0, $total=100, $size=50) | |
tripal_bulk_loader_progress_file_track_job ($job_id, $record_added, $line_complete=FALSE, $close=FALSE) | |
tripal_bulk_loader_throw_error ($msg, $args, $severity) | |
tripal_bulk_loader_finish_loading ($nid, $loaded_without_errors) | |
Handles the actual loading of data.
process_data_array_for_line | ( | $priority, | |
& | $data, | ||
& | $default_data, | ||
$addt | |||
) |
Process the data array for a given line
$addt | Requires: field2column', 'record2priority', 'line', 'line_num', 'group_index', 'node', 'nid' |
tripal_bulk_loader_add_foreignkey_to_values | ( | $table_array, | |
$values, | |||
$data, | |||
$record2priority, | |||
$nid, | |||
$priority, | |||
$default_data | |||
) |
Handles foreign keys in the values array.
Specifically, if the value for a field is an array then it is assumed that the array contains the name of the record whose values array should be substituted here. Thus the foreign record is looked up and the values array is substituted in.
tripal_bulk_loader_add_loader_job_form | ( | $form, | |
& | $form_state, | ||
$node | |||
) |
Add Loader Job Form
This form is meant to be included on the node page to allow users to submit/re-submit loading jobs
tripal_bulk_loader_add_loader_job_form_submit | ( | $form, | |
$form_state | |||
) |
Add Loader Job Form (Submit)
tripal_bulk_loader_add_spreadsheetdata_to_values | ( | $values, | |
$line, | |||
$field2column | |||
) |
This function adds the file data to the values array
$values | The default values array -contains all constants |
$line | An array of values for the current line |
$field2column | An array mapping values fields to line columns |
tripal_bulk_loader_finish_loading | ( | $nid, | |
$loaded_without_errors | |||
) |
Finishes the loading job by setting variables and exiting.
tripal_bulk_loader_flatten_array | ( | $values | ) |
Flattens an array up to two levels Used for printing of arrays without taking up much space
tripal_bulk_loader_load_data | ( | $nid, | |
$job_id | |||
) |
Tripal Bulk Loader
This is the function that's run by tripal_launch_jobs to bulk load chado data.
$nid | The Node ID of the bulk loading job node to be loaded. All other needed data is expected to be in the node (ie: template ID and file) |
Note: Instead of returning a value this function updates the tripal_bulk_loader.status. Errors are thrown through watchdog and can be viewed at admin/reports/dblog.
tripal_bulk_loader_progress_bar | ( | $current = 0 , |
|
$total = 100 , |
|||
$size = 50 |
|||
) |
Used to display loader progress to the user
tripal_bulk_loader_progress_file_track_job | ( | $job_id, | |
$record_added, | |||
$line_complete = FALSE , |
|||
$close = FALSE |
|||
) |
Keep track of progress in file rather then database
This provides an alternative method to keep track of progress that doesn't require the database. It was needed because you can't switch databases within a transaction... Waiting until the end of a constant set is much too long to wait for any indication that things are working.
Each line represents a line processed in the loading file. Each period (.) represents a successfully inserted record.
$job_id | The ID of the current tripal job |
$record_added | A boolean indicated whether a record was added successfully |
$line_complete | A boolean indicating whether the current line is finished |
$close | A boolean indicating that the file should be closed |
tripal_bulk_loader_regex_tranform_values | ( | $values, | |
$table_data, | |||
$line | |||
) |
Uses a supplied regex to transform spreadsheet values
$values | The select/insert values array for the given table |
$table_data | The data array for the given table |
tripal_bulk_loader_throw_error | ( | $msg, | |
$args, | |||
$severity | |||
) |
Used to throw a hopefully human-readable error.