geodatafarm.import_data package¶
Module contents¶
Submodules¶
geodatafarm.import_data.handle_irrigation module¶
-
class
geodatafarm.import_data.handle_irrigation.IrrigationHandler(parent_widget)¶ Bases:
object-
create_grid_year()¶ Creates a 2x2 grid over all fields
-
get_grid_data()¶ Function that loops though all irrigation operations during the selected year. It adds the precipitation amount to each 2x2 cell that the operation “covers”.
-
run()¶
-
geodatafarm.import_data.handle_text_data module¶
-
class
geodatafarm.import_data.handle_text_data.InputTextHandler(parent_widget, data_type, columns=None)¶ Bases:
object-
add_specific_columns()¶ Adds rows for the user to manual define which columns contains schema specific columns (or one single value / Not applicable)
-
add_to_param_list()¶ Adds the selected columns to the list of fields that should be treated as “special” in the database both to work as a parameter that could be evaluated and as a layer that is added to the canvas
-
change_col_type()¶ Updates the values (in self.col_types) of the data types for each column in the data set
-
change_sep()¶ Change the separator and reload the column list
-
close()¶ Disconnects buttons and closes the widget
-
define_separator()¶ Define the file encoding and the separator of the file
-
determine_column_type()¶ A function that retrieves the types of the columns from the .csv file and sets col_types as a list where with 0=int, 1=float, 2=char
-
finish(result, values)¶ Checks that all data is uploaded to the postgres database and adds the data to the canvas and closes the widget
Parameters: - result (object) – The result object
- values (list) – list with [bool, bool, int]
-
insert_manual_data(date_)¶ Inserts the manual data that is used to generate reports, rather long function since all schemas have separate attributes.
Parameters: date (str) – The column where the dates is listed or one date that is the same for all rows (than it starts with c_) Returns: If success or not Return type: bool
-
open_input_file()¶ Open the file dialog and let the user choose which file that should be inserted. In the end of this function the function define_separator, set_sep_radio_but and set_column_list are being called.
-
prepare_last_choices()¶ A function that prepares the last parts of the widget with the data to be inserted into the database
-
remove_from_param_list()¶ Removes the selected columns from the list of fields that should be treated as “special” in the database
-
run()¶ Presents the sub widget ImportTextDialog and connects the different buttons to their function
-
set_column_list()¶ A function that retrieves the name of the columns from the text file and fills the TWColumnName list with the name, first value and data type
-
set_sep_radio_but()¶ Sets the radioButton indicating the separator of the file
-
show_abbreviations()¶ Shows a messageBox with the time abbreviations
-
trigger_insection()¶ Preparing the data, by setting the correct type (including the date and time format), creating a shp file and finally ensure that the coordinates is in EPSG:4326
-
-
geodatafarm.import_data.handle_text_data.insert_data_to_database(task, db, params)¶ Walks though the text files and adds data to the database :param task: :type task: QgsTask :param db: :type db: object :param params: :type params: dict
Returns: if no error: [bool, bool, int, str] else: [False, e, traceback.format_exc()] Return type: list
geodatafarm.import_data.save_fertilizing_data module¶
-
class
geodatafarm.import_data.save_fertilizing_data.SaveFertilizing(parent)¶ Bases:
object-
check_input()¶ Some simple checks that ensure that the basic data is filled in.
Returns: Return type: bool
-
reset_widget()¶ Resets the widget to the default values
-
run_file_import()¶ The function loads the correct import dialog for files
-
save_manual_data()¶ Saves the manual data.
-
set_widget_connections()¶ A simple function that sets the buttons on the planting tab
-
geodatafarm.import_data.save_harrowing_data module¶
-
class
geodatafarm.import_data.save_harrowing_data.SaveHarrowing(parent)¶ Bases:
object-
check_input()¶ Some simple checks that ensure that the basic data is filled in.
Returns: Return type: bool
-
reset_widget()¶ Resets the widget to the default values
-
save_manual_data()¶ Saves the manual data.
-
set_widget_connections()¶ A simple function that sets the buttons on the harrowing tab
-
geodatafarm.import_data.save_harvest_data module¶
-
class
geodatafarm.import_data.save_harvest_data.SaveHarvesting(parent)¶ Bases:
object-
check_input()¶ Some simple checks that ensure that the basic data is filled in.
Returns: Return type: bool
-
reset_widget()¶ Resets the widget to the default values
-
run_file_import()¶ The function loads the correct import dialog for files
-
save_manual_data()¶ Saves the manual data.
-
set_widget_connections()¶ A simple function that sets the buttons on the planting tab
-
geodatafarm.import_data.save_other_data module¶
-
class
geodatafarm.import_data.save_other_data.SaveOther(parent)¶ Bases:
object-
check_input()¶ Some simple checks that ensure that the basic data is filled in.
Returns: Return type: bool
-
reset_widget()¶ Resets the widget to the default values
-
save_manual_data()¶ Saves manual data.
-
set_widget_connections()¶ A simple function that sets the buttons on the planting tab
-
geodatafarm.import_data.save_planting_data module¶
-
class
geodatafarm.import_data.save_planting_data.SavePlanting(parent)¶ Bases:
object-
check_input()¶ Some simple checks that ensure that the basic data is filled in.
Returns: Return type: bool
-
run_file_import()¶ The function loads the correct import dialog for files
-
save_manual_data()¶ Saves the manual data
-
set_widget_connections()¶ A simple function that sets the buttons on the planting tab
-
geodatafarm.import_data.save_plowing_data module¶
-
class
geodatafarm.import_data.save_plowing_data.SavePlowing(parent)¶ Bases:
object-
check_input()¶ Some simple checks that ensure that the basic data is filled in.
Returns: Return type: bool
-
reset_widget()¶ Resets the widget to the default values
-
save_manual_data()¶ Saves manual data.
-
set_widget_connections()¶ A simple function that sets the buttons on the plowing tab
-
geodatafarm.import_data.save_soil_data module¶
-
class
geodatafarm.import_data.save_soil_data.SaveSoil(parent)¶ Bases:
object-
check_input()¶ Some simple checks that ensure that the basic data is filled in.
Returns: Return type: bool
-
reset_widget()¶ Resets the widget to the default values
-
run_file_import()¶ The function loads the correct import dialog for files
-
save_manual_data()¶ Saves the manual data.
-
set_widget_connections()¶ A simple function that sets the buttons on the planting tab
-
geodatafarm.import_data.save_spraying_data module¶
-
class
geodatafarm.import_data.save_spraying_data.SaveSpraying(parent)¶ Bases:
object-
check_input()¶ Some simple checks that ensure that the basic data is filled in.
Returns: Return type: bool
-
reset_widget()¶ Resets the widget to the default values
-
run_file_import()¶ The function loads the correct import dialog for files
-
save_manual_data()¶ Saves the manual data.
-
set_widget_connections()¶ A simple function that sets the buttons on the planting tab
-