sapor 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c82aca07c944b7856177371f689664504ad1db67bff9151627938bee6e2c4525
4
- data.tar.gz: bc0b6f05813bad8c204a5058a309416e3b59f08395b88327ac2f15caf90a27ca
3
+ metadata.gz: f25fefeb34310d1cabbfa39e487ca17da86a423fb0c717f4e2171aeaa2efcf57
4
+ data.tar.gz: 668f74a5b33fb288533e5ffca9d0b6eb5e8b743bfa22311070c8b439cb830359
5
5
  SHA512:
6
- metadata.gz: 840b5c70a2f624858ff02f96b83309b3513de3767909228fdc98abf39ee7487d69343a97356b9529d08acbada9ba3362d4ebe6ef4e409165b0ca810e23680808
7
- data.tar.gz: 35e5e6a577ca5c87c82c66fe53f8bbde8a56a39718adc01a1657ace534f0472577257e3f249c4aa3098246fb36446cde9f19c3dd1604b591fd577b1f67f8be82
6
+ metadata.gz: f821ce4a0511660b8547873da615b74d7ccd90648cef7f623b9aa9fb44c3f0c56030574748bd5e9db30e55c03cca70dca63de6c29ae52ac12026bbbf743e1c3e
7
+ data.tar.gz: 11dc904bc2e19ff3d79342e795f04f6858d2ae2a7e30e5eef3a44fa61f32d1f89991c3b1fc47938379d5adffbea9e3d1fa2aaf2550c41ecd30efd5e4c13f9443
data/lib/sapor/poll.rb CHANGED
@@ -43,6 +43,7 @@ module Sapor
43
43
  EuropeanUnion27Denmark.instance,
44
44
  EuropeanUnion27Estonia.instance,
45
45
  EuropeanUnion27Finland.instance,
46
+ EuropeanUnion27France.instance,
46
47
  EuropeanUnion27Ireland.instance,
47
48
  EuropeanUnion27IrelandWithIa.instance,
48
49
  EuropeanUnion27Italy.instance,
@@ -62,7 +63,6 @@ module Sapor
62
63
  EuropeanUnionFinland.instance,
63
64
  EuropeanUnionFlanders.instance,
64
65
  EuropeanUnionFrance.instance,
65
- EuropeanUnionFrance2019.instance,
66
66
  EuropeanUnionFrenchCommunityOfBelgium.instance,
67
67
  EuropeanUnionGermany.instance,
68
68
  EuropeanUnionGreatBritain.instance,
@@ -84,8 +84,6 @@ module Sapor
84
84
  EuropeanUnionSlovenia.instance,
85
85
  EuropeanUnionSpain.instance,
86
86
  EuropeanUnionSweden.instance].freeze
87
- LATVIAN_AREAS = [Latvia.instance, LatviaKpv.instance, \
88
- LatviaKpvPar.instance, LatviaKpvPPar.instance].freeze
89
87
  NORWEGIAN_AREAS = [Norway.instance, NorwegianMunicipality::BERGEN,
90
88
  NorwegianMunicipality::OSLO,
91
89
  NorwegianMunicipality::TRONDHEIM].freeze
@@ -104,10 +102,10 @@ module Sapor
104
102
  PortugalWithoutPaf.instance].freeze
105
103
  AREAS_MAP = {}
106
104
  (BELGIAN_AREAS + CATALONIAN_AREAS + DANISH_AREAS + EUROPEAN_UNION_AREAS + \
107
- LATVIAN_AREAS + NORWEGIAN_AREAS + POLISH_AREAS + PORTUGUESE_AREAS + \
105
+ NORWEGIAN_AREAS + POLISH_AREAS + PORTUGUESE_AREAS + \
108
106
  [Austria.instance, Estonia.instance, Finland.instance,
109
107
  FinlandWithSin.instance, France.instance, Greece.instance,
110
- Hungary.instance, Iceland.instance, Luxembourg.instance,
108
+ Hungary.instance, Iceland.instance, Latvia.instance, Luxembourg.instance,
111
109
  Netherlands.instance, Slovakia.instance, Slovenia.instance,
112
110
  Spain.instance, Sweden.instance, Sweden20140914.instance,
113
111
  UnitedKingdom.instance, UnitedKingdomWithBrexit.instance,
@@ -21,11 +21,11 @@ module Sapor
21
21
  #
22
22
  # The regional data for the European Union: France.
23
23
  #
24
- class EuropeanUnionFrance2019 < Area
24
+ class EuropeanUnion27France < Area
25
25
  include Singleton
26
26
 
27
27
  def area_code
28
- 'EU[FR]@2019'
28
+ 'EU27[FR]'
29
29
  end
30
30
 
31
31
  def coalitions
@@ -57,18 +57,18 @@ module Sapor
57
57
  ['La France insoumise (GUE/NGL)',
58
58
  'Nouveau Parti anticapitaliste (GUE/NGL)',
59
59
  'Parti communiste français (GUE/NGL)'],
60
- ['Les Patriotes (EFDD)'],
61
60
  ['Les Républicains (EPP)'],
62
- ['Lutte Ouvrière (*)', 'Mouvement des gilets jaunes (*)',
63
- 'Résistons! (*)', 'Union populaire républicaine (*)']].freeze
61
+ ['Les Patriotes (*)', 'Lutte Ouvrière (*)',
62
+ 'Mouvement des gilets jaunes (*)', 'Résistons! (*)',
63
+ 'Union populaire républicaine (*)']].freeze
64
64
 
65
65
  NO_OF_SEATS = 79
66
66
 
67
- # Voter turnout on 25 May 2014
68
- # Source: Web page with the official results of the elections of 25 May
69
- # 2014, downloaded on 8 February 2018,
70
- # https://en.wikipedia.org/wiki/European_Parliament_election,_2014_(France)
71
- POPULATION_SIZE = 18_955_636
67
+ # Voter turnout on 26 May 2019
68
+ # Source: Web page with the official results of the elections of 25-26 May
69
+ # 2019, downloaded on 30 December 2019,
70
+ # https://en.wikipedia.org/wiki/2019_European_Parliament_election_in_France
71
+ POPULATION_SIZE = 22_655_174
72
72
 
73
73
  THRESHOLD = 0.05
74
74
 
@@ -57,18 +57,18 @@ module Sapor
57
57
  ['La France insoumise (GUE/NGL)',
58
58
  'Nouveau Parti anticapitaliste (GUE/NGL)',
59
59
  'Parti communiste français (GUE/NGL)'],
60
- ['Les Patriotes (EFDD)'],
61
60
  ['Les Républicains (EPP)'],
62
- ['Lutte Ouvrière (*)', 'Mouvement des gilets jaunes (*)',
63
- 'Résistons! (*)', 'Union populaire républicaine (*)']].freeze
61
+ ['Les Patriotes (*)', 'Lutte Ouvrière (*)',
62
+ 'Mouvement des gilets jaunes (*)', 'Résistons! (*)',
63
+ 'Union populaire républicaine (*)']].freeze
64
64
 
65
65
  NO_OF_SEATS = 74
66
66
 
67
- # Voter turnout on 25 May 2014
68
- # Source: Web page with the official results of the elections of 25 May
69
- # 2014, downloaded on 8 February 2018,
70
- # https://en.wikipedia.org/wiki/European_Parliament_election,_2014_(France)
71
- POPULATION_SIZE = 18_955_636
67
+ # Voter turnout on 26 May 2019
68
+ # Source: Web page with the official results of the elections of 25-26 May
69
+ # 2019, downloaded on 30 December 2019,
70
+ # https://en.wikipedia.org/wiki/2019_European_Parliament_election_in_France
71
+ POPULATION_SIZE = 22_655_174
72
72
 
73
73
  THRESHOLD = 0.05
74
74
 
@@ -48,16 +48,16 @@ module Sapor
48
48
 
49
49
  COALITIONS = [['Attīstībai/Par! (RE)'],
50
50
  ['Jaunā Saskaņa (GUE/NGL)'],
51
- ['Jaunā Vienotība (EPP)', 'Jaunā konservatīvā partija (EPP)',
52
- 'KPV LV (EPP)',
51
+ ['Jaunā VIENOTĪBA (EPP)', 'Jaunā konservatīvā partija (EPP)',
52
+ 'Politiskā partija „KPV LV (EPP)',
53
53
  'Zaļo un Zemnieku savienība (EPP)'],
54
54
  ['Latvijas Krievu savienība (Greens/EFA)'],
55
- ['Latvijas Reģionu apvienība (ECR)',
55
+ ['Latvijas Reģionu Apvienība (ECR)',
56
56
  'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un ' \
57
57
  'Brīvībai/LNNK” (ECR)'],
58
58
  ['No sirds Latvijai (*)', 'Vienoti Latvijai (*)'],
59
- ['Progresīvie (S&D)',
60
- 'Sociāldemokrātiskā Partija “Saskaņa” (S&D)']].freeze
59
+ ['PROGRESĪVIE (S&D)',
60
+ 'Sociāldemokrātiskā partija “Saskaņa” (S&D)']].freeze
61
61
 
62
62
  NO_OF_SEATS = 8
63
63
 
@@ -50,7 +50,7 @@ module Sapor
50
50
  ['Chrëschtlech-Sozial Vollekspartei (EPP)'],
51
51
  ['déi gréng (Greens/EFA)',
52
52
  'Piratepartei Lëtzebuerg (Greens/EFA)'],
53
- ['Déi Lénk (GUE/NGL)'],
53
+ ['déi Lénk (GUE/NGL)'],
54
54
  ['Demokratesch Partei (RE)'],
55
55
  ['Kommunistesch Partei Lëtzebuerg (*)',
56
56
  'Partei fir Integral Demokratie (*)'],
@@ -72,11 +72,11 @@ module Sapor
72
72
 
73
73
  NO_OF_BONUS_SEATS = 50
74
74
 
75
- # Number of registered voters on 20 September 2015
76
- # Source: Greek legislative election, September 2015, retrieved on 20
77
- # January 2019.
78
- # URL: https://en.wikipedia.org/wiki/Greek_legislative_election,_September_2015
79
- POPULATION_SIZE = 5_567_930
75
+ # Number of registered voters on 7 July 2019
76
+ # Source: Greek legislative election, 7 July 2019, retrieved on 27
77
+ # December 2019.
78
+ # URL: https://en.wikipedia.org/wiki/2019_Greek_legislative_election
79
+ POPULATION_SIZE = 5_769_542
80
80
 
81
81
  THRESHOLD = 0.03
82
82
 
@@ -0,0 +1,104 @@
1
+ # Statistical Analysis of Polling Results (SAPoR)
2
+ # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
3
+ #
4
+ # This file is part of SAPoR.
5
+ #
6
+ # SAPoR is free software: you can redistribute it and/or modify it under the
7
+ # terms of the GNU General Public License as published by the Free Software
8
+ # Foundation, either version 3 of the License, or (at your option) any later
9
+ # version.
10
+ #
11
+ # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
12
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
+ # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
+ #
15
+ # You can find a copy of the GNU General Public License in /doc/gpl.txt
16
+ #
17
+
18
+ # Source: "13. Saeimas vēlēšanas". Retrieved on 28 December 2019.
19
+ # URL: https://sv2018.cvk.lv/pub/ElectionResults
20
+
21
+ Kurzeme | Politiskā partija „KPV LV” | 21,220
22
+ Kurzeme | Jaunā konservatīvā partija | 15,751
23
+ Kurzeme | Zaļo un Zemnieku savienība | 14,925
24
+ Kurzeme | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 13,292
25
+ Kurzeme | Attīstībai/Par! | 11,830
26
+ Kurzeme | Sociāldemokrātiskā partija “Saskaņa” | 8,960
27
+ Kurzeme | Jaunā VIENOTĪBA | 5,839
28
+ Kurzeme | Latvijas Reģionu Apvienība | 5,661
29
+ Kurzeme | PROGRESĪVIE | 2,695
30
+ Kurzeme | No sirds Latvijai | 1,241
31
+ Kurzeme | Latvijas Krievu savienība | 912
32
+ Kurzeme | Latviešu Nacionālisti | 616
33
+ Kurzeme | Apvienība SKG | 330
34
+ Kurzeme | Par Alternatīvu | 207
35
+ Kurzeme | Latvijas centriskā partija | 150
36
+ Kurzeme | Rīcības partija | 106
37
+
38
+ Latgale | Sociāldemokrātiskā partija “Saskaņa” | 32,159
39
+ Latgale | Zaļo un Zemnieku savienība | 12,539
40
+ Latgale | Latvijas Krievu savienība | 9,561
41
+ Latgale | Jaunā konservatīvā partija | 7,900
42
+ Latgale | Politiskā partija „KPV LV” | 6,874
43
+ Latgale | Jaunā VIENOTĪBA | 5,067
44
+ Latgale | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 4,465
45
+ Latgale | Attīstībai/Par! | 4,181
46
+ Latgale | Latvijas Reģionu Apvienība | 3,849
47
+ Latgale | No sirds Latvijai | 865
48
+ Latgale | PROGRESĪVIE | 840
49
+ Latgale | Apvienība SKG | 242
50
+ Latgale | Latviešu Nacionālisti | 209
51
+ Latgale | Rīcības partija | 204
52
+ Latgale | Par Alternatīvu | 168
53
+ Latgale | Latvijas centriskā partija | 154
54
+
55
+ Rīga | Sociāldemokrātiskā partija “Saskaņa” | 88,260
56
+ Rīga | Attīstībai/Par! | 39,209
57
+ Rīga | Politiskā partija „KPV LV” | 35,895
58
+ Rīga | Jaunā konservatīvā partija | 35,696
59
+ Rīga | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 26,995
60
+ Rīga | Jaunā VIENOTĪBA | 19,536
61
+ Rīga | Zaļo un Zemnieku savienība | 14,103
62
+ Rīga | Latvijas Krievu savienība | 11,207
63
+ Rīga | PROGRESĪVIE | 9,936
64
+ Rīga | Latvijas Reģionu Apvienība | 6,066
65
+ Rīga | No sirds Latvijai | 2,003
66
+ Rīga | Par Alternatīvu | 1,265
67
+ Rīga | Latviešu Nacionālisti | 1,153
68
+ Rīga | Apvienība SKG | 396
69
+ Rīga | Rīcības partija | 282
70
+ Rīga | Latvijas centriskā partija | 226
71
+
72
+ Vidzeme | Jaunā konservatīvā partija | 38,893
73
+ Vidzeme | Politiskā partija „KPV LV” | 34,341
74
+ Vidzeme | Attīstībai/Par! | 33,651
75
+ Vidzeme | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 31,466
76
+ Vidzeme | Zaļo un Zemnieku savienība | 27,448
77
+ Vidzeme | Sociāldemokrātiskā partija “Saskaņa” | 26,146
78
+ Vidzeme | Jaunā VIENOTĪBA | 16,940
79
+ Vidzeme | Latvijas Reģionu Apvienība | 14,458
80
+ Vidzeme | PROGRESĪVIE | 6,239
81
+ Vidzeme | Latvijas Krievu savienība | 3,061
82
+ Vidzeme | No sirds Latvijai | 1,844
83
+ Vidzeme | Latviešu Nacionālisti | 1,387
84
+ Vidzeme | Par Alternatīvu | 787
85
+ Vidzeme | Apvienība SKG | 506
86
+ Vidzeme | Rīcības partija | 297
87
+ Vidzeme | Latvijas centriskā partija | 211
88
+
89
+ Zemgale | Politiskā partija „KPV LV” | 21,934
90
+ Zemgale | Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK” | 16,745
91
+ Zemgale | Jaunā konservatīvā partija | 16,454
92
+ Zemgale | Zaļo un Zemnieku savienība | 14,660
93
+ Zemgale | Attīstībai/Par! | 12,814
94
+ Zemgale | Sociāldemokrātiskā partija “Saskaņa” | 11,592
95
+ Zemgale | Jaunā VIENOTĪBA | 9,160
96
+ Zemgale | Latvijas Reģionu Apvienība | 4,984
97
+ Zemgale | PROGRESĪVIE | 2,368
98
+ Zemgale | Latvijas Krievu savienība | 2,273
99
+ Zemgale | No sirds Latvijai | 1,161
100
+ Zemgale | Latviešu Nacionālisti | 880
101
+ Zemgale | Par Alternatīvu | 473
102
+ Zemgale | Apvienība SKG | 261
103
+ Zemgale | Rīcības partija | 170
104
+ Zemgale | Latvijas centriskā partija | 156
@@ -27,52 +27,24 @@ module Sapor
27
27
  end
28
28
 
29
29
  def coalitions
30
- [['KPV LV', 'Sociāldemokrātiskā Partija “Saskaņa”'],
31
- ['KPV LV', 'Sociāldemokrātiskā Partija “Saskaņa”',
32
- 'Zaļo un Zemnieku savienība'],
33
- ['Kustība Par!',
34
- 'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK”',
35
- 'Vienotība', 'Zaļo un Zemnieku savienība'],
36
- ['Kustība Par!',
37
- 'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK”',
38
- 'Zaļo un Zemnieku savienība'],
39
- ['Kustība Par!', 'Jaunā konservatīvā partija',
40
- 'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK”',
41
- 'Vienotība'],
42
- ['Kustība Par!', 'Jaunā konservatīvā partija',
43
- 'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK”',
44
- 'Vienotība', 'Zaļo un Zemnieku savienība'],
45
- ['Kustība Par!', 'Jaunā konservatīvā partija',
46
- 'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK”',
47
- 'Zaļo un Zemnieku savienība'],
48
- ['Kustība Par!', 'Jaunā konservatīvā partija',
49
- 'Sociāldemokrātiskā Partija “Saskaņa”'],
50
- ['Kustība Par!', 'Sociāldemokrātiskā Partija “Saskaņa”'],
51
- ['Jaunā konservatīvā partija',
52
- 'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK”',
53
- 'Vienotība', 'Zaļo un Zemnieku savienība'],
54
- ['Jaunā konservatīvā partija',
55
- 'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK”',
56
- 'Zaļo un Zemnieku savienība'],
57
- ['Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un Brīvībai/LNNK”',
58
- 'Vienotība', 'Zaļo un Zemnieku savienība']]
30
+ COALITIONS
59
31
  end
60
32
 
61
33
  def no_of_seats
62
34
  SEAT_DISTRIBUTION.values.inject(:+)
63
35
  end
64
36
 
65
- def overall_election_results_of_2014
66
- if @overall_election_results_of_2014.nil?
67
- @overall_election_results_of_2014 = \
68
- summarize_election_results(election_results_of_2014)
37
+ def overall_election_results_of_2018
38
+ if @overall_election_results_of_2018.nil?
39
+ @overall_election_results_of_2018 = \
40
+ summarize_election_results(election_results_of_2018)
69
41
  end
70
- @overall_election_results_of_2014
42
+ @overall_election_results_of_2018
71
43
  end
72
44
 
73
45
  def population_size
74
- # Voter turnout on 4 October 2014
75
- 913_491
46
+ # Voter turnout on 6 October 2018
47
+ 839_000
76
48
  end
77
49
 
78
50
  def seats(simulation)
@@ -85,24 +57,51 @@ module Sapor
85
57
 
86
58
  private
87
59
 
88
- SEAT_DISTRIBUTION = { 'Kurzeme' => 13, 'Latgale' => 15, 'Rīga' => 32,
89
- 'Vidzeme' => 26, 'Zemgale' => 14 }.freeze
60
+ AP_PARTY = 'Attīstībai/Par!'.freeze
61
+ JKP_PARTY = 'Jaunā konservatīvā partija'.freeze
62
+ JV_PARTY = 'Jaunā VIENOTĪBA'.freeze
63
+ KPVLV_PARTY = 'Politiskā partija „KPV LV”'.freeze
64
+ NA_PARTY = 'Nacionālā apvienība „Visu Latvijai!”–„Tēvzemei un ' \
65
+ 'Brīvībai/LNNK”'.freeze
66
+ SDPS_PARTY = 'Sociāldemokrātiskā partija “Saskaņa”'.freeze
67
+ ZZS_PARTY = 'Zaļo un Zemnieku savienība'.freeze
68
+
69
+ COALITIONS = [[AP_PARTY, JKP_PARTY, JV_PARTY, KPVLV_PARTY],
70
+ [AP_PARTY, JKP_PARTY, JV_PARTY, KPVLV_PARTY, NA_PARTY],
71
+ [AP_PARTY, JKP_PARTY, JV_PARTY, NA_PARTY],
72
+ [AP_PARTY, JKP_PARTY, JV_PARTY, NA_PARTY, ZZS_PARTY],
73
+ [AP_PARTY, JKP_PARTY, KPVLV_PARTY, NA_PARTY],
74
+ [AP_PARTY, JKP_PARTY, NA_PARTY, ZZS_PARTY],
75
+ [AP_PARTY, JKP_PARTY, SDPS_PARTY],
76
+ [AP_PARTY, JV_PARTY, KPVLV_PARTY, NA_PARTY],
77
+ [AP_PARTY, JV_PARTY, NA_PARTY, ZZS_PARTY],
78
+ [AP_PARTY, NA_PARTY, ZZS_PARTY],
79
+ [AP_PARTY, SDPS_PARTY],
80
+ [JKP_PARTY, JV_PARTY, KPVLV_PARTY, NA_PARTY],
81
+ [JKP_PARTY, JV_PARTY, NA_PARTY, ZZS_PARTY],
82
+ [JKP_PARTY, NA_PARTY, ZZS_PARTY],
83
+ [KPVLV_PARTY, SDPS_PARTY],
84
+ [KPVLV_PARTY, SDPS_PARTY, ZZS_PARTY],
85
+ [NA_PARTY, JV_PARTY, ZZS_PARTY]].freeze
86
+
87
+ SEAT_DISTRIBUTION = { 'Kurzeme' => 12, 'Latgale' => 14, 'Rīga' => 35,
88
+ 'Vidzeme' => 25, 'Zemgale' => 14 }.freeze
90
89
 
91
90
  THRESHOLD = 0.05
92
91
 
93
- def election_results_of_2014
94
- if @election_results_of_2014.nil?
95
- @election_results_of_2014 = load_election_results(
96
- 'latvia-20141004.psv'
92
+ def election_results_of_2018
93
+ if @election_results_of_2018.nil?
94
+ @election_results_of_2018 = load_election_results(
95
+ 'latvia-20181006.psv'
97
96
  )
98
97
  end
99
- @election_results_of_2014
98
+ @election_results_of_2018
100
99
  end
101
100
 
102
101
  def electoral_system
103
102
  if @electoral_system.nil?
104
103
  @electoral_system = MultiDistrictProportional.new( \
105
- overall_election_results_of_2014, election_results_of_2014,
104
+ overall_election_results_of_2018, election_results_of_2018,
106
105
  SEAT_DISTRIBUTION, SainteLagueDenominators, 0, THRESHOLD
107
106
  )
108
107
  end
@@ -58,19 +58,3 @@ Sud | Déi Lénk | 95,829
58
58
  Sud | Piratepartei Lëtzebuerg | 50,678
59
59
  Sud | Kommunistesch Partei Lëtzebuerg | 40,132
60
60
  Sud | Partei fir Integral Demokratie | 22,570
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
@@ -0,0 +1,59 @@
1
+ # Statistical Analysis of Polling Results (SAPoR)
2
+ # Copyright (C) 2016 Filip van Laenen <f.a.vanlaenen@ieee.org>
3
+ #
4
+ # This file is part of SAPoR.
5
+ #
6
+ # SAPoR is free software: you can redistribute it and/or modify it under the
7
+ # terms of the GNU General Public License as published by the Free Software
8
+ # Foundation, either version 3 of the License, or (at your option) any later
9
+ # version.
10
+ #
11
+ # SAPoR is distributed in the hope that it will be useful, but WITHOUT ANY
12
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
+ # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
+ #
15
+ # You can find a copy of the GNU General Public License in /doc/gpl.txt
16
+ #
17
+
18
+ # Source: "Résultats officieux — Site officiel des élections // Grand-Duché de
19
+ # Luxembourg". Retrieved on 20 September 2018.
20
+ # URL: https://elections.public.lu/fr/elections-legislatives/2013/resultats.html
21
+
22
+ Centre | Chrëschtlech-Sozial Vollekspartei | 337,687
23
+ Centre | Demokratesch Partei | 280,144
24
+ Centre | déi gréng | 187,790
25
+ Centre | Lëtzebuerger Sozialistesch Aarbechterpartei | 135,968
26
+ Centre | Alternativ Demokratesch Reformpartei | 79,159
27
+ Centre | déi Lénk | 66,253
28
+ Centre | Piratepartei Lëtzebuerg | 59,537
29
+ Centre | Kommunistesch Partei Lëtzebuerg | 8,448
30
+ Centre | Demokratie | 3,949
31
+
32
+ Est | Chrëschtlech-Sozial Vollekspartei | 62,156
33
+ Est | Demokratesch Partei | 43,681
34
+ Est | déi gréng | 34,930
35
+ Est | Lëtzebuerger Sozialistesch Aarbechterpartei | 27,222
36
+ Est | Alternativ Demokratesch Reformpartei | 20,255
37
+ Est | Piratepartei Lëtzebuerg | 14,762
38
+ Est | déi Lénk | 6,984
39
+ Est | Kommunistesch Partei Lëtzebuerg | 1,396
40
+
41
+ Nord | Chrëschtlech-Sozial Vollekspartei | 111,067
42
+ Nord | Demokratesch Partei | 59,039
43
+ Nord | Lëtzebuerger Sozialistesch Aarbechterpartei | 54,682
44
+ Nord | déi gréng | 44,728
45
+ Nord | Alternativ Demokratesch Reformpartei | 33,751
46
+ Nord | Piratepartei Lëtzebuerg | 26,421
47
+ Nord | déi Lénk | 12,164
48
+ Nord | Kommunistesch Partei Lëtzebuerg | 2,734
49
+
50
+ Sud | Chrëschtlech-Sozial Vollekspartei | 488,471
51
+ Sud | Lëtzebuerger Sozialistesch Aarbechterpartei | 403,460
52
+ Sud | Demokratesch Partei | 214,216
53
+ Sud | déi gréng | 266,445
54
+ Sud | Alternativ Demokratesch Reformpartei | 159,223
55
+ Sud | déi Lénk | 108,193
56
+ Sud | Piratepartei Lëtzebuerg | 126,829
57
+ Sud | Kommunistesch Partei Lëtzebuerg | 32,338
58
+ Sud | Demokratie | 6,371
59
+ Sud | déi Konservativ | 9,516
@@ -27,29 +27,24 @@ module Sapor
27
27
  end
28
28
 
29
29
  def coalitions
30
- [['Chrëschtlech-Sozial Vollekspartei'],
31
- ['Chrëschtlech-Sozial Vollekspartei',
32
- 'Lëtzebuerger Sozialistesch Aarbechterpartei'],
33
- ['Chrëschtlech-Sozial Vollekspartei', 'Demokratesch Partei'],
34
- ['déi gréng', 'Demokratesch Partei',
35
- 'Lëtzebuerger Sozialistesch Aarbechterpartei']]
30
+ COALITIONS
36
31
  end
37
32
 
38
33
  def no_of_seats
39
34
  SEAT_DISTRIBUTION.values.inject(:+)
40
35
  end
41
36
 
42
- def overall_election_results_of_2013
43
- if @overall_election_results_of_2013.nil?
44
- @overall_election_results_of_2013 = \
45
- summarize_election_results(election_results_of_2013)
37
+ def overall_election_results_of_2018
38
+ if @overall_election_results_of_2018.nil?
39
+ @overall_election_results_of_2018 = \
40
+ summarize_election_results(election_results_of_2018)
46
41
  end
47
- @overall_election_results_of_2013
42
+ @overall_election_results_of_2018
48
43
  end
49
44
 
50
45
  def population_size
51
- # Voter turnout on 20 October 2013 (note: multiple votes per voter)
52
- 3_276_692
46
+ # Voter turnout on 14 October 2018 (note: multiple votes per voter)
47
+ 3_529_969
53
48
  end
54
49
 
55
50
  def seats(simulation)
@@ -58,21 +53,32 @@ module Sapor
58
53
 
59
54
  private
60
55
 
61
- SEAT_DISTRIBUTION = { 'Centre' => 21, 'Est' => 7, 'Nord' => 9, 'Sud' => 23 }.freeze
56
+ CSV_PARTY = 'Chrëschtlech-Sozial Vollekspartei'.freeze
57
+ DG_PARTY = 'déi gréng'.freeze
58
+ DP_PARTY = 'Demokratesch Partei'.freeze
59
+ LSAP_PARTY = 'Lëtzebuerger Sozialistesch Aarbechterpartei'.freeze
62
60
 
63
- def election_results_of_2013
64
- if @election_results_of_2013.nil?
65
- @election_results_of_2013 = load_election_results(
66
- 'luxembourg-20131020.psv'
61
+ COALITIONS = [[CSV_PARTY],
62
+ [CSV_PARTY, LSAP_PARTY],
63
+ [CSV_PARTY, DP_PARTY],
64
+ [DG_PARTY, DP_PARTY, LSAP_PARTY]].freeze
65
+
66
+ SEAT_DISTRIBUTION = { 'Centre' => 21, 'Est' => 7, 'Nord' => 9,
67
+ 'Sud' => 23 }.freeze
68
+
69
+ def election_results_of_2018
70
+ if @election_results_of_2018.nil?
71
+ @election_results_of_2018 = load_election_results(
72
+ 'luxembourg-20181014.psv'
67
73
  )
68
74
  end
69
- @election_results_of_2013
75
+ @election_results_of_2018
70
76
  end
71
77
 
72
78
  def electoral_system
73
79
  if @electoral_system.nil?
74
80
  @electoral_system = MultiDistrictProportional.new( \
75
- overall_election_results_of_2013, election_results_of_2013,
81
+ overall_election_results_of_2018, election_results_of_2018,
76
82
  SEAT_DISTRIBUTION, DhondtDenominators
77
83
  )
78
84
  end
data/lib/sapor.rb CHANGED
@@ -67,6 +67,7 @@ require 'sapor/regional_data/european_union_27_croatia'
67
67
  require 'sapor/regional_data/european_union_27_denmark'
68
68
  require 'sapor/regional_data/european_union_27_estonia'
69
69
  require 'sapor/regional_data/european_union_27_finland'
70
+ require 'sapor/regional_data/european_union_27_france'
70
71
  require 'sapor/regional_data/european_union_27_ireland'
71
72
  require 'sapor/regional_data/european_union_27_ireland_with_ia'
72
73
  require 'sapor/regional_data/european_union_27_italy'
@@ -86,7 +87,6 @@ require 'sapor/regional_data/european_union_estonia'
86
87
  require 'sapor/regional_data/european_union_finland'
87
88
  require 'sapor/regional_data/european_union_flanders'
88
89
  require 'sapor/regional_data/european_union_france'
89
- require 'sapor/regional_data/european_union_france_2019'
90
90
  require 'sapor/regional_data/european_union_french_community_of_belgium'
91
91
  require 'sapor/regional_data/european_union_germany'
92
92
  require 'sapor/regional_data/european_union_great_britain'
@@ -116,9 +116,6 @@ require 'sapor/regional_data/greece'
116
116
  require 'sapor/regional_data/hungary'
117
117
  require 'sapor/regional_data/iceland'
118
118
  require 'sapor/regional_data/latvia'
119
- require 'sapor/regional_data/latvia_kpv'
120
- require 'sapor/regional_data/latvia_kpv_p_par'
121
- require 'sapor/regional_data/latvia_kpv_par'
122
119
  require 'sapor/regional_data/luxembourg'
123
120
  require 'sapor/regional_data/netherlands'
124
121
  require 'sapor/regional_data/norway'
data/sapor.gemspec CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
  Gem::Specification.new do |gem|
21
21
  gem.name = 'sapor'
22
- gem.version = '0.3.4'
22
+ gem.version = '0.3.5'
23
23
  gem.authors = ['Filip van Laenen']
24
24
  gem.email = ['f.a.vanlaenen@ieee.org']
25
25
 
@@ -19,26 +19,26 @@
19
19
 
20
20
  require 'spec_helper'
21
21
 
22
- describe Sapor::EuropeanUnionFrance2019, '#area_code' do
23
- it 'returns EU[FR]@2019 as the area code' do
24
- expect(Sapor::EuropeanUnionFrance2019.instance.area_code).to eq('EU[FR]@2019')
22
+ describe Sapor::EuropeanUnion27France, '#area_code' do
23
+ it 'returns EU27[FR] as the area code' do
24
+ expect(Sapor::EuropeanUnion27France.instance.area_code).to eq('EU27[FR]')
25
25
  end
26
26
  end
27
27
 
28
- describe Sapor::EuropeanUnionFrance2019, '#no_of_seats' do
28
+ describe Sapor::EuropeanUnion27France, '#no_of_seats' do
29
29
  it 'returns 79 as the number of seats' do
30
- expect(Sapor::EuropeanUnionFrance2019.instance.no_of_seats).to eq(79)
30
+ expect(Sapor::EuropeanUnion27France.instance.no_of_seats).to eq(79)
31
31
  end
32
32
  end
33
33
 
34
- describe Sapor::EuropeanUnionFrance2019, '#population_size' do
35
- it 'returns a population size of 18,955,636' do
36
- expect(Sapor::EuropeanUnionFrance2019.instance.population_size).to \
37
- eq(18_955_636)
34
+ describe Sapor::EuropeanUnion27France, '#population_size' do
35
+ it 'returns a population size of 22,655,174' do
36
+ expect(Sapor::EuropeanUnion27France.instance.population_size).to \
37
+ eq(22_655_174)
38
38
  end
39
39
  end
40
40
 
41
- describe Sapor::EuropeanUnionFrance2019, '#seats' do
41
+ describe Sapor::EuropeanUnion27France, '#seats' do
42
42
  it 'calculates the number of seats using the votes of the 2014 election' do
43
43
  results = { 'Front national–Rassemblement bleu Marine (ENF)' => 4_712_461,
44
44
  'Union pour un mouvement populaire (EPP)' => 3_943_819,
@@ -53,7 +53,7 @@ describe Sapor::EuropeanUnionFrance2019, '#seats' do
53
53
  'Alliance écologiste indépendante (—)' => 211_759,
54
54
  'Force vie' => 138_708, 'Europe citoyenne (—)' => 127_849,
55
55
  'Parti du vote blanc (—)' => 110_090 }
56
- seats = Sapor::EuropeanUnionFrance2019.instance.seats(results)
56
+ seats = Sapor::EuropeanUnion27France.instance.seats(results)
57
57
  expect(seats['Front national–Rassemblement bleu Marine (ENF)']).to eq(22 + 1)
58
58
  expect(seats['Union pour un mouvement populaire (EPP)']).to eq(18 + 2)
59
59
  expect(seats['Parti socialiste–Parti radical de gauche (S&D)']).to eq(12 + 1)