rwanda 0.1.0

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.
@@ -0,0 +1,39 @@
1
+ # Rwanda
2
+
3
+ Access geographic information about Rwanda.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rwanda'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rwanda
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ rw = Rwanda.new
25
+ rw.provinces
26
+ rw.sectors_of 'Gasabo'
27
+ rw.district_of 'Giheke'
28
+ rw.sector_like 'Rukuma'
29
+ ```
30
+
31
+ Cells and villages may follow if I can get hold of the relevant information.
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/repent/rwanda/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
@@ -0,0 +1,3 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ Dir.glob('tasks/**/*.rake').each(&method(:import))
@@ -0,0 +1,76 @@
1
+ require "rwanda/version"
2
+ require "rwanda/data"
3
+ require "fuzzy_match"
4
+
5
+ class Rwanda
6
+ # Province, District, Sector, Cell?, Village?
7
+
8
+ # Singular Ofs ((
9
+
10
+ def district_of(sector)
11
+ districts_with_sectors.each do |d,s_array|
12
+ return d if s_array.include? sector
13
+ end
14
+ nil
15
+ end
16
+ def province_of(district)
17
+ Province.each do |p,d_array|
18
+ return p if d_array.include? district
19
+ end
20
+ nil
21
+ end
22
+
23
+ # )) Plural Ofs ((
24
+
25
+ def districts_of(province)
26
+ return nil unless Province[province]
27
+ Province[province].keys
28
+ end
29
+ def sectors_of(district)
30
+ districts_with_sectors[district]
31
+ end
32
+
33
+ # )) Lists ((
34
+
35
+ def provinces; Province.keys; end
36
+ def districts; Province.collect {|p,d| d.collect {|d,s| d}}.flatten; end
37
+ def sectors; Province.collect {|p,d| d.collect {|d,s| s}}.flatten; end
38
+
39
+ # )) Fuzzy Matching ((
40
+
41
+ def district_like(district)
42
+ @fd ||= FuzzyMatch.new(districts)
43
+ @fd.find(district)
44
+ end
45
+ def province_like(province)
46
+ @fp = FuzzyMatch.new(provinces)
47
+ @fp.find(province)
48
+ end
49
+ def sector_like(sector)
50
+ @fs = FuzzyMatch.new(sectors)
51
+ @fs.find(sector)
52
+ end
53
+
54
+ # )) Existence ((
55
+
56
+ def province?(province); provinces.include? province; end
57
+ def district?(district); districts.include? district; end
58
+ def sector?(sector); sectors.include? sector; end
59
+
60
+ # ))
61
+
62
+ private
63
+
64
+ def districts_with_sectors # flatten out province layer
65
+ Province.each_with_object({}) { |(p,d_hash),h| h.merge! d_hash }
66
+ end
67
+ #def sectors_with_cells
68
+ # all_sectors_with_cells = {}
69
+ # districts_with_sectors.each do |d,s_hash|
70
+ # all_sectors_with_cells.merge!(s_hash)
71
+ # end
72
+ # all_sectors_with_cells
73
+ #end
74
+ #def sector_of(cell)
75
+ #end
76
+ end
@@ -0,0 +1,520 @@
1
+ class Rwanda
2
+ Province = {
3
+ 'Kigali City' => {
4
+ 'Nyarugenge' => [
5
+ 'Gitega',
6
+ 'Kanyinya',
7
+ 'Kigali',
8
+ 'Kimisagara',
9
+ 'Mageragere',
10
+ 'Muhima',
11
+ 'Nyakabanda',
12
+ 'Nyamirambo',
13
+ 'Nyarugenge',
14
+ 'Rwezamenyo'
15
+ ],
16
+
17
+ 'Gasabo' => [
18
+ 'Bumbogo',
19
+ 'Gatsata',
20
+ 'Gikomero',
21
+ 'Gisozi',
22
+ 'Jabana',
23
+ 'Jali',
24
+ 'Kacyiru',
25
+ 'Kimihurura',
26
+ 'Kimironko',
27
+ 'Kinyinya',
28
+ 'Ndera',
29
+ 'Nduba',
30
+ 'Remera',
31
+ 'Rusororo',
32
+ 'Rutunga'
33
+ ],
34
+
35
+ 'Kicukiro' => [
36
+ 'Gahanga',
37
+ 'Gatenga',
38
+ 'Gikondo',
39
+ 'Kagarama',
40
+ 'Kanombe',
41
+ 'Kicukiro',
42
+ 'Kigarama',
43
+ 'Masaka',
44
+ 'Niboye',
45
+ 'Nyarugunga'
46
+ ],
47
+ },
48
+
49
+ 'Southern Province' => {
50
+ 'Nyanza' => [
51
+ 'Busasamana',
52
+ 'Busoro',
53
+ 'Cyabakamyi',
54
+ 'Kibirizi',
55
+ 'Kigoma',
56
+ 'Mukingo',
57
+ 'Muyira',
58
+ 'Ntyazo',
59
+ 'Nyagisozi',
60
+ 'Rwabicuma'
61
+ ],
62
+
63
+ 'Gisagara' => [
64
+ 'Gikonko',
65
+ 'Gishubi',
66
+ 'Kansi',
67
+ 'Kibilizi',
68
+ 'Kigembe',
69
+ 'Mamba',
70
+ 'Muganza',
71
+ 'Mugombwa',
72
+ 'Mukindo',
73
+ 'Musha',
74
+ 'Ndora',
75
+ 'Nyanza',
76
+ 'Save'
77
+ ],
78
+
79
+ 'Nyaruguru' => [
80
+ 'Busanze',
81
+ 'Cyahinda',
82
+ 'Kibeho',
83
+ 'Kivu',
84
+ 'Mata',
85
+ 'Muganza',
86
+ 'Munini',
87
+ 'Ngera',
88
+ 'Ngoma',
89
+ 'Nyabimata',
90
+ 'Nyagisozi',
91
+ 'Ruheru',
92
+ 'Ruramba',
93
+ 'Rusenge'
94
+ ],
95
+
96
+ 'Huye' => [
97
+ 'Gishamvu',
98
+ 'Huye',
99
+ 'Karama',
100
+ 'Kigoma',
101
+ 'Kinazi',
102
+ 'Maraba',
103
+ 'Mbazi',
104
+ 'Mukura',
105
+ 'Ngoma',
106
+ 'Ruhashya',
107
+ 'Rusatira',
108
+ 'Rwaniro',
109
+ 'Simbi',
110
+ 'Tumba'
111
+ ],
112
+
113
+ 'Nyamagabe' => [
114
+ 'Buruhukiro',
115
+ 'Cyanika',
116
+ 'Gasaka',
117
+ 'Gatare',
118
+ 'Kaduha',
119
+ 'Kamegeri',
120
+ 'Kibirizi',
121
+ 'Kibumbwe',
122
+ 'Kitabi',
123
+ 'Mbazi',
124
+ 'Mugano',
125
+ 'Musange',
126
+ 'Musebeya',
127
+ 'Mushubi',
128
+ 'Nkomane',
129
+ 'Tare',
130
+ 'Uwinkingi'
131
+ ],
132
+
133
+ 'Ruhango' => [
134
+ 'Bweramana',
135
+ 'Byimana',
136
+ 'Kabagari',
137
+ 'Kinazi',
138
+ 'Kinihira',
139
+ 'Mbuye',
140
+ 'Mwendo',
141
+ 'Ntongwe',
142
+ 'Ruhango'
143
+ ],
144
+
145
+ 'Muhanga' => [
146
+ 'Cyeza',
147
+ 'Kabacuzi',
148
+ 'Kibangu',
149
+ 'Kiyumba',
150
+ 'Muhanga',
151
+ 'Mushishiro',
152
+ 'Nyabinoni',
153
+ 'Nyamabuye',
154
+ 'Nyarusange',
155
+ 'Rongi',
156
+ 'Rugendabari',
157
+ 'Shyogwe'
158
+ ],
159
+
160
+ 'Kamonyi' => [
161
+ 'Gacurabwenge',
162
+ 'Karama',
163
+ 'Kayenzi',
164
+ 'Kayumbu',
165
+ 'Mugina',
166
+ 'Musambira',
167
+ 'Ngamba',
168
+ 'Nyamiyaga',
169
+ 'Nyarubaka',
170
+ 'Rugalika',
171
+ 'Rukoma',
172
+ 'Runda'
173
+ ],
174
+ },
175
+
176
+ 'Western Province' => {
177
+ 'Karongi' => [
178
+ 'Bwishyura',
179
+ 'Gishari',
180
+ 'Gishyita',
181
+ 'Gitesi',
182
+ 'Mubuga',
183
+ 'Murambi',
184
+ 'Murundi',
185
+ 'Mutuntu',
186
+ 'Rubengera',
187
+ 'Rugabano',
188
+ 'Ruganda',
189
+ 'Rwankuba',
190
+ 'Twumba'
191
+ ],
192
+
193
+ 'Rutsiro' => [
194
+ 'Boneza',
195
+ 'Gihango',
196
+ 'Kigeyo',
197
+ 'Kivumu',
198
+ 'Manihira',
199
+ 'Mukura',
200
+ 'Murunda',
201
+ 'Musasa',
202
+ 'Mushonyi',
203
+ 'Mushubati',
204
+ 'Nyabirasi',
205
+ 'Ruhango',
206
+ 'Rusebeya'
207
+ ],
208
+
209
+ 'Rubavu' => [
210
+ 'Bugeshi',
211
+ 'Busasamana',
212
+ 'Cyanzarwe',
213
+ 'Gisenyi',
214
+ 'Kanama',
215
+ 'Kanzenze',
216
+ 'Mudende',
217
+ 'Nyakiliba',
218
+ 'Nyamyumba',
219
+ 'Nyundo',
220
+ 'Rubavu',
221
+ 'Rugerero'
222
+ ],
223
+
224
+ 'Nyabihu' => [
225
+ 'Bigogwe',
226
+ 'Jenda',
227
+ 'Jomba',
228
+ 'Kabatwa',
229
+ 'Karago',
230
+ 'Kintobo',
231
+ 'Mukamira',
232
+ 'Muringa',
233
+ 'Rambura',
234
+ 'Rugera',
235
+ 'Rurembo',
236
+ 'Shyira'
237
+ ],
238
+
239
+ 'Ngororero' => [
240
+ 'Bwira',
241
+ 'Gatumba',
242
+ 'Hindiro',
243
+ 'Kabaya',
244
+ 'Kageyo',
245
+ 'Kavumu',
246
+ 'Matyazo',
247
+ 'Muhanda',
248
+ 'Muhororo',
249
+ 'Ndaro',
250
+ 'Ngororero',
251
+ 'Nyange',
252
+ 'Sovu'
253
+ ],
254
+
255
+ 'Rusizi' => [
256
+ 'Bugarama',
257
+ 'Butare',
258
+ 'Bweyeye',
259
+ 'Gashonga',
260
+ 'Giheke',
261
+ 'Gihundwe',
262
+ 'Gikundamvura',
263
+ 'Gitambi',
264
+ 'Kamembe',
265
+ 'Muganza',
266
+ 'Mururu',
267
+ 'Nkanka',
268
+ 'Nkombo',
269
+ 'Nkungu',
270
+ 'Nyakabuye',
271
+ 'Nyakarenzo',
272
+ 'Nzahaha',
273
+ 'Rwimbogo'
274
+ ],
275
+
276
+ 'Nyamasheke' => [
277
+ 'Bushekeri',
278
+ 'Bushenge',
279
+ 'Cyato',
280
+ 'Gihombo',
281
+ 'Kagano',
282
+ 'Kanjongo',
283
+ 'Karambi',
284
+ 'Karengera',
285
+ 'Kirimbi',
286
+ 'Macuba',
287
+ 'Mahembe',
288
+ 'Nyabitekeri',
289
+ 'Rangiro',
290
+ 'Ruharambuga',
291
+ 'Shangi'
292
+ ],
293
+ },
294
+
295
+ 'Northern Province' => {
296
+ 'Rulindo' => [
297
+ 'Base',
298
+ 'Burega',
299
+ 'Bushoki',
300
+ 'Buyoga',
301
+ 'Cyinzuzi',
302
+ 'Cyungo',
303
+ 'Kinihira',
304
+ 'Kisaro',
305
+ 'Masoro',
306
+ 'Mbogo',
307
+ 'Murambi',
308
+ 'Ngoma',
309
+ 'Ntarabana',
310
+ 'Rukozo',
311
+ 'Rusiga',
312
+ 'Shyorongi',
313
+ 'Tumba'
314
+ ],
315
+
316
+ 'Gakenke' => [
317
+ 'Busengo',
318
+ 'Coko',
319
+ 'Cyabingo',
320
+ 'Gakenke',
321
+ 'Gashenyi',
322
+ 'Janja',
323
+ 'Kamubuga',
324
+ 'Karambo',
325
+ 'Kivuruga',
326
+ 'Mataba',
327
+ 'Minazi',
328
+ 'Mugunga',
329
+ 'Muhondo',
330
+ 'Muyongwe',
331
+ 'Muzo',
332
+ 'Nemba',
333
+ 'Ruli',
334
+ 'Rusasa',
335
+ 'Rushashi'
336
+ ],
337
+
338
+ 'Musanze' => [
339
+ 'Busogo',
340
+ 'Cyuve',
341
+ 'Gacaca',
342
+ 'Gashaki',
343
+ 'Gataraga',
344
+ 'Kimonyi',
345
+ 'Kinigi',
346
+ 'Muhoza',
347
+ 'Muko',
348
+ 'Musanze',
349
+ 'Nkotsi',
350
+ 'Nyange',
351
+ 'Remera',
352
+ 'Rwaza',
353
+ 'Shingiro'
354
+ ],
355
+
356
+ 'Burera' => [
357
+ 'Bungwe',
358
+ 'Butaro',
359
+ 'Cyanika',
360
+ 'Cyeru',
361
+ 'Gahunga',
362
+ 'Gatebe',
363
+ 'Gitovu',
364
+ 'Kagogo',
365
+ 'Kinoni',
366
+ 'Kinyababa',
367
+ 'Kivuye',
368
+ 'Nemba',
369
+ 'Rugarama',
370
+ 'Rugengabari',
371
+ 'Ruhunde',
372
+ 'Rusarabuge',
373
+ 'Rwerere'
374
+ ],
375
+
376
+ 'Gicumbi' => [
377
+ 'Bukure',
378
+ 'Bwisige',
379
+ 'Byumba',
380
+ 'Cyumba',
381
+ 'Giti',
382
+ 'Kageyo',
383
+ 'Kaniga',
384
+ 'Manyagiro',
385
+ 'Miyove',
386
+ 'Mukarange',
387
+ 'Muko',
388
+ 'Mutete',
389
+ 'Nyamiyaga',
390
+ 'Nyankenke',
391
+ 'Rubaya',
392
+ 'Rukomo',
393
+ 'Rushaki',
394
+ 'Rutare',
395
+ 'Ruvune',
396
+ 'Rwamiko',
397
+ 'Shangasha'
398
+ ],
399
+ },
400
+
401
+ 'Eastern Province' => {
402
+ 'Rwamagana' => [
403
+ 'Fumbwe',
404
+ 'Gahengeri',
405
+ 'Gishari',
406
+ 'Karenge',
407
+ 'Kigabiro',
408
+ 'Muhazi',
409
+ 'Munyaga',
410
+ 'Munyiginya',
411
+ 'Musha',
412
+ 'Muyumbu',
413
+ 'Mwulire',
414
+ 'Nyakariro',
415
+ 'Nzige',
416
+ 'Rubona'
417
+ ],
418
+
419
+ 'Nyagatare' => [
420
+ 'Gatunda',
421
+ 'Karama',
422
+ 'Karangazi',
423
+ 'Katabagemu',
424
+ 'Kiyombe',
425
+ 'Matimba',
426
+ 'Mimuli',
427
+ 'Mukama',
428
+ 'Musheli',
429
+ 'Nyagatare',
430
+ 'Rukomo',
431
+ 'Rwempasha',
432
+ 'Rwimiyaga',
433
+ 'Tabagwe'
434
+ ],
435
+
436
+ 'Gatsibo' => [
437
+ 'Gasange',
438
+ 'Gatsibo',
439
+ 'Gitoki',
440
+ 'Kabarore',
441
+ 'Kageyo',
442
+ 'Kiramuruzi',
443
+ 'Kiziguro',
444
+ 'Muhura',
445
+ 'Murambi',
446
+ 'Ngarama',
447
+ 'Nyagihanga',
448
+ 'Remera',
449
+ 'Rugarama',
450
+ 'Rwimbogo'
451
+ ],
452
+
453
+ 'Kayonza' => [
454
+ 'Gahini',
455
+ 'Kabare',
456
+ 'Kabarondo',
457
+ 'Mukarange',
458
+ 'Murama',
459
+ 'Murundi',
460
+ 'Mwiri',
461
+ 'Ndego',
462
+ 'Nyamirama',
463
+ 'Rukara',
464
+ 'Ruramira',
465
+ 'Rwinkwavu'
466
+ ],
467
+
468
+ 'Kirehe' => [
469
+ 'Gahara',
470
+ 'Gatore',
471
+ 'Kigarama',
472
+ 'Kigina',
473
+ 'Kirehe',
474
+ 'Mahama',
475
+ 'Mpanga',
476
+ 'Musaza',
477
+ 'Mushikiri',
478
+ 'Nasho',
479
+ 'Nyamugali',
480
+ 'Nyarubuye'
481
+ ],
482
+
483
+ 'Ngoma' => [
484
+ 'Gashanda',
485
+ 'Jarama',
486
+ 'Karembo',
487
+ 'Kazo',
488
+ 'Kibungo',
489
+ 'Mugesera',
490
+ 'Murama',
491
+ 'Mutenderi',
492
+ 'Remera',
493
+ 'Rukira',
494
+ 'Rukumberi',
495
+ 'Rurenge',
496
+ 'Sake',
497
+ 'Zaza'
498
+ ],
499
+
500
+ 'Bugesera' => [
501
+ 'Gashora',
502
+ 'Juru',
503
+ 'Kamabuye',
504
+ 'Mareba',
505
+ 'Mayange',
506
+ 'Musenyi',
507
+ 'Mwogo',
508
+ 'Ngeruka',
509
+ 'Ntarama',
510
+ 'Nyamata',
511
+ 'Nyarugenge',
512
+ 'Rilima',
513
+ 'Ruhuha',
514
+ 'Rweru',
515
+ 'Shyara'
516
+ ],
517
+ }
518
+ }
519
+ end
520
+