Scenario Data
Introduction
The scenario comparison offers the ability to highlight differences between two scenarios data.
The Datagrid and Data Explorer allow to compare scenarios data row by row.
When comparison mode is enabled, the Datagrid will split comparison data in three tabs:
rows with modified values
added rows in the selected scenario compared to the reference scenario
deleted rows in the selected scenario compared to the reference scenario
Rows of the compared scenarios are associated between scenarios according to primary key definition of each table, as defined in the application JDL file.
Scenario comparison mode is enabled through a dedicated button in the toolbar.

After activating the comparison mode, the scenario selector will give the ability to select a scenario, and also to select a reference scenario to compare with (orange).
A switch button is also present to switch the selected and the reference scenarios.
The comparison mode is global.
Compatible widgets (Datagrid and the Data Explorer) can individually activate this mode by configuration:

When a widget is not configured to automatically enable comparison mode, a button in the widget toolbar allows user to switch between normal and scenario comparison mode.
When scenario comparison mode is enabled the Datagrid will show two columns by entity attributes, one for the selected scenario (in grey) and one for the reference scenario (in yellow).
Note that the primary key attributes will be displayed as a single column since the value is the same for both scenarios.

Limitations
Only
validscenarios can be compared.Only entities with primary keys are supported.
Singletonentities are not supported.
API
REST API
The API are defined in the client class: DataServiceClient
To be able to use this API, import the data-service-client library:
dependencies {
implementation 'com.decisionbrain.gene:data-service-client:${versions.decisionbrain.dbgene}'
}Be sure to configure the data service URL and port in the application.yml of your service, here is an example of the configuration:
services:
data:
host: localhost
port: 8081GraphQl API
Queries
Activity: returns a list of one or more instances of the ActivitygetActivityComparisonPage: returns a paginated, sortable and filterable list of Activity instancesExample:
query { getActivityComparisonPage ( geneContext: { scenarioIds: ["fbb146b1-3b7c-4564-b288-357fbee71d90"], referenceScenarioIds: ["01fbc776-dcc8-489d-9943-3b6785e876a2"] }, geneComparisonParameters: {includeModifiedRows: DIFF, includeAddedRows: false, includeDeletedRows: false}, dataRowsLimit: 50000, modifiedPageRequest: {page: 0, size: 50, sort: []} ){ metrics { sharedRowCount modifiedRowCount addedRowCount deletedRowCount } modified { totalPages totalElements content { id plant { country { id } plantId } durationInHours name } } } }Result:
{ "data": { "getActivityComparisonPage": { "metrics": { "sharedRowCount": 9000, "modifiedRowCount": 6009, "addedRowCount": 1000, "deletedRowCount": 1000 }, "modified": { "totalPages": 121, "totalElements": 6009, "content": [ { "id": ["00000001", "00000001"], "plant": { "country": { "id": ["001", "001"] }, "plantId": ["001", "001"] }, "durationInHours": [0.0, 2.0], "name": ["Activity 0", "Activity 2"] }, ... ] } } } }