-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2117 lines (1897 loc) · 68.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Integrity Watch FRANCE</title>
<link rel="shortcut icon" href="favicon.ico">
<link href="css/bower.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/dc.css"/>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<link rel="stylesheet" type="text/css" href="css/style-parlementaires.css"/>
<script type="text/javascript" src="js/bower.js"></script>
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@TI_France" />
<meta name="twitter:creator" content="@eucampaign" />
<meta property="og:url" content="http://www.integritywatch.fr/index.html" />
<meta property="og:title" content="France Integrity Watch: monitor potential conflicts of interests" />
<meta property="og:description" content="#IntegrityWatch: découvrez l’outil de Transparency International France pour prévenir les conflits d’intérêts au Parlement http://integritywatch.fr/index.html" />
<meta property="og:image" content="http://www.integritywatch.fr/img/thumbnail2.jpg" />
<meta property="fb:app_id" content="1611680135716224" />
<style>
.activitiestable {
width: 100%;
font-size: 12px;
margin-bottom: 20px;
}
.activitiestable tr:nth-child(even) {
background: #f9f9f9;
}
.activitiestable td {
border: 1px solid #eee;
padding: 5px 10px;
}
.activitiestable th {
padding: 5px 10px;
font-size: 13px;
}
.activitiestabletitle {
font-weight: 600;
margin: 10px 0;
display: block;
}
tr.header th.header {
font-size: 12px;
}
.table-info-btn {
display: block;
position: absolute;
top: 5px;
right: 5px;
background: rgb(93, 93, 93);
color: rgb(255, 255, 255);
border-radius: 30px;
font-style: italic;
width: 19px;
height: 19px;
padding: 0px 6px;
font-size: 14px;
}
#table-info-modal .details_modal_body {
text-align: center;
font-size: 20px;
padding-top: 10px;
}
#table-info-modal .modal-content {
padding: 5px;
}
.above-table-bar {
background: rgb(107, 174, 214);;
color: #000;
padding: 3px 10px;
text-align: right;
}
.above-table-bar a {
color: #fff;
text-decoration: none;
font-weight: bold;
}
.above-table-bar a:hover {
color: #eee;
}
</style>
<script type="text/javascript">
var dmy = d3.time.format("%d/%m/%Y");
//var dmy = d3.time.format("%m/%d/%Y");
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"date-eu-pre": function ( date ) {
return dmy.parse(date);
},
"date-eu-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"date-eu-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
});
</script>
</head>
<body>
<div id="loader-container">
<div id="loader"></div>
</div>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-brand" id="ti_logo_container">
<a id="ti_logo" href="http://www.transparency-france.org">Transparency International</a>
<a id="page_title" href="/" target="_blank">Integrity Watch<br />France</a>
</div>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active" id="bl_tool_btn"><a href="/">Parlementaires en France</a></li>
<li><a href="lobby.html">Lobbyistes en France</a></li>
<li><a href="./old_version/index.html">XIVe législature</a></li>
<li class="dropdown">
<a aria-expanded="false" aria-haspopup="true" role="button" data-toggle="dropdown" class="dropdown-toggle" href="#">Integrity Watch Europe<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="http://www.integritywatch.eu">Union Européenne</a></li>
<li><a href="https://openaccess.transparency.org.uk/">Royaume-Uni</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="about.html">A propos</a></li>
<li><a href="http://www.transparency-france.org/observatoire-ethique/contact/">Suivez-nous</a></li>
<li><a href="http://www.transparency-france.org/ewb_pages/div/Faire_un_don_a_TI_France.php">Faites un don</a></li>
</ul>
</div>
</div><!-- container -->
</nav>
<div class="container_wrap bl_header" id="about_wrap_top"> </div>
<div class="container_wrap bl_header" id="about_wrap">
<div class="container">
<div id="about_container" class="row">
<div class="col-md-3 col-lg-3" id="about_content_icon">
</div>
<div class="col-md-6 col-lg-6" id="about_content">
<p>
Integrity Watch France est une base de données interactive qui offre un aperçu unique des intérêts et activités déclarés par les parlementaires. Cet outil doit permettre de mieux identifier les activités susceptibles de générer des conflits d’intérêts.
<br /><br />
Seules les activités exercées en parallèle du mandat de député ou de sénateur ont été prises en compte (mandats électifs, activités conservées, fonctions bénévoles).
<br /><br />
Simple d’utilisation, il suffit de cliquer sur les éléments des infographies pour filtrer, trier et classer les informations. Veillez à bien enlever les filtres en cas de recherches successives.
<br />
<br /><a href="about.html" class="more">En savoir plus</a></p>
</div>
<div class="col-md-3" id="about_social">
<br/>
<a href="https://twitter.com/share" class="twitter-share-button" data-via="TI_France" data-text="#IntegrityWatch: un outil inédit pr prévenir les conflits d'intérêts au Parlement #transparence http://integritywatch.fr/parlementaires.html cc @TI_France @TI_EU http://www.integritywatch.fr/ via TI_France">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<br/>
<br/>
<div class="fb-like" data-show-faces="false" data-href="http://www.integritywatch.fr/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
</div>
</div>
</div><!-- container -->
</div>
<div class="container_wrap" id="toggle_about_wrap">
<div class="container">
<div class="row">
<div class="col-xs-2 col-md-1 col-centered bl_collapse" id="collapse_about">
<a class="opened" href="#">collapse</a>
</div>
</div>
</div>
</div>
<div class="container_wrap filter_bl" id="filter_wrap">
<div class="container">
<div class="row">
<div class="col-xs-9 col-sm-9 col-md-4" id="filter_field_container">
<p>Recherche:</p>
<div class="input-group">
<input type="text" id="search-input" class="form-control input-lg" placeholder="Nom du parlementaire and departement">
</div>
</div>
<!--
<div class="col-xs-9 col-sm-9 col-md-2" id="filter_field_container">
<p> </p>
<div class="input-group">
<input type="text" id="search-input-dep" class="form-control input-lg" placeholder="Departement">
</div>
</div>
-->
<div class="col-sm-7 col-md-7" id="filter_numbers">
<div class="row">
<div class="col-md-3" id="currently_selected_text"><p>Filtres actuels:</p></div>
<div class="col-md-3 filter_number">
<div id="mep_number" class="dc-data-count org-count">
<span id="abig_number" class="big_number filter-count"></span>parmi <strong class="total-count"></strong><br />parlementaires
</div>
</div>
<div class="col-md-3 filter_number">
<div><span class="big_number afilter_long nbaccredited"></span>Total: activités annexes conservées</div>
</div>
</div>
</div>
<div class="col-xs-3 col-sm-3 col-md-1" id="resetall_container">
<button class="btn resetall">Enlever<br />les filtres</button>
</div>
</div>
</div>
</div>
<div id="main_charts_wrap" class="container_wrap">
<div class="container" id="maincontainer">
<div class="row">
<div class="col-md-6 chart_box map_container">
<h3>Departements</h3>
<div class="info_chart">
<span class="info">info</span>
<p class="desc" style="display: none;">Nombre de parlementaires par département, à l’exception de l’Île-de-France et des DOM-TOM (nombres totaux). Passez la souris sur le département qui vous intéresse pour voir le nombre de parlementaires concernés.</p>
</div>
<div class="mapbuttons"><button id="iledefrance">Ile de France</button><button id="franceterritories">DOM-TOM</button></div>
<div id="france"></div>
</div>
<div class="col-md-3 chart_box">
<h3>Parti Politique</h3>
<div class="info_chart">
<span class="info">info</span>
<p class="desc" style="display: none;">Répartition des parlementaires en fonction de leur appartenance politique. Passez la souris sur les différents secteurs pour voir le nombre de parlementaires concernés.</p>
</div>
<div id="pie3"></div>
<div class="legend">
<div class="parti-rem">REM</div>
<div class="parti-lr">LR</div>
<div class="parti-modem">MoDem</div>
<div class="parti-lc">LC</div>
<div class="parti-ng">NG</div>
<div class="parti-fi">FI</div>
<div class="parti-gdr">GDR</div>
<div class="parti-ni">NI</div>
<div class="ni">Autres/Unknown</div>
</div>
<br class="clear" />
</div>
<div class="col-md-3 chart_box">
<h3>Activités annexes</h3>
<div class="info_chart">
<span class="info">info</span>
<p class="desc" style="display: none;">Nombre de mandats électifs, activités professionnelles conservées et fonctions bénévoles toujours en cours déclarées par le parlementaire. Passez la souris sur les différents secteurs pour voir le nombre de parlementaires concernés.</p>
</div>
<div id="pie4"></div>
<div class="legend">
<div class="_nd">0</div>
<div class="_1">1</div>
<div class="_2">2 - 5</div>
<div class="_3">6 - 10</div>
<div class="_4">> 10</div>
<br class="clear" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 chart_box">
</div>
<div class="col-md-3 chart_box">
<h3>Mandat parlementaire</h3>
<div class="info_chart">
<span class="info">info</span>
<p class="desc" style="display: none;">Type de mandat occupé par le parlementaire.</p>
</div>
<div id="pie1"></div>
<div class="legend">
<div class="blu1">Sénat</div>
<div class="blu2">Assemblée nationale</div>
</div>
</div>
<div class="col-md-3 chart_box">
<h3>Hommes/Femmes</h3>
<div id="pie2"></div>
<div class="legend">
<div class="blu1">Hommes</div>
<div class="blu2">Femmes</div>
</div>
</div>
</div>
</div>
</div>
<div id="list_container">
<div class="container">
<div class="row">
<div class="col-md-12 table-responsive">
<div class="row table-title-box">
<div class="col-md-9">
<h2 class="table_title">Activités annexes des parlementaires</h2>
</div>
<div class="col-md-3">
<div class="update">Mise à jour: Février 2019</div>
</div>
</div>
<div class="above-table-bar">
<a href="about.html#recommandations">Que signifient ces données et comment les interpréter ?</a>
</div>
<table class="table table-hover dc-data-grid tablesorter-bootstrap">
<thead>
<tr class="header">
<th class="header">N</th>
<th class="header">Nom</th>
<th class="header">Département</th>
<th class="header">Mandat</th>
<th class="header" style="padding-right: 30px;">Parti politique de rattachement <span class="table-info-btn">i</span></th>
<th class="header" style="padding-right: 30px;">Groupe parlementaire de rattachement <span class="table-info-btn">i</span></th>
<th class="header">Activités annexes conservées</th>
<th class="header">Détention de participations financières</th>
<th class="header">Activités annexes des collaborateurs</th>
<th class="header">Date de dépôt de la dernière déclaration</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div id="repModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header details_modal">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body details_modal_body">
<p>Chargement en cours...</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal table info -->
<div id="table-info-modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header details_modal">
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body details_modal_body">
<a href="about.html#source">Sources des données</a>
</div>
</div>
</div>
</div>
<script>
//Custom sorting for datatables numbers with commas
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"numeric-comma-pre": function ( a ) {
var x = (a == "-") ? 0 : a.replace( /,/g, "" );
return parseFloat( x );
},
"numeric-comma-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"numeric-comma-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"name-lastname-pre": function ( a ) {
//alert(a);
var name = a.substr(0,a.indexOf(' '));
var lastname = a.substr(a.indexOf(' ')+1);
lastname = lastname.replace('<b>','');
lastname = lastname.replace('</b>','');
return lastname.toLowerCase();
},
"name-lastname-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"name-lastname-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
$('.table-info-btn').click(function() {
//Source des données
$('#table-info-modal').modal('show');
});
$('#view_charts').click(function(ev) {
ev.preventDefault();
$('#hidden_charts_wrap').slideToggle('slow', function () {
changeLinkStatus();
})
})
function changeLinkStatus() {
if($('#hidden_charts_wrap').css('display') == 'none'){
$('#view_charts').text('VIEW ALL THE CHARTS')
}else {
$('#view_charts').text('HIDE CHARTS')
}
$('#view_charts').toggleClass('hiddencharts');
}
$('#collapse_about a').click(function(ev) {
ev.preventDefault();
$('#collapse_about a').toggleClass('opened');
$('#collapse_about a').toggleClass('closed');
$('#about_wrap').slideToggle('slow', function () {
$('#about_wrap_top').slideToggle('fast')
})
})
$('.info').click(function(ev) {
ev.preventDefault();
if($(this).hasClass('opened')){
$(this).removeClass('opened');
$(this).parents('.info_chart').find('p.desc').slideUp('fast')
}else{
closeAllInfos();
$(this).addClass('opened');
$(this).parents('.info_chart').find('p.desc').slideDown('fast')
}
});
function closeAllInfos() {
$('.info').removeClass('opened');
$('p.desc').slideUp('fast');
}
var pie2 = dc.pieChart("#pie2");
var pie3 = dc.pieChart("#pie3");
var pie1 = dc.pieChart("#pie1");
var pie4 = dc.pieChart("#pie4");
//var bar1 = dc.barChart("#bar1");
var franceMap = dc.geoChoroplethChart("#france");
var datatable = null;
var rep = null;
var dep = null;
var representatives={};
var declarations;
//var pardep;
var parti_groups = {
"PRG":"#ECB050",
"FG":"#DB6A1F",
"PCF":"#DB6A1F",
"FG/PCF":"#DB6A1F",
"PS":"#C12E41",
"Groupe SRC":"#C12E41",
"PS/SRC":"#C12E41",
"EELV":"#05a61e",
"UDE":"#05a61e",
"EELV/UDE":"#05a61e",
"UDI":"#8C1456",
"EFDD":"#5eced6",
"PPE":"#0a3e63",
"ECR":"#3086c2",
"NA/NI":"#cccccc",
"FN":"#000000",
"Groupe GDR":"#A1480D",
"Group RRDP":"#800c00",
"Others":"#BBBBBB",
"Autres":"#BBBBBB",
"Array":"pink",
//New ones
"REM":"#f6cb00",
"LR":"#0a3e63",
"MoDem":"#ff9205",
"LC":"#48d4f7",
"NG":"#fcafc5",
"FI":"#ff4541",
"GDR":"#c21410",
"NI":"#656565",
"":"#BBBBBB"
};
var activities_colors = {
"0":"#ccc",
"1":"#8ed3fb",
"2 - 5":"#68add4",
"6 - 10":"#4388ad",
"> 10":"#1a6287"
}
var totpeople = 0;
var totact = 0;
var totrev = 0;
var repdata = null;
function cleanstring(str) {
if(str) {
return str.trim().toLowerCase();
} else {
return '';
}
}
function cleanstringSpecial(str) {
if(str){
var newStr = str.trim().toLowerCase();
newStr = newStr.replace("é","e");
newStr = newStr.replace("è","e");
newStr = newStr.replace("ç","c");
newStr = newStr.replace("-"," ");
newStr = newStr.replace("ë","e");
newStr = newStr.replace(".","");
newStr = newStr.replace(/é/g , "e");
newStr = newStr.replace(/è/g , "e");
newStr = newStr.replace(/ç/g , "c");
newStr = newStr.replace(/_/g , " ");
newStr = newStr.replace(/ë/g , "e");
newStr = newStr.replace(/\./g , "");
newStr = newStr.replace(" "," ");
return newStr;
}
}
d3.csv("data/parlementaires.csv", function(error, data) {
d3.json("data/declarations-filtered-2019.json", function(error2, data2) {
//d3.json("data/declarations.json", function(error2, data2) {
d3.csv("data/department-names.csv", function(error, departmentnames) {
d3.csv("data/parties-names.csv", function(error, partiesnames) {
d3.csv("data/list-final-040219.csv", function(error, listfinal) {
d3.csv("data/missing-senators-2019.csv", function(error, missingsenators) {
$('#loader-container').hide();
declarations = data2.declarations.declaration;
console.log(declarations.length);
representatives = data;
var currentYear = "2017";
var timestamps = [];
var matchedtimestamps = [];
listfinal.forEach(function (d) {
timestamps.push(d.timestamp);
});
/* GET ONLY PEOPLE FROM LISTED TIMESTAMPS */
var declaration_filtered = _.filter(declarations, function(dec, index) {
return timestamps.indexOf(dec.dateDepot) > -1;
});
declarations = declaration_filtered;
console.log(declarations);
//Adding missing senators from csv to json structure
missingsenators.forEach(function (d) {
var thisname = d.name.split(' ')[0];
var thislastname = d.name.split(' ')[1];
var newObj = {
"general": {
"mandat": { "label": "Député ou sénateur" },
"qualiteMandat": {
"typeMandat": d.type_mandat
},
"declarant": {
"civilite": d.civilite,
"nom": thislastname,
"prenom": thisname,
"dateNaissance": "",
}
},
"parti": d.parti,
"parti_group": d.groupe,
"departement": d.departement,
"departement_n": d.departement,
"convertedFromCSV": true
};
declarations.push(newObj);
});
//Prepare new data
declarations.forEach(function (d) {
//Prepare main variables
d.name = d.general.declarant.prenom + " " + d.general.declarant.nom;
if(d.name == 'Robert Del'){
d.name = 'Robert Del Picchia';
}
d.name_show = d.name;
d.civilite = cleanstring(d.general.declarant.civilite);
if(cleanstringSpecial(d.civilite) == "m"){
d.civilite = "m";
}
if(cleanstringSpecial(d.civilite) == "mme"){
d.civilite = "f";
}
d.birth_year = d.general.declarant.dateNaissance.split("/")[2];
d.birth_date = d.general.declarant.dateNaissance;
d.revenue = 0;
d.activities = 0;
if(!d.departement){
d.departement;
}
if(d.general.organe && d.general.organe.labelOrgane){
d.departement = d.general.organe.labelOrgane.split("(")[0];
}
if(d.general.organe){
d.departement_n = d.general.organe.codeOrgane;
}
d.region = "";
d.mandat2 = d.general.qualiteMandat.typeMandat;
d.mandat = d.general.mandat.label;
if(!d.parti){
d.parti = "";
}
if(!d.parti_group){
d.parti_group = "";
}
d.activcons = "NON";
d.partsoc = "NON";
d.collabNum = 0;
d.name_url = '';
var thispartydata = _.find(listfinal, function (m) {return m.timestamp == d.dateDepot;});
if(thispartydata){
d.name_url = thispartydata.file.split('-dia')[0];
if(thispartydata.file.indexOf('romeiro-dias-laetitia') > -1){
d.name_url = 'romeiro-dias-laetitia';
}
d.parti = thispartydata.parti.trim();
d.parti_group = thispartydata.groupe.trim();
d.name_show = thispartydata.name;
d.departement_n = thispartydata.departement.trim();
if(!d.general.qualiteMandat.typeMandat){
d.mandat2 = thispartydata.mandatHATPV;
}
}
if(d.mandat2 == 'depute'){
d.mandat2 = 'Député';
} else if(d.mandat2 == 'senateur'){
d.mandat2 = 'Sénateur';
}
if(d.mandat == "Député ou sénateur"){
d.mandat = d.mandat2;
}
if(!d.department || d.department == '' || d.department == undefined){
var thisdepname = _.find(departmentnames, function (m) {return d.departement_n==m.code;});
if(thisdepname){
d.department = thisdepname.name;
}
}
d.parti_group_m = d.parti_group;
d.parti_acronym = '';
var pacronym = _.find(partiesnames, function (m) {return cleanstringSpecial(m.party)==cleanstringSpecial(d.parti);});
if(pacronym){
d.parti_acronym = pacronym.abbreviation;
}
//Party for pie
var partiespielist = ['rem','lr','modem','lc','ng','fi','gdr','ni','ps'];
//'pcf'
if(partiespielist.indexOf(d.parti_acronym.toLowerCase()) < 0){
d.parti_pie = 'Others';
} else {
d.parti_pie = d.parti_acronym;
}
//d.parti_pie = d.parti;
//Deparment number fix
if(d.departement_n == '099' || d.departement_n == '998' || d.departement_n == 998){
d.departement_n = 99;
}
//Calculate activities number and revenue
d.activitiestot = 0;
d.revenuetot = 0;
d.revenuetotAvg = 0;
d.activConsultant = [];
d.activProfCinqDerniere = [];
d.activProfConjoint = [];
d.fonctionBenevole = [];
d.mandatElectif = [];
d.participationDirigeant = [];
d.participationFinanciere = [];
d.activCollaborateurs = [];
if(d.activConsultantDto && d.activConsultantDto.items && d.activConsultantDto.items[0] && d.activConsultantDto.items[0].items){
if(d.activConsultantDto.items[0].items.motif){
d.activConsultant.push(d.activConsultantDto.items[0].items);
} else {
d.activConsultant = d.activConsultantDto.items[0].items;
}
}
if(d.activProfCinqDerniereDto && d.activProfCinqDerniereDto.items && d.activProfCinqDerniereDto.items[0] && d.activProfCinqDerniereDto.items[0].items){
if(d.activProfCinqDerniereDto.items[0].items.motif){
d.activConsultant.push(d.activProfCinqDerniereDto.items[0].items);
} else {
d.activProfCinqDerniere = d.activProfCinqDerniereDto.items[0].items;
}
}
if(d.activProfConjointDto && d.activProfConjointDto.items && d.activProfConjointDto.items[0] && d.activProfConjointDto.items[0].items){
if(d.activProfConjointDto.items[0].items.motif){
d.activProfConjoint.push(d.activProfConjointDto.items[0].items);
} else {
d.activProfConjoint = d.activProfConjointDto.items[0].items;
}
}
if(d.fonctionBenevoleDto && d.fonctionBenevoleDto.items && d.fonctionBenevoleDto.items[0] && d.fonctionBenevoleDto.items[0].items){
if(d.fonctionBenevoleDto.items[0].items.motif){
d.fonctionBenevole.push(d.fonctionBenevoleDto.items[0].items);
} else {
d.fonctionBenevole = d.fonctionBenevoleDto.items[0].items;
}
}
if(d.mandatElectifDto && d.mandatElectifDto.items && d.mandatElectifDto.items[0] && d.mandatElectifDto.items[0].items){
if(d.mandatElectifDto.items[0].items.motif){
d.mandatElectif.push(d.mandatElectifDto.items[0].items);
} else {
d.mandatElectif = d.mandatElectifDto.items[0].items;
}
}
if(d.participationDirigeantDto && d.participationDirigeantDto.items && d.participationDirigeantDto.items[0] && d.participationDirigeantDto.items[0].items){
if(d.participationDirigeantDto.items[0].items.motif){
d.participationDirigeant.push(d.participationDirigeantDto.items[0].items);
} else {
d.participationDirigeant = d.participationDirigeantDto.items[0].items;
}
}
if(d.participationFinanciereDto && d.participationFinanciereDto.items && d.participationFinanciereDto.items[0] && d.participationFinanciereDto.items[0].items){
if(d.participationFinanciereDto.items[0].items.motif){
d.participationFinanciere.push(d.participationFinanciereDto.items[0].items);
} else {
d.participationFinanciere = d.participationFinanciereDto.items[0].items;
}
}
if(d.activCollaborateursDto && d.activCollaborateursDto.items && d.activCollaborateursDto.items[0] && d.activCollaborateursDto.items[0].items){
if(d.activCollaborateursDto.items[0].items.motif){
d.activCollaborateurs.push(d.activCollaborateursDto.items[0].items);
} else {
d.activCollaborateurs = d.activCollaborateursDto.items[0].items;
}
}
if(d.participationFinanciere.length > 0){
d.partsoc = "OUI";
}
//Calculate activities and revenues
function calcActRev(actArray){
if(actArray.length > 0){
actArray.forEach(function (x) {
//Count activity only if conservee
if(x.conservee && x.conservee == "true"){
d.activitiestot ++;
}
//Revenue sum for conservee activities
if(x.conservee == "true"){
if(x.remuneration && x.remuneration.montant.montant){
//If the revenue only has 1 entry the data structure is a bit different
if(x.remuneration.montant.montant.annee && x.remuneration.montant.montant.annee == currentYear){
d.revenuetot += Number(x.remuneration.montant.montant.montant);
} else if(x.remuneration.montant.montant.length > 0){
//If there are more entries, loop through revenue entries, 1 entry per year; pick the current year entry
x.remuneration.montant.montant.forEach(function (y) {
if(y.annee == currentYear){
d.revenuetot += Number(y.montant);
}
});
}
}
//Revenue sum average
var thisacttot = 0;
var thisactyears = 0;
if(x.remuneration && x.remuneration.montant.montant){
//If the revenue only has 1 entry the data structure is a bit different
if(x.remuneration.montant.montant.annee){
d.revenuetotAvg += Number(x.remuneration.montant.montant.montant);
} else if(x.remuneration.montant.montant.length > 0){
//If there are more entries, loop through revenue entries, 1 entry per year; sum the revenues and divide by years amount
x.remuneration.montant.montant.forEach(function (y) {
thisacttot += Number(y.montant);
thisactyears ++;
});
}
}
if(thisactyears > 0){
d.revenuetotAvg += Number(thisacttot)/Number(thisactyears);
//.toFixed(2)
}
}
//If any is kept, set activcons to OUI
if(x.conservee && x.conservee == "true"){
d.activcons = "OUI";
}
});
}
}
calcActRev(d.activConsultant);
calcActRev(d.activProfCinqDerniere);
calcActRev(d.fonctionBenevole);
calcActRev(d.mandatElectif);
calcActRev(d.participationDirigeant);
/* ENTRIES THAT SHOULD NOT BE COUNTED FOR ACTIVITIES COUNT - DO NOT DELETE */
/*
if(d.activProfConjoint.length > 0){
d.activProfConjoint.forEach(function (x) {
});
}
if(d.participationFinanciere.length > 0){
d.participationFinanciere.forEach(function (x) {
});
*/
d.activCollaborateurs.forEach(function (x) {
if((x.descriptionActivite || (x.employeur && x.employeur != "Néant")) && ((cleanstringSpecial(x.employeur) != "neant" && x.employeur != "Néant" && cleanstringSpecial(x.employeur) != "") || (cleanstringSpecial(x.descriptionActivite) != "" && cleanstringSpecial(x.descriptionActivite) != "neant")) && (x.descriptionActivite != "AUCUNE AUTRE ACTIVITE")){
d.collabNum ++;
}
});
d.activities = d.activitiestot;
d.activities_range = "";
if(d.activitiestot == 0){
d.activities_range = "0";
} else if(d.activitiestot <= 1){
d.activities_range = "1";
} else if(d.activitiestot <= 5){
d.activities_range = "2 - 5";
} else if(d.activitiestot <= 10){
d.activities_range = "6 - 10";
} else if(d.activitiestot > 10){
d.activities_range = "> 10";
}
d.revenue = d.revenuetot;
d.revenue_n = d.revenuetot;
//Revenue ranges
if(d.revenue == '#N/D' || d.revenue == ''){
d.revenue_n = 0;
d.revenue_n2 = 0;
} else {
//d.revenue_n = d.revenue.replace(',','.');
d.revenue_n = parseFloat(d.revenue_n);
d.revenue_n2 = d.revenue_n.toFixed(0);
}
if(d.revenue == '#N/D' || d.revenue == ''){
d.revenue_range = "Aucun";
} else if(d.revenue_n <= 1000){
d.revenue_range = "0 - 1000";
} else if(d.revenue_n <= 10000){
d.revenue_range = "1001 - 10,000";
} else if(d.revenue_n <= 25000){
d.revenue_range = "10,001 - 25,000";
} else if(d.revenue_n <= 50000){
d.revenue_range = "25,001 - 50,000";
} else if(d.revenue_n <= 100000){
d.revenue_range = "50,001 - 100,000";
} else if(d.revenue_n > 100000){
d.revenue_range = "100,001 +";
}
d.revenue_n = d.revenue_n.toFixed(2);
});
data = declarations;
data.forEach(function (d) {
//Search string
d.searchstring = d.name + " " + d.departement + " " + d.departement_n;
d.activities_word = d.activities;
//Totals
totpeople ++;
totact += parseInt(d.activities);
totrev += parseFloat(d.revenue_n);
});
function addcommas(x){
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
//$(".nbfte").html(totpeople);
$("#mep_number .filter-count").html(totpeople);
$("#mep_number .total-count").html(totpeople);
$(".nbaccredited").html(addcommas(totact));
$(".nbcost").html(addcommas(totrev.toFixed(0))+"€");
var ndx = crossfilter(data),
searchDim = ndx.dimension(function (d) {return d.searchstring;}),
circ = ndx.dimension(function (d) {
if(d.departement_n && d.departement_n.length == 1){
return '0'+d.departement_n;
} else {
return d.departement_n;
}
}),
type = ndx.dimension(function (d) {return d.mandat;}),
parti = ndx.dimension(function (d) {return d.parti;}),
partig = ndx.dimension(function (d) {return d.parti_group_m;}),
partipie = ndx.dimension(function (d) {return d.parti_pie;}),
civilite = ndx.dimension(function (d) {return d.civilite;}),
name = ndx.dimension(function (d) {return d.name;}),
activities = ndx.dimension(function (d) {return d.activities;}),
activitiesRange = ndx.dimension(function (d) {return d.activities_range;}),
revenueRange = ndx.dimension(function (d) {return d.revenue_range;}),
typeGroup = type.group().reduceSum(function(d) {return 1;}),
circGroup = circ.group().reduceSum(function(d) {return 1;}),
civiliteGroup = civilite.group().reduceSum(function(d) { return 1; }),
partiGroup = parti.group().reduceSum(function(d) {return 1;}),
partigGroup = partig.group().reduceSum(function(d) {return 1;}),
partiPieGroup = partipie.group().reduceSum(function(d) {return 1;}),
activitiesGroup = activities.group().reduceSum(function(d) {return d.activities;}),
activitiesRangeGroup = activitiesRange.group().reduceSum(function(d) {return 1;}),
revenueRangeGroup = revenueRange.group().reduceSum(function(d) {return 1;}),
nameGroup = name.group().reduceSum(function(d) {return 1;});
rep = ndx.dimension(function(d) {
return d.name;
});
dep = ndx.dimension(function(d) {
return d.departement;
});
var avgActivitiesGroup = circ.group().reduce(
function (p, v) {
++p.count;