List of commits:
Subject Hash Author Date (UTC)
Add required gems, add redis config 8dd3f4a0dcef508bf6d7d33b02e65e2ac6e70a43 Vasilis Ververis 2017-02-23 16:07:17
final correction 1d09300a29240758cf7a268b5590d744e3bc0f5d lizzzi111 2016-05-12 21:16:54
removing the errors 17104f78bbc0a7c4ba26349623542f40796976a5 root 2016-05-12 21:00:30
small changes in the folde's tree 41c2239641fc95d4f18b05995a3bef472beefbe9 root 2016-05-12 15:48:24
added frontend f8433a496b3044c53714f2bdd753e6f5e09e0e3d root 2016-05-12 15:42:43
Commit 8dd3f4a0dcef508bf6d7d33b02e65e2ac6e70a43 - Add required gems, add redis config
Author: Vasilis Ververis
Author date (UTC): 2017-02-23 16:07
Committer name: anadahz
Committer date (UTC): 2017-03-13 18:14
Parent(s): 1d09300a29240758cf7a268b5590d744e3bc0f5d
Signing key:
Tree: 7605b6bf75e9a58efcee85bbfc25d0953fe94ee2
File Lines added Lines deleted
Gemfile 4 2
config.rb 138 132
File Gemfile changed (mode: 100644) (index 02d771b..37c72bd)
1 gem 'redis'
2 gem 'will_paginate'
1 source 'https://rubygems.org'
2 gem 'redis'
3 gem 'will_paginate'
4 gem 'sinatra'
File config.rb changed (mode: 100644) (index 22d80d3..f48a5ef)
1 require 'redis'
2 require 'ostruct'
3 require 'json'
4
5 CONFIG = OpenStruct.new
6 CONFIG.redis_db_index = 1
7 CONFIG.redis = Redis.new(:db => CONFIG.redis_db_index)
8
9
10 CONFIG.graph_index_key = 'all_graphs'
11
12 # initialise octothorpes
13 CONFIG.info_index_key = Hash.new
14 CONFIG.node_index_key = Hash.new
15 CONFIG.metric_index_key = Hash.new
16 CONFIG.score_index_key = Hash.new
17 CONFIG.percolation_index_key = Hash.new
18 CONFIG.layout_index_key = Hash.new
19
20 CONFIG.node_neighbors_prefix = Hash.new
21 CONFIG.node_prefix = Hash.new
22 CONFIG.metric_prefix = Hash.new
23 CONFIG.score_prefix = Hash.new
24 CONFIG.statistics_prefix = Hash.new
25 CONFIG.percolation_prefix = Hash.new
26
27 CONFIG.metric_names = Hash.new
28 CONFIG.score_names = Hash.new
29 CONFIG.percolation_methods = Hash.new
30 CONFIG.percolation_pctages = Hash.new
31 CONFIG.layout_names = Hash.new
32
33 CONFIG.all_graphs = CONFIG.redis.smembers(CONFIG.graph_index_key)
34
35
36 # for each graph in all_graphs
37 CONFIG.all_graphs.each do |graph|
38
39 CONFIG.info_index_key.store(graph, graph+':'+'general_info')
40 CONFIG.node_index_key.store(graph, graph+':'+'all_nodes')
41 CONFIG.metric_index_key.store(graph, graph+':'+'all_metrics')
42 CONFIG.score_index_key.store(graph, graph+':'+'all_scores')
43 CONFIG.percolation_index_key.store(graph, graph+':'+'all_percolation_modes')
44 CONFIG.layout_index_key.store(graph,graph+':'+'all_layouts')
45
46 CONFIG.node_neighbors_prefix.store(graph, graph+':'+'node_neighbors:')
47 CONFIG.node_prefix.store(graph, graph+':'+'node_metrics:')
48 CONFIG.metric_prefix.store(graph, graph+':'+'metric:')
49 CONFIG.score_prefix.store(graph, graph+':'+'score:')
50 CONFIG.statistics_prefix.store(graph, graph+':'+'statistics:')
51 CONFIG.percolation_prefix.store(graph, graph+':'+'percolation:')
52
53 #automatic retrieval and naive naming of available metrics from Redis
54 CONFIG.metric_names[graph] = CONFIG.redis.smembers(CONFIG.metric_index_key[graph]).inject({}) do |h,metric|
55 h[metric] = metric.split('_').map(&:capitalize).join(' ')
56 h
57 end
58
59 #CONFIG.metric_names = {
60 # 'clustering_coefficient' => "Clustering Coefficient",
61 # 'corrected_clustering_coefficient' => "Clustering Coefficient (Corrected)",
62 # 'degree' => "Node Degree",
63 # 'average_neighbor_degree' => "Average Neighbor Degree",
64 # 'corrected_average_neighbor_degree' => "Average Neighbor Degree (Corrected)",
65 # 'iterated_average_neighbor_degree' => "Iterated Average Neighbor Degree",
66 # 'corrected_iterated_average_neighbor_degree' => "Iterated Average Neighbor Degree (Corrected)",
67 # 'betweenness_centrality' => "Betweenness Centrality",
68 # 'eccentricity' => "Eccentricity",
69 # 'average_shortest_path_length' => "Average Shortest Path Length"
70 #}
71
72
73 #automatic retrieval and naive naming of available scores from Redis
74 CONFIG.score_names[graph] = CONFIG.redis.smembers(CONFIG.score_index_key[graph]).inject({}) do |h,score|
75 h[score] = score.split('_').map(&:capitalize).join(' ')
76 h
77 end
78
79 # scores have to be readable in redis
80 #CONFIG.score_names = {
81 # 'unified_risk_score' => "Unified Risk Score (URS)",
82 # 'advanced_unified_risk_score' => "Advanced URS"
83 #}
84
85
86 #puts JSON.parse(CONFIG.redis.smembers(CONFIG.node_index_key[graph]).to_s)
87
88
89 #automatic retrieval and naive naming of available percolation methods from Redis
90 CONFIG.percolation_methods[graph] = CONFIG.redis.smembers(CONFIG.percolation_index_key[graph]).inject({}) do |h,method|
91 # h[method] = method.split(':').map{|string| string.capitalize}.join(' - ').split('_').map(&:capitalize).join(' ')
92 h[method] = method.split(':').map{|string| string.split('_').map(&:capitalize).join(' ')}.join(' - ')
93 h
94 end
95
96 #retrieval of percolation percentages
97 CONFIG.percolation_pctages[graph] = CONFIG.redis.hget(CONFIG.info_index_key[graph], 'percentages').split(';')
98
99 #automatic retrieval and naive naming of available layouts from Redis
100 CONFIG.layout_names[graph] = CONFIG.redis.smembers(CONFIG.layout_index_key[graph]).inject({}) do |h,layout|
101 h[layout] = layout.split('_').map(&:capitalize).join(' ')
102 h
103 end
104
105 end
106
107 CONFIG.normalization_suffix = '_normalized'
108
109 CONFIG.statistical_indicators = { 'min' => "Minimum",
110 'max' => "Maximum",
111 'average' => "Average Value" ,
112 'median' => "Median Value",
113 'standard_deviation' => "Standard Deviation"}
114
115 # css classes for status indication ordered from "good" to "bad"
116 CONFIG.color_classes = ['success','info', 'warning', 'danger']
117
118 #HTML color codes from green to red in 0x11-steps
119 CONFIG.color_codes = ['#FF0000','#FF1100','#FF2200','#FF3300','#FF4400',
120 '#FF5500','#FF6600','#FF7700','#FF8800','#FF9900',
121 '#FFAA00','#FFBB00','#FFCC00','#FFDD00','#FFEE00',
122 '#FFFF00','#EEFF00','#DDFF00','#CCFF00','#BBFF00',
123 '#AAFF00','#99FF00','#88FF00','#77FF00','#66FF00',
124 '#55FF00','#44FF00','#33FF00','#22FF00','#11FF00',
125 '#00FF00'].reverse
126
127 #can be metric or score
128 CONFIG.node_coloring_field = 'unified_risk_score'
129
130 # max number of neighbors for graphical representation with d3.js
131 CONFIG.max_graph_neighbors = 150
132 CONFIG.nodes_per_page = 25
1 require 'redis'
2 require 'ostruct'
3 require 'json'
4
5 CONFIG = OpenStruct.new
6 CONFIG.redis_db_index = 1
7 CONFIG.redis_host = 'redis'
8 CONFIG.redis_port = 6379
9 CONFIG.redis = Redis.new(
10 :host => CONFIG.redis_host,
11 :port => CONFIG.redis_port,
12 :db => CONFIG.redis_db_index
13 )
14
15
16 CONFIG.graph_index_key = 'all_graphs'
17
18 # initialise octothorpes
19 CONFIG.info_index_key = Hash.new
20 CONFIG.node_index_key = Hash.new
21 CONFIG.metric_index_key = Hash.new
22 CONFIG.score_index_key = Hash.new
23 CONFIG.percolation_index_key = Hash.new
24 CONFIG.layout_index_key = Hash.new
25
26 CONFIG.node_neighbors_prefix = Hash.new
27 CONFIG.node_prefix = Hash.new
28 CONFIG.metric_prefix = Hash.new
29 CONFIG.score_prefix = Hash.new
30 CONFIG.statistics_prefix = Hash.new
31 CONFIG.percolation_prefix = Hash.new
32
33 CONFIG.metric_names = Hash.new
34 CONFIG.score_names = Hash.new
35 CONFIG.percolation_methods = Hash.new
36 CONFIG.percolation_pctages = Hash.new
37 CONFIG.layout_names = Hash.new
38
39 CONFIG.all_graphs = CONFIG.redis.smembers(CONFIG.graph_index_key)
40
41
42 # for each graph in all_graphs
43 CONFIG.all_graphs.each do |graph|
44
45 CONFIG.info_index_key.store(graph, graph+':'+'general_info')
46 CONFIG.node_index_key.store(graph, graph+':'+'all_nodes')
47 CONFIG.metric_index_key.store(graph, graph+':'+'all_metrics')
48 CONFIG.score_index_key.store(graph, graph+':'+'all_scores')
49 CONFIG.percolation_index_key.store(graph, graph+':'+'all_percolation_modes')
50 CONFIG.layout_index_key.store(graph,graph+':'+'all_layouts')
51
52 CONFIG.node_neighbors_prefix.store(graph, graph+':'+'node_neighbors:')
53 CONFIG.node_prefix.store(graph, graph+':'+'node_metrics:')
54 CONFIG.metric_prefix.store(graph, graph+':'+'metric:')
55 CONFIG.score_prefix.store(graph, graph+':'+'score:')
56 CONFIG.statistics_prefix.store(graph, graph+':'+'statistics:')
57 CONFIG.percolation_prefix.store(graph, graph+':'+'percolation:')
58
59 #automatic retrieval and naive naming of available metrics from Redis
60 CONFIG.metric_names[graph] = CONFIG.redis.smembers(CONFIG.metric_index_key[graph]).inject({}) do |h,metric|
61 h[metric] = metric.split('_').map(&:capitalize).join(' ')
62 h
63 end
64
65 #CONFIG.metric_names = {
66 # 'clustering_coefficient' => "Clustering Coefficient",
67 # 'corrected_clustering_coefficient' => "Clustering Coefficient (Corrected)",
68 # 'degree' => "Node Degree",
69 # 'average_neighbor_degree' => "Average Neighbor Degree",
70 # 'corrected_average_neighbor_degree' => "Average Neighbor Degree (Corrected)",
71 # 'iterated_average_neighbor_degree' => "Iterated Average Neighbor Degree",
72 # 'corrected_iterated_average_neighbor_degree' => "Iterated Average Neighbor Degree (Corrected)",
73 # 'betweenness_centrality' => "Betweenness Centrality",
74 # 'eccentricity' => "Eccentricity",
75 # 'average_shortest_path_length' => "Average Shortest Path Length"
76 #}
77
78
79 #automatic retrieval and naive naming of available scores from Redis
80 CONFIG.score_names[graph] = CONFIG.redis.smembers(CONFIG.score_index_key[graph]).inject({}) do |h,score|
81 h[score] = score.split('_').map(&:capitalize).join(' ')
82 h
83 end
84
85 # scores have to be readable in redis
86 #CONFIG.score_names = {
87 # 'unified_risk_score' => "Unified Risk Score (URS)",
88 # 'advanced_unified_risk_score' => "Advanced URS"
89 #}
90
91
92 #puts JSON.parse(CONFIG.redis.smembers(CONFIG.node_index_key[graph]).to_s)
93
94
95 #automatic retrieval and naive naming of available percolation methods from Redis
96 CONFIG.percolation_methods[graph] = CONFIG.redis.smembers(CONFIG.percolation_index_key[graph]).inject({}) do |h,method|
97 # h[method] = method.split(':').map{|string| string.capitalize}.join(' - ').split('_').map(&:capitalize).join(' ')
98 h[method] = method.split(':').map{|string| string.split('_').map(&:capitalize).join(' ')}.join(' - ')
99 h
100 end
101
102 #retrieval of percolation percentages
103 CONFIG.percolation_pctages[graph] = CONFIG.redis.hget(CONFIG.info_index_key[graph], 'percentages').split(';')
104
105 #automatic retrieval and naive naming of available layouts from Redis
106 CONFIG.layout_names[graph] = CONFIG.redis.smembers(CONFIG.layout_index_key[graph]).inject({}) do |h,layout|
107 h[layout] = layout.split('_').map(&:capitalize).join(' ')
108 h
109 end
110
111 end
112
113 CONFIG.normalization_suffix = '_normalized'
114
115 CONFIG.statistical_indicators = { 'min' => "Minimum",
116 'max' => "Maximum",
117 'average' => "Average Value" ,
118 'median' => "Median Value",
119 'standard_deviation' => "Standard Deviation"}
120
121 # css classes for status indication ordered from "good" to "bad"
122 CONFIG.color_classes = ['success','info', 'warning', 'danger']
123
124 #HTML color codes from green to red in 0x11-steps
125 CONFIG.color_codes = ['#FF0000','#FF1100','#FF2200','#FF3300','#FF4400',
126 '#FF5500','#FF6600','#FF7700','#FF8800','#FF9900',
127 '#FFAA00','#FFBB00','#FFCC00','#FFDD00','#FFEE00',
128 '#FFFF00','#EEFF00','#DDFF00','#CCFF00','#BBFF00',
129 '#AAFF00','#99FF00','#88FF00','#77FF00','#66FF00',
130 '#55FF00','#44FF00','#33FF00','#22FF00','#11FF00',
131 '#00FF00'].reverse
132
133 #can be metric or score
134 CONFIG.node_coloring_field = 'unified_risk_score'
135
136 # max number of neighbors for graphical representation with d3.js
137 CONFIG.max_graph_neighbors = 150
138 CONFIG.nodes_per_page = 25
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/coria/coria-frontend

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/coria/coria-frontend

Clone this repository using git:
git clone git://git.rocketgit.com/user/coria/coria-frontend

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main