Simulators management
A calculation simulator is an online service made available to a user to enable them to calculate the results (taxes, social benefits, etc.) corresponding to their particular situation.
The results are calculated on the basis of data supplied by the user, reference data (e.g. amount of a tax) and business rules reflecting the current legislation in the field of simulation.
Creating simulators is reserved for users with the « Manager », « Administrator » or « Super Administrator » role.
Before starting to enter the simulator, think carefully about the simulation scenario, that is, its step-by-step division and their sequence. A simulation step corresponds to a page and vice versa.
In each page, it is necessary to define the information that will be requested from the user (via a form) and those that are restituted to him. A page may also contain blocks of information.
The information returned is either reference data or data from the result of a calculation according to calculation rules (legislation).
It is therefore necessary to make an inventory of all these data:
For the reference data, the question of the data source must be asked. Is there an internal or external web service API or a database to retrieve these data?
If so, it will be possible to set this API or this database in G6K to be able to access it.
Otherwise, it will be necessary to create an internal data source (database) in G6K. Note that simple values (such as the amount of the RSA) can be set constantly in the simulator, thus avoiding the creation of a data source. On the other hand, complex data structures (such as a scale) require the creation of an internal data source.
Then, it is advisable to identify all the elements of a page, name them, label them:
If you need a reference data source and it does not yet exist, you must create it before creating the simulator.
Refer to « Data Sources management » in the documentation.
Click on « Simulators » from the menu bar:
then click the button on the left side menu.
A form for entering the general parameters of the simulator is proposed to you:
Attributes:
Optional attributes:
Describe what your simulator does in the « Description » field. This description will be displayed below the simulator label/title of all pages/simulation steps.
Optionally, you can enter additional information in the « Related Informations » field that the view template will display or not.
When you have finished entering the parameters and clicking on the button , the
button appears at the top right of the page.
This button allows you to send the entered or modified information to the server at any time, because the « Validate » button only keeps the information in the memory of your computer.
In the « Used data sources » fold-out panel you will be able to define the specific requests for access to the datasources reference data. Some of these queries may require parameters that must be defined in the « Data » panel beforehand.
In the title bar of the « Used data sources » panel, click the « Add » button to display the screen for selecting the source and defining a query:
Attributes:
Optional attribute:
Once the source is selected, the form completes the definition fields of the query.
A query is simple if it relates to only one table and does not have a nested subquery.
The form allows you to build simple queries without having to know the SQL language.
Attributes:
To construct the query, refer to the Visual Component Manufacturing Simple Queries documentation
If the query contains a variable parameter, you must first declare a data (see « Data » section below) which will contain the value of the parameter.
Then, validate the entry without entering the filter at first. Click on the « Edit » button. The button appears at the bottom right of the form to allow you to declare the parameter.
After you declare the parameter, you can enter the filter and select the parameter of the expression.
Parameter attributes:
Optional attribute of parameters:
Figure 1: Data source with a simple query and parameter
Once the input is validated, the following screen is displayed:
This query will return an array of « 'rate'/rate value » pairs. The specified return path (0/rate) will select the first row of the array and the value corresponding to 'rate'. We will see later how to declare a data to store the value of the rate.
In this case, the fields « Table », « Selected Columns », « Filter », « Order by », « Number of Results » and « From » are replaced by the « Request » field since those elements are contained in the request.
As with simple queries, parameters can be used.
The forms $X$d where X is the number of the parameter, refer to integer values, $X$f to decimal values and $X$s to alphanumeric values.
Attributes:
Figure 2: Data source with complex query
The data allow to store values whatever their origin (user input, data source, element or result of calculations). They can be grouped into groups of data, allowing them to be arranged in the rows of a table (see « Grid layout » for a group of fields later in this document).
To add a data or a data group, click « Add » in the title bar « Datas »:
then click « Add data » or « Add datagroup » depending on the case:
Figure 3 : Form for adding a data group
Attributes:
Give a description of the data group in the "Description" field.
Figure 4 : Form for adding a data
Attributes:
Data type
Type | Description |
---|---|
date | Date in the format defined in the simulator options. See supra. If the data is associated with an input field, a date picker will be proposed to the user. |
day | Day number from 1 to 31. |
month | Number of months from 1 to 12. |
year | Year in 4 digits. |
boolean | Boolean value (0/1). If the data is associated with an input field, a check cache will be offered to the user. |
integer | Integer value. |
number | Decimal value with decimal point. |
text | Alphanumeric value. |
textarea | Alphanumeric value with enrichment (bold, italic, underline, ...). |
money | Monetary value to 2 decimals. |
choice | Value that can be selected from a drop-down list or with radio buttons. |
multichoice | Values selected using check boxes. |
percent | Percentage from 0 to 100, possibly with decimal values. |
array | List of values. Can not be used for input. |
table | Table of values. Can not be used for input. |
department | Department code. If the data is associated with an input field, the user chooses from a drop-down list. |
region | Region code. If the data is associated with an input field, the user chooses from a drop-down list. |
country | Country name. |
Optional attributes:
Give a description of the data in the "Description" field. This description can be displayed in a tooltip at the request of the user.
In the case of "choice" data, you have to indicate how to feed the list of choices, for this a « Choices » panel is displayed at the bottom of the entry form:
The list is either static, ie its elements appear in extenso in the definition file of the simulator, or dynamic, ie it is filled by a data source
To create a static list, click on the "Add choice" button in the "Choices" panel:
Attributes:
Add choices as many times as necessary to constitute the list.
To create a dynamic list, click the "Add source" button:
Attributes:
Optional attribute:
Once you have defined your data sources and data you will be able to start setting up the step(s) of your simulator.
A step consists of one or more panels in which are arranged information blocks and groups of fields in the order in which they are declared.
The information blocks are composed of chapters, themselves composed of sections.
Field groups are composed of fields that can be arranged in three different ways:
These elements are arranged as follows in the page of a step:
To add a step, click the « Add » button in the title bar of the « Steps » panel:
The entry form for a step is displayed:
Attributes:
Optional attributes:
Output | Description |
---|---|
« Normal » | The step is displayed normally. |
« Inline PDF » | G6K displays a PDF rendering of the generated page. |
« Downloadable PDF » | G6K generates a PDF file of the rendering of the page to be downloaded. |
« html » | Reserve. Not implemented |
Describe the step in the « Description » field. This description is displayed in the area 1 of the page.
The panels compose the steps and are themselves made up of groups of fields. If there are several panels, they will be presented in the form of tabs:
To add a panel, click the « Add » button in the title bar of the « Steps » panel:
then click « Add Panel » in the menu:
Attributes:
Optional attribute:
Fieldset makes it possible to group together fields of the same nature (logical or thematic) thus highlighting the structuring of the information requested.
To add a fieldset, click the « Add » button in the title bar of the "Panel" panel:
then click « Add fieldset » in the menu:
Attributes:
Disposition | Description |
---|---|
Classic | The elements of the form belonging to the group of fields are arranged in a conventional way, that is, a field preceded by its field label is placed on the line following that of the preceding field |
Grid | Form elements belonging to the field group are placed in a table |
Inline | The elements of the form belonging to the group of fields are arranged on line to form a sentence |
Display | Description |
---|---|
Inline | The fields of the field group are displayed "online" in the page |
Pop-in | Fields in the field group are displayed in a pop-in-modal window. A link whose label is in the "Pop-in activation link" attribute displays the |
Optional attribute:
Describe the fieldset in the « Legend » field. This legend appears in the area 3 of the page.
The field is the element of the form that allows the input or the restitution of a data. It takes the form of an entry box, a list box, a checkbox or radio buttons.
It is preceded by a field label unless it is placed in the cell of an array.
It may be mandatory or optional.
To add a field, click the « Add field » button in the title bar of the fieldset panel to which you want to add it:
The form for entering a field is displayed:
Attributes:
Optional attributes:
The blockinfo is an element of the simulation page of the same level as the field group but does not contain any input or output fields.
It contains textual information that can be useful to the user in the simulation process.
It can be contextualized by showing / hiding it totally or partially using the actions of business rules depending on certain conditions.
The blockinfos are composed of one or many chapters themselves composed of one or many sections.
To add a blockinfo, click the "Add" button in the title bar of the "Panel" panel:
then "Add blockinfo" from the menu:
Optional attributes:
The chapter is a subdivision of the Blockinfo. It is composed of sections.
It can be made foldable / unfoldable in the case of a block of information containing many chapters to facilitate the reading of the page.
It can also be associated with an icon to make it visually distinguishable from the other chapters.
To add a chapter, click the "Add chapter" button in the title bar of the « Blockinfo » panel:
The form for entering a chapter is displayed:
Optional attributes:
The section is a subdivision of a chapter. It is in the sections that the different texts of a block of information are inscribed.
The text of a section can be annotated.
To add a section, click the "Add Section" button on the title bar of the « Chapter » panel:
The form for entering a section is displayed:
Optional attributes:
Enter the rich text of the section in the « Content » field of the form.
This content will be displayed in the 12 area of the page.
Optionally, annotations of the text can be added in the « Annotations » field.
These annotations will appear in the 13 area of the page.
A footnote is a contextualized note (which can be shown or hidden by business rules) in the lower part of the form (14 of the page) of a simulation step.
The footnotes can be placed, at your convenience, before or after the action buttons.
To add footnotes, click the « Add » button in the title bar of the « Steps » panel:
then click « Add footnotes » on the menu:
Choose their locations (before or after the action buttons) and validate.
Then click the « Add footnote » button in the title bar:
Enter the note then validate.
The number of notes you can add is not limited.
The action buttons allow you to sequence the steps, reset a form, start a new simulation, or open a page outside the simulator.
They will appear in the 15 area of the page.
To add an action button, click the « Add action button » button in the title bar of the « Action Buttons » panel:
The button attributes input form is displayed:
Attributes:
Optional attributes:
Business rules are defined in the following way: « When ... » condition, « Then ... » actions and « Else ... » actions.
It is the « business rules » that determine the behavior of the simulator. They are triggered when the context changes.
A change of context always results in the acquisition or modification of data.
G6k inquiries about the context change by reverting the conditions associated with the rules when the value of a data changes.
Thus, when the user enters a value, g6K accesses a reference data or a value is calculated, the impacted rules are triggered and the associated actions are performed:
The actions that can be carried out are:
Refer to the Business Rules Composition page for how to compose a rule.
When you define profiles, you will pre-define data related to the different profiles.
Profiles can correspond to types of people e.g. predefined data for a professional differ from pre-filled data of an individual.
Attributes:
At the end of your entry, click the button at the top right of the page to save your work.
Note that G6K saves a version of « work » that it will be necessary to « Publish ».
If, for security reasons, the back-office is located on a different server from those on which visitors are performing simulations, you will have to deploy your simulators on these front-end servers from the back-office.
To do this, G6K provides deployment functionality to copy each simulator from the back-office to the front-end.
To enable this feature, the system administrator must add an « deployment » entry to the parameters.yml file of the G6K instance installed on the back-office server:
Example of deployment settings:
# src/EUREKA/G6KBundle/Resources/config/parameters.yml deployment: localhost: cp -f {local.rootdir}/{local.file} /var/www/html/simulator/{remote.dir}/ remotehost: rsync -a {local.rootdir}/{local.file} user@remoteserver/var/www/html/simulator/{remote.file}
In this example, the system administrator declared two front-end servers of virtual names « localhost » and « remotehost ».
In front of each virtual name is the command that G6K must launch to copy the simulator files via the HTTP server user. Of course, this user must have the rights to execute these commands.
Each command is launched as many times as there are files in the deployed simulator. These files are:
So for the command of the virtual server « localhost » of the example, suppose that the back office is installed in the directory « /var/www/html/g6k », the front-end is installed in the directory « /var www/html/simulator » and that you want to deploy a simulator named « demo » that accesses an internal data source « demo.db » and that it can be viewed in the « Demo » and « Default » views. The command will be started five times by G6K:
cp -f /var/www/html/g6k/src/EUREKA/G6KBundle/Resources/data/simulators/demo.xml /var/www/html/simulator/src/EUREKA/G6KBundle/Resources/data/simulators/
cp -f /var/www/html/g6k/src/EUREKA/G6KBundle/Resources/data/databases/demo.db /var/www/html/simulator/src/EUREKA/G6KBundle/Resources/data/databases/
cp -f /var/www/html/g6k/src/EUREKA/G6KBundle/Resources/data/databases/DataSources.xml /var/www/html/simulator/src/EUREKA/G6KBundle/Resources/data/databases/
cp -f /var/www/html/g6k/src/EUREKA/G6KBundle/Resources/public/Demo/demo.css /var/www/html/simulator/src/EUREKA/G6KBundle/Resources/public/Demo/
cp -f /var/www/html/g6k/src/EUREKA/G6KBundle/Resources/public/Default/demo.css /var/www/html/simulator/src/EUREKA/G6KBundle/Resources/public/Default/
after replacing:
{local.rootdir}, {local.file}, {remote.dir}, and {remote.file} are parameters that the system administrator must use to configure commands:
To deploy a simulator, click on the « Deploy simulator » button in the title bar of the simulator panel and confirm in the dialog box that appears:
A deployment log is displayed. If a log line shows an error (in red), report it to the system administrator.
You must have the « Manager » role to deploy a simulator.