description
General goal: Allow the user to import data from a text file or Excel file.
The import function should be accessible from : File -- Import and from the "Import" ribbon button on the table tab.
Supported file formats for import: text file (tab separated), csv (comma-separated values) Excel (XLS / XLSX), WaterML (only WaterML is currently supported)
In the case of text file, CSV or Excel, the following file structure should be supported:
There must be at least two columns (fields)
One of the fields is the Date / Time
The other fields are the data values
The import should be designed in the form of an "import wizard" with four steps:
Step 1 - Show a file open dialog with the supported formats: .csv, .txt, .xml, .xls, .xlsx, or "all files"
Step 2 - Specify file format options. In case of .txt, choose the file type "delimited" or "fixed width". If "delimited" is chosen, allow user to select the type of delimiter (comma, tab, semicolon, whitespace, other) In case of .xls or .xlsx, allow user to choose the name of the Excel sheet. In this screen a "Data preview" should be shown with the columns and the first few rows. When the user changes the format option the "Data Preview" should be refreshed accordingly.
Step 3 - Specify properties of imported fields.
The dialog has a "Specify Date/Time column" drop-down to allow the user to specify which column is the Date/Time column. note: the default date time column should be selected automatically by checking the first few entries in the file and finding which can be converted to date time
The dialog also has a data preview showing the name of fields and the first few rows. When the user clicks on a field, the input boxes for properties are shown:
* Import this column check-box
* Site - Select an existing site or specify a new site by entering the site name (required), site code (pre-populated as "Site1"), latitude (required), longitude (required), elevation (optional). Under the site selection there is a checkbox "Apply to all columns"
* Variable - Select an existing variable or specify a new variable by setting the variable name (required), variable code (pre-populated as "Variable1"), variable units, data type, value type, time support, time units and no data value. The variable name selection should be in form of a combo box. If there are existing variables in the current project, then the combo box should be populated with them. When the user selects an existing variable, the other properties of the variable are assigned.
* Details - when details is clicked, allow the user to specify the Source, Method and Quality Control Level attributes.
After all properties are specified, proceed with the data import by saving the series and data values to the current project database. During the import the following case can be encountered: There already exists a series with the identical site and variable in the database. In this case, show a dialog: "There is already a time series with site: [Site Name] and variable: [Variable Name]. How do you want to proceed? with options: "Merge with existing time series", "Overwrite existing time series", "Create a new time series".