Skip to content

Commit

Permalink
Configured docker
Browse files Browse the repository at this point in the history
Refined the counties and subcounties data
  • Loading branch information
kihuha committed Mar 19, 2021
1 parent 3491ef3 commit 427bf1a
Show file tree
Hide file tree
Showing 30 changed files with 7,029 additions and 7,191 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
}
44 changes: 44 additions & 0 deletions db/01-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
set -e
export PGPASSWORD=$POSTGRES_PASSWORD;
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER $APP_DB_USER WITH PASSWORD '$APP_DB_PASS';
CREATE DATABASE $APP_DB_NAME;
GRANT ALL PRIVILEGES ON DATABASE $APP_DB_NAME TO $APP_DB_USER;
\connect $APP_DB_NAME $APP_DB_USER
BEGIN;
CREATE TABLE counties (
id SERIAL PRIMARY KEY,
county_name TEXT UNIQUE NOT NULL,
county_code TEXT UNIQUE,
total INT NOT NULL,
male INT NOT NULL,
female INT NOT NULL,
intersex INT NOT NULL,
total_households INT NOT NULL,
conventional_households INT NOT NULL,
group_quaters INT NOT NULL,
land_area_sq_km FLOAT NOT NULL,
persons_per_sq_km FLOAT NOT NULL,
total_rural INT NOT NULL,
male_rural INT NOT NULL,
female_rural INT NOT NULL,
intersex_rural INT NOT NULL,
total_households_rural INT NOT NULL,
conventional_households_rural INT NOT NULL,
group_quaters_rural INT NOT NULL,
land_area_sq_km_rural FLOAT NOT NULL,
persons_per_sq_km_rural FLOAT NOT NULL,
total_urban INT NOT NULL,
male_urban INT NOT NULL,
female_urban INT NOT NULL,
intersex_urban INT NOT NULL,
total_households_urban INT NOT NULL,
conventional_households_urban INT NOT NULL,
group_quaters_urban INT NOT NULL,
land_area_sq_km_urban FLOAT NOT NULL,
persons_per_sq_km_urban FLOAT NOT NULL
);
COMMIT;
EOSQL
108 changes: 108 additions & 0 deletions db/02-counties.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash
set -e
export PGPASSWORD=$POSTGRES_PASSWORD;
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
\connect $APP_DB_NAME $APP_DB_USER
BEGIN;
INSERT INTO counties (county_code, county_name, total, male, female, intersex, total_households,
conventional_households, group_quaters, land_area_sq_km, persons_per_sq_km, total_rural,
male_rural, female_rural, intersex_rural, total_households_rural, conventional_households_rural,
group_quaters_rural, land_area_sq_km_rural, persons_per_sq_km_rural, total_urban, male_urban,
female_urban, intersex_urban, total_households_urban, conventional_households_urban,
group_quaters_urban, land_area_sq_km_urban, persons_per_sq_km_urban)
VALUES ('1', 'MOMBASA', 1208333, 610257, 598046, 30, 378422, 376295, 2127, 220, 5495, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1208333, 610257, 598046, 30, 378422, 376295, 2127, 220, 5495),
('2', 'KWALE', 866820, 425121, 441681, 18, 173176, 172802, 374, 8254, 105, 740389, 362726, 377650, 13, 136171,
135892, 279, 641922, 90, 126431, 62395, 64031, 5, 37005, 36910, 95, 63, 2014),
('3', 'KILIFI', 1453787, 704089, 749673, 25, 298472, 297990, 482, 12553, 116, 59899, 512765, 547115, 19, 185754,
185387, 367, 120384, 86, 393888, 191324, 202558, 6, 112718, 112603, 115, 169, 2325),
('4', 'TANA RIVER', 315943, 158550, 157391, 2, 68242, 66984, 1258, 37904, 8, 240221, 120696, 119524, 1, 48345,
47670, 675, 433111, 6, 75722, 37854, 37867, 1, 19897, 19314, 583, 189, 400),
('5', 'LAMU', 143920, 76103, 67813, 4, 37963, 34231, 3732, 6283, 23, 105474, 56570, 48902, 2, 27749, 24161, 3588,
151917, 17, 38446, 19533, 18911, 2, 10214, 10070, 144, 68, 567),
('6', 'TAITA/TAVETA', 340671, 173337, 167327, 7, 96429, 94468, 1961, 17152, 20, 246897, 126717, 120178, 2, 66940,
65015, 1925, 171939, 14, 93774, 46620, 47149, 5, 29489, 29453, 36, 113, 828),
('7', 'GARISSA', 841353, 458975, 382344, 34, 141394, 138940, 2454, 44753, 19, 630463, 349423, 281013, 27, 103697,
102003, 1694, 440577, 14, 210890, 109552, 101331, 7, 37697, 36937, 760, 176, 1199),
('8', 'WAJIR', 781263, 415374, 365840, 49, 127932, 126878, 1054, 56774, 14, 604089, 320562, 283500, 27, 97276,
96882, 394, 560398, 11, 177174, 94812, 82340, 22, 30656, 29996, 660, 376, 472),
('9', 'MANDERA', 867457, 434976, 432444, 37, 125763, 123954, 1809, 25942, 33, 596990, 299428, 297535, 27, 85481,
84728, 753, 411591, 23, 270467, 135548, 134909, 10, 40282, 39226, 1056, 170, 1595),
('10', 'MARSABIT', 459785, 243548, 216219, 18, 77495, 76689, 806, 70944, 6, 352546, 188758, 163772, 16, 57004,
56465, 539, 70808, 5, 107239, 54790, 52447, 2, 20491, 20224, 267, 136, 786),
('11', 'ISIOLO', 268002, 139510, 128483, 9, 58072, 53217, 4855, 25349, 11, 142333, 76435, 65894, 4, 28824, 25352,
3472, 405018, 6, 125669, 63075, 62589, 5, 29248, 27865, 1383, 558, 225),
('12', 'MERU', 1545714, 767698, 777975, 41, 426360, 423931, 2429, 7014, 220, 406796, 699532, 707228, 36, 375450,
373302, 2148, 6971, 202, 138918, 68166, 70747, 5, 50910, 50629, 281, 43, 3249),
('13', 'THARAKA-NITHI', 393177, 193764, 199406, 7, 109860, 109450, 410, 2564, 153, 360434, 177716, 182712, 6,
97949, 97614, 335, 2539, 142, 32743, 16048, 16694, 1, 11911, 11836, 75, 25, 1316),
('14', 'EMBU', 608599, 304208, 304367, 24, 182743, 182427, 316, 2821, 216, 532675, 267126, 265534, 15, 154594,
154301, 293, 2778, 192, 75924, 37082, 38833, 9, 28149, 28126, 23, 42, 1800),
('15', 'KITUI', 1136187, 549003, 587151, 33, 262942, 261814, 1128, 30430, 37, 82168, 522943, 559193, 32, 243692,
242607, 1085, 30406, 36, 54019, 26060, 27958, 1, 19250, 19207, 43, 24, 2292),
('16', 'MACHAKOS', 1421932, 710707, 711191, 34, 402466, 399523, 2943, 6037, 236, 7854, 504247, 503582, 25,
259497, 256809, 2688, 5794, 174, 414078, 206460, 207609, 9, 142969, 142714, 255, 243, 1703),
('17', 'MAKUENI', 987653, 489691, 497942, 20, 244669, 243979, 690, 8177, 121, 910577, 450482, 460075, 20, 217610,
217052, 558, 8111, 112, 77076, 39209, 37867, 0, 27059, 26927, 132, 65, 1177),
('18', 'NYANDARUA', 638289, 315022, 323247, 20, 179686, 178224, 1462, 3286, 194, 571754, 282499, 289240, 15,
156437, 155007, 1430, 3241, 176, 66535, 32523, 34007, 5, 23249, 23217, 32, 45, 1473),
('19', 'NYERI', 759164, 374288, 384845, 31, 248050, 244564, 3486, 3325, 228, 608409, 300893, 307488, 28, 190313,
189091, 1222, 3243, 188, 150755, 73395, 77357, 3, 57737, 55473, 2264, 82, 1843),
('20', 'KIRINYAGA', 610411, 302011, 308369, 31, 204188, 203576, 612, 1478, 413, 474187, 237086, 237083, 18,
154644, 154255, 389, 1395, 340, 136224, 64925, 71286, 13, 49544, 49321, 223, 84, 1631),
('21', 'MURANG''A', 1056640, 523940, 532669, 31, 318105, 317496, 609, 2523, 419, 938213, 467062, 471121, 30,
276508, 276037, 471, 2452, 383, 118427, 56878, 61548, 1, 41597, 41459, 138, 71, 1678),
('22', 'KIAMBU', 2417735, 1187146, 1230454, 135, 795241, 792333, 2908, 2539, 952, 711450, 355557, 355866, 27,
207710, 207550, 160, 11101904, 401, 1706285, 831589, 874588, 108, 587531, 584783, 2748, 763, 2237),
('23', 'TURKANA', 926976, 478087, 448868, 21, 164519, 162627, 1892, 68233, 14, 786185, 406490, 379675, 20,
133899, 132634, 1265, 328924, 12, 140791, 71597, 69193, 1, 30620, 29993, 627, 234, 601),
('24', 'WEST POKOT', 621241, 307013, 314213, 15, 116182, 115761, 421, 9123, 68, 589400, 291469, 297916, 15,
107572, 107166, 406, 1251924, 65, 31841, 15544, 16297, 0, 8610, 8595, 15, 17, 1850),
('25', 'SAMBURU', 310327, 156774, 153546, 7, 65910, 63951, 1959, 21090, 15, 263195, 133058, 130130, 7, 53120,
51458, 1662, 12816, 13, 47132, 23716, 23416, 0, 12790, 12493, 297, 54, 869),
('26', 'TRANS NZOIA', 990341, 489107, 501206, 28, 223808, 222989, 819, 2495, 397, 811607, 400606, 410978, 23,
174249, 173578, 671, 2386, 340, 178734, 88501, 90228, 5, 49559, 49411, 148, 109, 1635),
('27', 'UASIN GISHU', 1163186, 580269, 582889, 28, 304943, 301110, 3833, 3399, 342, 652981, 326269, 326700, 12,
143434, 139957, 3477, 3093, 211, 510205, 254000, 256189, 16, 161509, 161153, 356, 305, 1670),
('28', 'ELGEYO/MARAKWET', 454480, 227317, 227151, 12, 99861, 99119, 742, 3032, 150, 433901, 217344, 216548, 9,
93720, 93023, 697, 3021, 144, 20579, 9973, 10603, 3, 6141, 6096, 45, 11, 1894),
('29', 'NANDI', 885711, 441259, 444430, 22, 199426, 199040, 386, 2849, 311, 826232, 411715, 414497, 20, 180826,
180511, 315, 2809, 294, 59479, 29544, 29933, 2, 18600, 18529, 71, 41, 1457),
('30', 'BARINGO', 666763, 336322, 330428, 13, 142518, 141877, 641, 10985, 61, 591474, 299456, 292006, 12, 119994,
119363, 631, 10923, 54, 75289, 36866, 38422, 1, 22524, 22514, 10, 62, 1218),
('31', 'LAIKIPIA', 518560, 259440, 259102, 18, 149271, 145776, 3495, 9508, 55, 391200, 196277, 194909, 14,
104463, 103022, 1441, 9359, 42, 127360, 63163, 64193, 4, 44808, 42754, 2054, 149, 857),
('32', 'NAKURU', 2162202, 1077272, 1084835, 95, 616046, 598237, 17809, 7505, 288, 115122, 559639, 555458, 25,
276259, 269525, 6734, 12121917, 170, 1047080, 517633, 529377, 70, 339787, 328712, 11075, 949, 1103),
('33', 'NAROK', 1157873, 579042, 578805, 26, 241125, 238115, 3010, 17932, 65, 57521, 529224, 528276, 21, 209185,
206285, 2900, 170884, 59, 100352, 49818, 50529, 5, 31940, 31830, 110, 48, 2095),
('34', 'KAJIADO', 1117840, 557098, 560704, 38, 316179, 313218, 2961, 21871, 51, 495218, 250233, 244970, 15,
108562, 106566, 1996, 517515, 23, 622622, 306865, 315734, 23, 207617, 206652, 965, 388, 1604),
('35', 'KERICHO', 901777, 450741, 451008, 28, 206036, 205932, 104, 2436, 370, 808239, 402717, 405500, 22, 175193,
175119, 74, 2394, 338, 93538, 48024, 45508, 6, 30843, 30813, 30, 43, 2197),
('36', 'BOMET', 875689, 434287, 441379, 23, 187641, 187230, 411, 2507, 349, 847718, 420119, 427577, 22, 178135,
177886, 249, 2496, 340, 27971, 14168, 13802, 1, 9506, 9344, 162, 11, 2536),
('37', 'KAKAMEGA', 1867579, 897133, 970406, 40, 433207, 432284, 923, 3017, 619, 682239, 806682, 875526, 31,
378386, 377604, 782, 2899, 580, 185340, 90451, 94880, 9, 54821, 54680, 141, 118, 1575),
('38', 'VIHIGA', 590013, 283678, 306323, 12, 143365, 143288, 77, 564, 1047, 531629, 255727, 275892, 10, 127476,
127400, 76, 537, 991, 58384, 27951, 30431, 2, 15889, 15888, 1, 27, 2152),
('39', 'BUNGOMA', 1670570, 812146, 858389, 35, 358796, 357714, 1082, 3024, 552, 480458, 720235, 760194, 29,
307981, 307149, 832, 2912, 508, 190112, 91911, 98195, 6, 50815, 50565, 250, 112, 1699),
('40', 'BUSIA', 893681, 426252, 467401, 28, 198152, 197944, 208, 1700, 526, 779928, 371289, 408611, 28, 167368,
167184, 184, 1654, 471, 113753, 54963, 58790, 0, 30784, 30760, 24, 45, 2508),
('41', 'SIAYA', 993183, 471669, 521496, 18, 250698, 249341, 1357, 2530, 393, 907766, 431450, 476301, 15, 225031,
224404, 627, 2480, 366, 85417, 40219, 45195, 3, 25667, 24937, 730, 50, 1721),
('42', 'KISUMU', 1155574, 560942, 594609, 23, 300745, 296846, 3899, 2085, 554, 714668, 344721, 369939, 8, 169013,
168796, 217, 1947, 367, 440906, 216221, 224670, 15, 131732, 128050, 3682, 139, 3177),
('43', 'HOMA BAY', 1131950, 539560, 592367, 23, 262036, 260290, 1746, 3153, 359, 18871, 485991, 532861, 19,
230012, 229176, 836, 3111, 327, 113079, 53569, 59506, 4, 32024, 31114, 910, 41, 2754),
('44', 'MIGORI', 1116436, 536187, 580214, 35, 240168, 238133, 2035, 2613, 427, 949236, 455887, 493318, 31,
197268, 195462, 1806, 2529, 375, 167200, 80300, 86896, 4, 42900, 42671, 229, 84, 1989),
('45', 'KISII', 1266860, 605784, 661038, 38, 308054, 307254, 800, 1323, 957, 115450, 531860, 583560, 30, 261837,
261383, 454, 1284, 869, 151410, 73924, 77478, 8, 46217, 45871, 346, 40, 3811),
('46', 'NYAMIRA', 605576, 290907, 314656, 13, 150669, 150499, 170, 897, 675, 558540, 268241, 290286, 13, 137621,
137451, 170, 876, 638, 47036, 22666, 24370, 0, 13048, 13048, 0, 21, 2210),
('47', 'NAIROBI CITY', 4397073, 2192452, 2204376, 245, 1506888, 1494676, 12212, 704, 6247, 0, 0, 0, 0, 0, 0, 0,
0, 0, 4397073, 2192452, 2204376, 245, 1506888, 1494676, 12212, 704, 6247);
COMMIT;
EOSQL
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3"
services:
db:
image: "postgres"
ports:
- "5432:5432"
volumes:
- "./db:/docker-entrypoint-initdb.d/"
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=password
- APP_DB_USER=docker
- APP_DB_PASS=docker
- APP_DB_NAME=census
server:
restart: always
build:
context: .
dockerfile: dockerfile.dev
ports:
- "3000:3000"
volumes:
- .:/usr/app/
depends_on:
- db
11 changes: 11 additions & 0 deletions dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:alpine

WORKDIR /usr/app

COPY ./package.json ./

RUN yarn

COPY ./public ./public

CMD ["yarn", "dev"]
15 changes: 0 additions & 15 deletions miner/Pipfile

This file was deleted.

Binary file removed miner/VOLUME-1-KPHC-2019.pdf
Binary file not shown.
124 changes: 0 additions & 124 deletions miner/counties.py

This file was deleted.

Binary file removed miner/data1.pdf
Binary file not shown.
6 changes: 0 additions & 6 deletions miner/main.py

This file was deleted.

27 changes: 0 additions & 27 deletions miner/subcounties.py

This file was deleted.

Loading

0 comments on commit 427bf1a

Please sign in to comment.