|
1
|
function get_compensation_output(companyId,include,compare,round,general_graphcode,filters,criteria):
|
|
2
|
{
|
|
3
|
# 1. Extract Data
|
|
4
|
panel_data = loadDataFromDatabase(compagny.id, compangy.include, filters)
|
|
5
|
compagny_data = panel_data[panel_data[compagny.id==companyId]]
|
|
6
|
|
|
7
|
# 2. Get datasets for comparison
|
|
8
|
compared_data = buildComparisonDatasets(compare, panel_data, compagny_data)
|
|
9
|
|
|
10
|
# 3. For each criteria, calcul graphs of each criteria
|
|
11
|
criteriaResults = []
|
|
12
|
for( criteria in response.criteria)
|
|
13
|
if(criteria.best_matching = true)
|
|
14
|
DF = bestmatching_DF()
|
|
15
|
{
|
|
16
|
result = null
|
|
17
|
result = calcul_sheet_criteria(criteria,compared_data)
|
|
18
|
result = result[result["number_employee_panel"] > result["number_employee_company"]]
|
|
19
|
result = result[result["number_employee_panel"] > 1]
|
|
20
|
result = function calcul_graphs_criteria
|
|
21
|
|
|
22
|
criteriaResults.append(result)
|
|
23
|
}
|
|
24
|
# 4. Compute global-level graphs
|
|
25
|
globalGraphs = []
|
|
26
|
if(response.graphs != null)
|
|
27
|
for( graph in response.graphs)
|
|
28
|
if(graph eq graph_gap_general)
|
|
29
|
globalGraphs = calcul_graph_gap_general
|
|
30
|
else if(graph eq general_internal_gap_fixed)
|
|
31
|
globalGraphs = calcul_graph_general_internal_gap_fixed
|
|
32
|
else ;
|
|
33
|
|
|
34
|
# 5. Build final response
|
|
35
|
return {
|
|
36
|
"request": request,
|
|
37
|
"response": {
|
|
38
|
"criteria": criteriaResults,
|
|
39
|
"graphs": globalGraphs
|
|
40
|
}
|
|
41
|
}
|
|
42
|
}
|
|
43
|
|
|
44
|
function loadDataFromDatabase(compagny.id, compangy.include, filters)
|
|
45
|
|
|
46
|
function buildComparisonDatasets(rawData,compare)
|
|
47
|
|
|
48
|
function calcul_sheet_criteria
|
|
49
|
|
|
50
|
function create_best_match_df
|
|
51
|
|
|
52
|
function get_compensation_graph_by_criteria
|
|
53
|
|
|
54
|
function get_compensation_general_graph
|
|
55
|
|
|
56
|
|