Data sources management
A data source allows a simulator to query the simulation field reference values to perform the simulation.
The data source can be internal, i.e. the values are stored in a database managed by G6K,
or external, i.e. the values are supplied either via queries on a remote database or via a web service (API).
In all cases, you must declare the source so that it can be used by the simulation engine.
If it is a database (internal or remote), you must also describe the tables and their columns so that the simulation engine can build the queries to find the desired values.
If it is a web service, you must specify the API url and the HTTP method to be implemented (GET or POST).
The parameters of the API will be defined by the simulator which uses it at the time of creation of the latter.
Click on « Data sources » of the menu bar
then on of the left side menu.
Attributes:
For databases such as MySQL or PostgreSQL, you must also provide:
The login and password must be provided to you by your database administrator.
The identifier must have the privilege of creating databases.
You can describe the data source in the « Description » space provided for this purpose.
Click « Save » to save the source.
After the data source is saved, the database is present but does not contain any table. To create one, click the button in the left side menu.
Attributes:
You can describe the table in the « Description » space provided for this purpose.
The « Add Field » button allows you to add fields (columns) to the database:
Attributes:
Be sure to add all the required fields before saving.
If you add a field after saving, you will no longer be able to select « Yes » for the « Not Null » attribute. It is a constraint linked to the RDBMS.
The procedure is the same to create another table.
To save data to the table, click the « Add Record » button.
A blank line is displayed at the beginning of the table to allow you to enter the values of the record.
Once you have entered the values, click on the « Save » button to save them.
If you want to change the values, click on the icon: , make the changes and click the « Save » button to save them.
Finally, if you want to delete a record click on the icon: ,
a « Confirm » button will appear, click to delete the record permanently.
Once confirmed, the record will be deleted from the database, but the line will remain displayed with a « Restore » button if you have made a mistake or changed your mind.
If you click « Restore », the line will be re-registered in the database.
If you do not click « Restore », the next time the page is redisplayed, the record will no longer appear in the list.
Another way to fill your table is to import data in .csv or .txt format from an Excel file.
If you choose to import data, click the « Import Data » button in the title bar.
The message « Are you sure you want to import data into the table 'Label of the selected table'? appears, press « OK » to confirm.
The following screen appears:
In this form, once you have selected the « Text file » from the hard drive of your computer, the « Separator » and the « Delimiter » most appropriate to the format of the file (according to its extension: .csv or .txt) will be proposed to you.
If in your file you have a title line with the column names, make sure that you have named each column with the name of the corresponding field, not the label. You should also verify that the values assigned to the fields match their types (for example, the field « data_1 » contains a date value).
If you chose not to put a title line in your file, uncheck the box next to « Column names in first line? ». In this case, the columns must be presented in the order in which the fields in the table are declared.
Example .csv (DOS or semicolon when recording):
Example .txt (Text Tab separator when recording):
The structure of the table (its name, its label, the characteristics of its fields) can be modified within the constraints imposed by the underlying RDBMS. Fields can be added or deleted.
In the left sidebar, select the source to which the table belongs and click the table label in the top block.
The table information appears, click « Edit table structure » in the title bar:
Confirm the action to display the change form.
The pre-filled change form is the same as the one presented in the « Creating Tables » section at the beginning of this document.
Refer to this section to follow the procedure.
In the left sidebar, select the source to which the table belongs and click the table label in the top block.
The information in the table appears, click « Delete » in the title bar:
Confirm the action to permanently delete the table. This operation is irreversible.
You can export a data source for archiving, broadcasting, or simply importing it into another instance of G6K (see above).
Click « Data sources » from the menu bar.
Then click the data source you want to export in the left sidebar.
Then click the « Export datasource » button in the title bar.
G6K generates two JSON files with the following characteristics:
The first file, whose name is formed with the name of the source followed by the .schema.json extension, describes data contained in the source.
The description of the data is consistent with the JSON schema specification which is both a description standard and a JSON data validation standard.
The second file, whose name is formed with the name of the source followed by the .json extension, contains the data of the source.
These two files are compressed into a file that also has the name of the source with the .zip extension.
It is available for download and archiving.
Click « Data sources » from the menu bar.
Then click the data source you want to edit in the left sidebar.
Then click the « Edit datasource » button in the title bar.
Confirm the action to display the change form.
The pre-filled form is the same as the one presented in the « Creating the data Source » section at the beginning of this document.
Refer to this section to follow the procedure.
Click « Data sources » from the menu bar.
Then click the data source you want to delete in the left sidebar.
Then click the « Drop datasource » button on the title bar.
Confirm the action to permanently delete the source.
This operation is irreversible. If you have exported the data source (see « Export a data Source » earlier in this document), you can re-import the source by following the procedure below.
You can import a data source that would have been exported from another instance of G6K.
Extract the 2 files from the archive on your computer.
Click the « Import Datasource » button in the left sidebar.
Attributes:
Click « Data sources » from the menu bar.
then on from the left side menu.
Attributes:
You can describe the data source in the « Description » space provided for this purpose.
The declaration of the tables is identical to the creation of the tables of an internal data source.
Click on « Data sources » in the menu bar
then on from the left side menu.
Attributes:
You can describe the data source in the « Description » space provided for this purpose.
The parameters transmitted to the API are defined by each of the simulators using the API.
If the URI of the webservice has a fixed path independent of the requests, make it appear in the URI.
If there is a variable path based on queries submitted to the web service, do not put it in the URI, it will be up to the simulator to complete the URI with the appropriate path.