diff --git a/sql/agriculture_livestock.sql b/sql/agriculture_livestock.sql new file mode 100644 index 0000000..41edbc9 --- /dev/null +++ b/sql/agriculture_livestock.sql @@ -0,0 +1,586 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +SET search_path = public, pg_catalog; + + +ALTER TABLE IF EXISTS ONLY public.agriculture_livestock DROP CONSTRAINT IF EXISTS agriculture_livestock_pkey; +DROP TABLE IF EXISTS public.agriculture_livestock; + +SET search_path = public, pg_catalog; + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: agriculture_livestock; Type: TABLE; Schema: public; Tablespace: +-- + +CREATE TABLE agriculture_livestock ( + geo_level character varying(15) NOT NULL, + geo_code character varying(10) NOT NULL, + "livestock type" character varying(128) NOT NULL, + total integer NOT NULL +); + + +-- +-- Data for Name: agriculture_livestock; Type: TABLE DATA; Schema: public +-- + +COPY agriculture_livestock (geo_code, geo_level, "livestock type", total) FROM stdin WITH DELIMITER ','; +NP,country,CATTLE,7302808 +NP,country,BUFFALOES,5168809 +NP,country,SHEEP,800658 +NP,country,GOATS,10986114 +NP,country,PIGS,1291308 +NP,country,FOWL,68630638 +NP,country,DUCKS,392255 +01,district,CATTLE,54884 +01,district,BUFFALOES,17966 +01,district,SHEEP,5777 +01,district,GOATS,84720 +01,district,PIGS,27041 +01,district,FOWL,85364 +01,district,DUCKS,876 +02,district,CATTLE,105053 +02,district,BUFFALOES,42920 +02,district,SHEEP,1338 +02,district,GOATS,162033 +02,district,PIGS,44587 +02,district,FOWL,354325 +02,district,DUCKS,805 +03,district,CATTLE,146640 +03,district,BUFFALOES,22731 +03,district,SHEEP,160 +03,district,GOATS,150063 +03,district,PIGS,25400 +03,district,FOWL,148783 +03,district,DUCKS,723 +04,district,CATTLE,255075 +04,district,BUFFALOES,73207 +04,district,SHEEP,36 +04,district,GOATS,256414 +04,district,PIGS,68056 +04,district,FOWL,1105798 +04,district,DUCKS,14474 +05,district,CATTLE,122976 +05,district,BUFFALOES,48712 +05,district,SHEEP,12181 +05,district,GOATS,162965 +05,district,PIGS,31091 +05,district,FOWL,430621 +05,district,DUCKS,1012 +06,district,CATTLE,99444 +06,district,BUFFALOES,88865 +06,district,SHEEP,18210 +06,district,GOATS,91987 +06,district,PIGS,47195 +06,district,FOWL,299760 +06,district,DUCKS,3875 +07,district,CATTLE,94711 +07,district,BUFFALOES,20422 +07,district,SHEEP,577 +07,district,GOATS,178274 +07,district,PIGS,28190 +07,district,FOWL,671543 +07,district,DUCKS,3534 +08,district,CATTLE,91550 +08,district,BUFFALOES,46915 +08,district,SHEEP,7083 +08,district,GOATS,115000 +08,district,PIGS,29655 +08,district,FOWL,144610 +08,district,DUCKS,1119 +09,district,CATTLE,399725 +09,district,BUFFALOES,104582 +09,district,SHEEP,490 +09,district,GOATS,277959 +09,district,PIGS,52560 +09,district,FOWL,1870338 +09,district,DUCKS,56460 +10,district,CATTLE,285225 +10,district,BUFFALOES,139896 +10,district,SHEEP,3658 +10,district,GOATS,232151 +10,district,PIGS,55540 +10,district,FOWL,1136374 +10,district,DUCKS,15932 +11,district,CATTLE,55294 +11,district,BUFFALOES,45669 +11,district,SHEEP,8461 +11,district,GOATS,86385 +11,district,PIGS,26148 +11,district,FOWL,237061 +11,district,DUCKS,815 +12,district,CATTLE,52593 +12,district,BUFFALOES,44293 +12,district,SHEEP,9105 +12,district,GOATS,117056 +12,district,PIGS,45846 +12,district,FOWL,329690 +12,district,DUCKS,742 +13,district,CATTLE,91445 +13,district,BUFFALOES,61900 +13,district,SHEEP,9156 +13,district,GOATS,123556 +13,district,PIGS,47235 +13,district,FOWL,279286 +13,district,DUCKS,1905 +14,district,CATTLE,115562 +14,district,BUFFALOES,99007 +14,district,SHEEP,609 +14,district,GOATS,246617 +14,district,PIGS,49928 +14,district,FOWL,824036 +14,district,DUCKS,3205 +15,district,CATTLE,224252 +15,district,BUFFALOES,179010 +15,district,SHEEP,2033 +15,district,GOATS,199697 +15,district,PIGS,21966 +15,district,FOWL,883064 +15,district,DUCKS,29345 +16,district,CATTLE,87935 +16,district,BUFFALOES,89943 +16,district,SHEEP,941 +16,district,GOATS,221793 +16,district,PIGS,5130 +16,district,FOWL,1091314 +16,district,DUCKS,8987 +17,district,CATTLE,81777 +17,district,BUFFALOES,52293 +17,district,SHEEP,11809 +17,district,GOATS,155992 +17,district,PIGS,12436 +17,district,FOWL,374798 +17,district,DUCKS,4271 +18,district,CATTLE,85972 +18,district,BUFFALOES,68391 +18,district,SHEEP,3763 +18,district,GOATS,163509 +18,district,PIGS,16699 +18,district,FOWL,395816 +18,district,DUCKS,690 +19,district,CATTLE,125775 +19,district,BUFFALOES,61822 +19,district,SHEEP,315 +19,district,GOATS,225080 +19,district,PIGS,22376 +19,district,FOWL,569000 +19,district,DUCKS,4926 +20,district,CATTLE,139786 +20,district,BUFFALOES,75103 +20,district,SHEEP,650 +20,district,GOATS,200733 +20,district,PIGS,5796 +20,district,FOWL,577645 +20,district,DUCKS,8447 +21,district,CATTLE,119233 +21,district,BUFFALOES,70190 +21,district,SHEEP,641 +21,district,GOATS,154703 +21,district,PIGS,12703 +21,district,FOWL,677748 +21,district,DUCKS,6705 +22,district,CATTLE,135862 +22,district,BUFFALOES,85152 +22,district,SHEEP,1187 +22,district,GOATS,186277 +22,district,PIGS,8445 +22,district,FOWL,1175518 +22,district,DUCKS,9535 +23,district,CATTLE,50797 +23,district,BUFFALOES,64020 +23,district,SHEEP,7956 +23,district,GOATS,180443 +23,district,PIGS,8233 +23,district,FOWL,841890 +23,district,DUCKS,2574 +24,district,CATTLE,139104 +24,district,BUFFALOES,131190 +24,district,SHEEP,3746 +24,district,GOATS,296254 +24,district,PIGS,15669 +24,district,FOWL,4337999 +24,district,DUCKS,2630 +25,district,CATTLE,24058 +25,district,BUFFALOES,8197 +25,district,SHEEP,2588 +25,district,GOATS,30120 +25,district,PIGS,12934 +25,district,FOWL,2143933 +25,district,DUCKS,5918 +26,district,CATTLE,23471 +26,district,BUFFALOES,32834 +26,district,SHEEP,2164 +26,district,GOATS,80713 +26,district,PIGS,8658 +26,district,FOWL,1485522 +26,district,DUCKS,3699 +27,district,CATTLE,46484 +27,district,BUFFALOES,32397 +27,district,SHEEP,3075 +27,district,GOATS,45932 +27,district,PIGS,18981 +27,district,FOWL,2859396 +27,district,DUCKS,4753 +28,district,CATTLE,14357 +28,district,BUFFALOES,6652 +28,district,SHEEP,5335 +28,district,GOATS,34062 +28,district,PIGS,1112 +28,district,FOWL,73705 +28,district,DUCKS,598 +29,district,CATTLE,149937 +29,district,BUFFALOES,153518 +29,district,SHEEP,19741 +29,district,GOATS,264200 +29,district,PIGS,8395 +29,district,FOWL,1626429 +29,district,DUCKS,6140 +30,district,CATTLE,138882 +30,district,BUFFALOES,124591 +30,district,SHEEP,8807 +30,district,GOATS,181620 +30,district,PIGS,23671 +30,district,FOWL,3359437 +30,district,DUCKS,7775 +31,district,CATTLE,116431 +31,district,BUFFALOES,80132 +31,district,SHEEP,917 +31,district,GOATS,154145 +31,district,PIGS,9338 +31,district,FOWL,645028 +31,district,DUCKS,7939 +32,district,CATTLE,132748 +32,district,BUFFALOES,150189 +32,district,SHEEP,336 +32,district,GOATS,170762 +32,district,PIGS,21730 +32,district,FOWL,1346828 +32,district,DUCKS,17923 +33,district,CATTLE,74675 +33,district,BUFFALOES,49806 +33,district,SHEEP,144 +33,district,GOATS,117929 +33,district,PIGS,11908 +33,district,FOWL,644694 +33,district,DUCKS,7558 +34,district,CATTLE,121228 +34,district,BUFFALOES,106074 +34,district,SHEEP,52 +34,district,GOATS,236688 +34,district,PIGS,14487 +34,district,FOWL,1127481 +34,district,DUCKS,1343 +35,district,CATTLE,91469 +35,district,BUFFALOES,68809 +35,district,SHEEP,3900 +35,district,GOATS,213968 +35,district,PIGS,10595 +35,district,FOWL,15284657 +35,district,DUCKS,4362 +36,district,CATTLE,88508 +36,district,BUFFALOES,80560 +36,district,SHEEP,29760 +36,district,GOATS,140508 +36,district,PIGS,12025 +36,district,FOWL,436320 +36,district,DUCKS,925 +37,district,CATTLE,27486 +37,district,BUFFALOES,41903 +37,district,SHEEP,15961 +37,district,GOATS,115731 +37,district,PIGS,6796 +37,district,FOWL,262200 +37,district,DUCKS,830 +38,district,CATTLE,92919 +38,district,BUFFALOES,116659 +38,district,SHEEP,548 +38,district,GOATS,193385 +38,district,PIGS,9274 +38,district,FOWL,506228 +38,district,DUCKS,1229 +39,district,CATTLE,3197 +39,district,BUFFALOES,0 +39,district,SHEEP,5693 +39,district,GOATS,9611 +39,district,PIGS,141 +39,district,FOWL,11570 +39,district,DUCKS,17 +40,district,CATTLE,45040 +40,district,BUFFALOES,142393 +40,district,SHEEP,16417 +40,district,GOATS,112391 +40,district,PIGS,13094 +40,district,FOWL,2510164 +40,district,DUCKS,11362 +41,district,CATTLE,39342 +41,district,BUFFALOES,94008 +41,district,SHEEP,2401 +41,district,GOATS,194650 +41,district,PIGS,15461 +41,district,FOWL,649713 +41,district,DUCKS,6280 +42,district,CATTLE,172441 +42,district,BUFFALOES,107815 +42,district,SHEEP,11128 +42,district,GOATS,244996 +42,district,PIGS,15155 +42,district,FOWL,2214749 +42,district,DUCKS,24166 +43,district,CATTLE,74075 +43,district,BUFFALOES,89729 +43,district,SHEEP,2654 +43,district,GOATS,179892 +43,district,PIGS,18605 +43,district,FOWL,536720 +43,district,DUCKS,4258 +44,district,CATTLE,104372 +44,district,BUFFALOES,145463 +44,district,SHEEP,4525 +44,district,GOATS,232133 +44,district,PIGS,15467 +44,district,FOWL,461296 +44,district,DUCKS,23583 +45,district,CATTLE,47453 +45,district,BUFFALOES,44479 +45,district,SHEEP,6942 +45,district,GOATS,144852 +45,district,PIGS,9795 +45,district,FOWL,186539 +45,district,DUCKS,579 +46,district,CATTLE,41820 +46,district,BUFFALOES,104917 +46,district,SHEEP,496 +46,district,GOATS,110085 +46,district,PIGS,2642 +46,district,FOWL,432910 +46,district,DUCKS,364 +47,district,CATTLE,135336 +47,district,BUFFALOES,160445 +47,district,SHEEP,18680 +47,district,GOATS,201968 +47,district,PIGS,5522 +47,district,FOWL,728660 +47,district,DUCKS,6032 +48,district,CATTLE,7843 +48,district,BUFFALOES,187 +48,district,SHEEP,6564 +48,district,GOATS,33925 +48,district,PIGS,45 +48,district,FOWL,8267 +48,district,DUCKS,7 +49,district,CATTLE,40924 +49,district,BUFFALOES,31865 +49,district,SHEEP,9978 +49,district,GOATS,81214 +49,district,PIGS,6500 +49,district,FOWL,178017 +49,district,DUCKS,1090 +50,district,CATTLE,43639 +50,district,BUFFALOES,36443 +50,district,SHEEP,5491 +50,district,GOATS,40660 +50,district,PIGS,12964 +50,district,FOWL,256828 +50,district,DUCKS,17718 +51,district,CATTLE,50662 +51,district,BUFFALOES,79620 +51,district,SHEEP,6851 +51,district,GOATS,99457 +51,district,PIGS,6644 +51,district,FOWL,319571 +51,district,DUCKS,2980 +52,district,CATTLE,20388 +52,district,BUFFALOES,2808 +52,district,SHEEP,33343 +52,district,GOATS,63860 +52,district,PIGS,120 +52,district,FOWL,9478 +52,district,DUCKS,73 +53,district,CATTLE,37500 +53,district,BUFFALOES,9712 +53,district,SHEEP,45027 +53,district,GOATS,47868 +53,district,PIGS,89 +53,district,FOWL,29072 +53,district,DUCKS,73 +54,district,CATTLE,65509 +54,district,BUFFALOES,2596 +54,district,SHEEP,72530 +54,district,GOATS,41591 +54,district,PIGS,990 +54,district,FOWL,14474 +54,district,DUCKS,659 +55,district,CATTLE,22935 +55,district,BUFFALOES,19230 +55,district,SHEEP,30732 +55,district,GOATS,54030 +55,district,PIGS,1378 +55,district,FOWL,49316 +55,district,DUCKS,187 +56,district,CATTLE,14693 +56,district,BUFFALOES,1879 +56,district,SHEEP,28642 +56,district,GOATS,58337 +56,district,PIGS,144 +56,district,FOWL,15749 +56,district,DUCKS,120 +57,district,CATTLE,34723 +57,district,BUFFALOES,54781 +57,district,SHEEP,28883 +57,district,GOATS,130991 +57,district,PIGS,23768 +57,district,FOWL,418230 +57,district,DUCKS,3142 +58,district,CATTLE,102795 +58,district,BUFFALOES,53446 +58,district,SHEEP,15687 +58,district,GOATS,138892 +58,district,PIGS,24511 +58,district,FOWL,222736 +58,district,DUCKS,198 +59,district,CATTLE,74190 +59,district,BUFFALOES,69588 +59,district,SHEEP,14667 +59,district,GOATS,136543 +59,district,PIGS,11762 +59,district,FOWL,619318 +59,district,DUCKS,78 +60,district,CATTLE,130177 +60,district,BUFFALOES,120767 +60,district,SHEEP,34091 +60,district,GOATS,237444 +60,district,PIGS,41445 +60,district,FOWL,2285270 +60,district,DUCKS,8514 +61,district,CATTLE,152514 +61,district,BUFFALOES,74162 +61,district,SHEEP,17764 +61,district,GOATS,162103 +61,district,PIGS,15185 +61,district,FOWL,135265 +61,district,DUCKS,2077 +62,district,CATTLE,41441 +62,district,BUFFALOES,34476 +62,district,SHEEP,24675 +62,district,GOATS,106356 +62,district,PIGS,2841 +62,district,FOWL,81049 +62,district,DUCKS,198 +63,district,CATTLE,121661 +63,district,BUFFALOES,99797 +63,district,SHEEP,14774 +63,district,GOATS,171633 +63,district,PIGS,12352 +63,district,FOWL,239000 +63,district,DUCKS,701 +64,district,CATTLE,122274 +64,district,BUFFALOES,35290 +64,district,SHEEP,11608 +64,district,GOATS,233737 +64,district,PIGS,21521 +64,district,FOWL,618099 +64,district,DUCKS,4750 +65,district,CATTLE,128879 +65,district,BUFFALOES,137126 +65,district,SHEEP,11609 +65,district,GOATS,189743 +65,district,PIGS,37828 +65,district,FOWL,1080601 +65,district,DUCKS,2180 +66,district,CATTLE,112817 +66,district,BUFFALOES,109668 +66,district,SHEEP,13025 +66,district,GOATS,199438 +66,district,PIGS,37222 +66,district,FOWL,686310 +66,district,DUCKS,2672 +67,district,CATTLE,85002 +67,district,BUFFALOES,20962 +67,district,SHEEP,19672 +67,district,GOATS,77718 +67,district,PIGS,1604 +67,district,FOWL,54691 +67,district,DUCKS,432 +68,district,CATTLE,40989 +68,district,BUFFALOES,39322 +68,district,SHEEP,3085 +68,district,GOATS,122431 +68,district,PIGS,394 +68,district,FOWL,67201 +68,district,DUCKS,313 +69,district,CATTLE,139857 +69,district,BUFFALOES,32966 +69,district,SHEEP,26452 +69,district,GOATS,98558 +69,district,PIGS,2046 +69,district,FOWL,49539 +69,district,DUCKS,409 +70,district,CATTLE,123139 +70,district,BUFFALOES,48102 +70,district,SHEEP,662 +70,district,GOATS,144896 +70,district,PIGS,2471 +70,district,FOWL,127770 +70,district,DUCKS,174 +71,district,CATTLE,196305 +71,district,BUFFALOES,155695 +71,district,SHEEP,21267 +71,district,GOATS,158293 +71,district,PIGS,28613 +71,district,FOWL,1541163 +71,district,DUCKS,7431 +72,district,CATTLE,68474 +72,district,BUFFALOES,32423 +72,district,SHEEP,22861 +72,district,GOATS,75332 +72,district,PIGS,552 +72,district,FOWL,37348 +72,district,DUCKS,220 +73,district,CATTLE,124533 +73,district,BUFFALOES,54071 +73,district,SHEEP,304 +73,district,GOATS,125803 +73,district,PIGS,750 +73,district,FOWL,19496 +73,district,DUCKS,234 +74,district,CATTLE,89943 +74,district,BUFFALOES,23135 +74,district,SHEEP,315 +74,district,GOATS,141919 +74,district,PIGS,1749 +74,district,FOWL,56284 +74,district,DUCKS,205 +75,district,CATTLE,142603 +75,district,BUFFALOES,112923 +75,district,SHEEP,7953 +75,district,GOATS,133340 +75,district,PIGS,22109 +75,district,FOWL,1033936 +75,district,DUCKS,4200 +\. + + +-- +-- Name: agriculture_livestock_pkey; Type: CONSTRAINT; Schema: public; Tablespace: +-- + +ALTER TABLE ONLY agriculture_livestock + ADD CONSTRAINT agriculture_livestock_pkey PRIMARY KEY (geo_level, geo_code, "livestock type"); + + +-- +-- PostgreSQL database dump complete +-- diff --git a/sql/agriculture_meat.sql b/sql/agriculture_meat.sql index 2611625..48d8f88 100644 --- a/sql/agriculture_meat.sql +++ b/sql/agriculture_meat.sql @@ -28,7 +28,7 @@ SET default_with_oids = false; CREATE TABLE agriculture_meat ( geo_level character varying(15) NOT NULL, geo_code character varying(10) NOT NULL, - meattype character varying(128) NOT NULL, + "meat type" character varying(128) NOT NULL, total integer NOT NULL ); @@ -37,539 +37,463 @@ CREATE TABLE agriculture_meat ( -- Data for Name: agriculture_meat; Type: TABLE DATA; Schema: public -- -COPY agriculture_meat (geo_code, geo_level, meattype, total) FROM stdin WITH DELIMITER ','; +COPY agriculture_meat (geo_code, geo_level, "meat type", total) FROM stdin WITH DELIMITER ','; NP,country,BUFF,175005 NP,country,MUTTON,2684 NP,country,CHEVON,65583 NP,country,PORK,23509 NP,country,CHICKEN,55041 NP,country,DUCK,237 -NP,country,TOTAL,322059 01,district,BUFF,607 01,district,MUTTON,31 01,district,CHEVON,491 01,district,PORK,443 01,district,CHICKEN,172 01,district,DUCK,0 -01,district,TOTAL,1744 05,district,BUFF,1646 05,district,MUTTON,41 05,district,CHEVON,958 05,district,PORK,509 05,district,CHICKEN,302 05,district,DUCK,1 -05,district,TOTAL,3457 11,district,BUFF,1123 11,district,MUTTON,28 11,district,CHEVON,416 11,district,PORK,428 11,district,CHICKEN,166 11,district,DUCK,0 -11,district,TOTAL,2161 02,district,BUFF,1496 02,district,MUTTON,4 02,district,CHEVON,940 02,district,PORK,730 02,district,CHICKEN,248 02,district,DUCK,1 -02,district,TOTAL,3419 03,district,BUFF,1974 03,district,MUTTON,1 03,district,CHEVON,870 03,district,PORK,416 03,district,CHICKEN,104 03,district,DUCK,0 -03,district,TOTAL,3365 08,district,BUFF,2358 08,district,MUTTON,24 08,district,CHEVON,399 08,district,PORK,486 08,district,CHICKEN,116 08,district,DUCK,1 -08,district,TOTAL,3384 07,district,BUFF,1521 07,district,MUTTON,2 07,district,CHEVON,405 07,district,PORK,462 07,district,CHICKEN,471 07,district,DUCK,2 -07,district,TOTAL,2863 06,district,BUFF,1251 06,district,MUTTON,51 06,district,CHEVON,313 06,district,PORK,919 06,district,CHICKEN,251 06,district,DUCK,2 -06,district,TOTAL,2787 13,district,BUFF,1997 13,district,MUTTON,31 13,district,CHEVON,442 13,district,PORK,705 13,district,CHICKEN,310 13,district,DUCK,1 -13,district,TOTAL,3486 12,district,BUFF,1497 12,district,MUTTON,31 12,district,CHEVON,685 12,district,PORK,751 12,district,CHICKEN,294 12,district,DUCK,0 -12,district,TOTAL,3258 14,district,BUFF,3346 14,district,MUTTON,2 14,district,CHEVON,1430 14,district,PORK,818 14,district,CHICKEN,578 14,district,DUCK,2 -14,district,TOTAL,6176 04,district,BUFF,5241 04,district,MUTTON,0 04,district,CHEVON,1447 04,district,PORK,1115 04,district,CHICKEN,1425 04,district,DUCK,9 -04,district,TOTAL,9237 09,district,BUFF,5347 09,district,MUTTON,1 09,district,CHEVON,1678 09,district,PORK,861 09,district,CHICKEN,1444 09,district,DUCK,28 -09,district,TOTAL,9359 10,district,BUFF,4728 10,district,MUTTON,12 10,district,CHEVON,1769 10,district,PORK,884 10,district,CHICKEN,820 10,district,DUCK,23 -10,district,TOTAL,8236 15,district,BUFF,3867 15,district,MUTTON,7 15,district,CHEVON,2200 15,district,PORK,360 15,district,CHICKEN,1301 15,district,DUCK,15 -15,district,TOTAL,7750 16,district,BUFF,3221 16,district,MUTTON,3 16,district,CHEVON,1286 16,district,PORK,308 16,district,CHICKEN,809 16,district,DUCK,4 -16,district,TOTAL,5631 17,district,BUFF,1704 17,district,MUTTON,40 17,district,CHEVON,576 17,district,PORK,117 17,district,CHICKEN,210 17,district,DUCK,2 -17,district,TOTAL,2649 23,district,BUFF,2457 23,district,MUTTON,27 23,district,CHEVON,1047 23,district,PORK,209 23,district,CHICKEN,784 23,district,DUCK,1 -23,district,TOTAL,4525 28,district,BUFF,325 28,district,MUTTON,18 28,district,CHEVON,198 28,district,PORK,18 28,district,CHICKEN,52 28,district,DUCK,0 -28,district,TOTAL,611 18,district,BUFF,2311 18,district,MUTTON,11 18,district,CHEVON,726 18,district,PORK,213 18,district,CHICKEN,278 18,district,DUCK,0 -18,district,TOTAL,3539 19,district,BUFF,2089 19,district,MUTTON,2 19,district,CHEVON,1003 19,district,PORK,367 19,district,CHICKEN,792 19,district,DUCK,2 -19,district,TOTAL,4255 24,district,BUFF,4434 24,district,MUTTON,16 24,district,CHEVON,1418 24,district,PORK,257 24,district,CHICKEN,1649 24,district,DUCK,1 -24,district,TOTAL,7775 25,district,BUFF,1013 25,district,MUTTON,9 25,district,CHEVON,175 25,district,PORK,212 25,district,CHICKEN,647 25,district,DUCK,3 -25,district,TOTAL,2059 26,district,BUFF,1109 26,district,MUTTON,7 26,district,CHEVON,468 26,district,PORK,142 26,district,CHICKEN,1953 26,district,DUCK,2 -26,district,TOTAL,3681 27,district,BUFF,2289 27,district,MUTTON,10 27,district,CHEVON,801 27,district,PORK,292 27,district,CHICKEN,2294 27,district,DUCK,2 -27,district,TOTAL,5688 29,district,BUFF,4160 29,district,MUTTON,66 29,district,CHEVON,700 29,district,PORK,285 29,district,CHICKEN,1140 29,district,DUCK,3 -29,district,TOTAL,6354 30,district,BUFF,3105 30,district,MUTTON,16 30,district,CHEVON,314 30,district,PORK,415 30,district,CHICKEN,2965 30,district,DUCK,4 -30,district,TOTAL,6819 34,district,BUFF,2795 34,district,MUTTON,10 34,district,CHEVON,1172 34,district,PORK,162 34,district,CHICKEN,2405 34,district,DUCK,1 -34,district,TOTAL,6545 20,district,BUFF,2538 20,district,MUTTON,2 20,district,CHEVON,1566 20,district,PORK,95 20,district,CHICKEN,514 20,district,DUCK,6 -20,district,TOTAL,4721 21,district,BUFF,2578 21,district,MUTTON,2 21,district,CHEVON,781 21,district,PORK,208 21,district,CHICKEN,561 21,district,DUCK,4 -21,district,TOTAL,4134 22,district,BUFF,2779 22,district,MUTTON,3 22,district,CHEVON,1080 22,district,PORK,138 22,district,CHICKEN,825 22,district,DUCK,5 -22,district,TOTAL,4830 31,district,BUFF,2672 31,district,MUTTON,3 31,district,CHEVON,984 31,district,PORK,153 31,district,CHICKEN,452 31,district,DUCK,4 -31,district,TOTAL,4268 32,district,BUFF,4076 32,district,MUTTON,1 32,district,CHEVON,1205 32,district,PORK,356 32,district,CHICKEN,945 32,district,DUCK,10 -32,district,TOTAL,6593 33,district,BUFF,2260 33,district,MUTTON,0 33,district,CHEVON,910 33,district,PORK,195 33,district,CHICKEN,452 33,district,DUCK,4 -33,district,TOTAL,3821 35,district,BUFF,5550 35,district,MUTTON,13 35,district,CHEVON,1769 35,district,PORK,598 35,district,CHICKEN,9810 35,district,DUCK,13 -35,district,TOTAL,17753 39,district,BUFF,0 39,district,MUTTON,12 39,district,CHEVON,56 39,district,PORK,2 39,district,CHICKEN,8 39,district,DUCK,0 -39,district,TOTAL,78 48,district,BUFF,6 48,district,MUTTON,22 48,district,CHEVON,139 48,district,PORK,1 48,district,CHICKEN,5 48,district,DUCK,0 -48,district,TOTAL,173 36,district,BUFF,3147 36,district,MUTTON,100 36,district,CHEVON,815 36,district,PORK,197 36,district,CHICKEN,691 36,district,DUCK,1 -36,district,TOTAL,4951 37,district,BUFF,1416 37,district,MUTTON,54 37,district,CHEVON,621 37,district,PORK,111 37,district,CHICKEN,504 37,district,DUCK,1 -37,district,TOTAL,2707 38,district,BUFF,3347 38,district,MUTTON,2 38,district,CHEVON,752 38,district,PORK,152 38,district,CHICKEN,225 38,district,DUCK,1 -38,district,TOTAL,4479 40,district,BUFF,4583 40,district,MUTTON,117 40,district,CHEVON,839 40,district,PORK,659 40,district,CHICKEN,1738 40,district,DUCK,19 -40,district,TOTAL,7955 50,district,BUFF,1231 50,district,MUTTON,18 50,district,CHEVON,374 50,district,PORK,212 50,district,CHICKEN,280 50,district,DUCK,9 -50,district,TOTAL,2124 41,district,BUFF,3177 41,district,MUTTON,40 41,district,CHEVON,1129 41,district,PORK,253 41,district,CHICKEN,456 41,district,DUCK,3 -41,district,TOTAL,5058 43,district,BUFF,2514 43,district,MUTTON,7 43,district,CHEVON,1043 43,district,PORK,305 43,district,CHICKEN,376 43,district,DUCK,2 -43,district,TOTAL,4247 49,district,BUFF,1256 49,district,MUTTON,40 49,district,CHEVON,385 49,district,PORK,1106 49,district,CHICKEN,405 49,district,DUCK,1 -49,district,TOTAL,3193 51,district,BUFF,2124 51,district,MUTTON,19 51,district,CHEVON,578 51,district,PORK,109 51,district,CHICKEN,297 51,district,DUCK,1 -51,district,TOTAL,3128 45,district,BUFF,1446 45,district,MUTTON,23 45,district,CHEVON,821 45,district,PORK,160 45,district,CHICKEN,273 45,district,DUCK,0 -45,district,TOTAL,2723 46,district,BUFF,3246 46,district,MUTTON,2 46,district,CHEVON,638 46,district,PORK,42 46,district,CHICKEN,303 46,district,DUCK,0 -46,district,TOTAL,4231 42,district,BUFF,3644 42,district,MUTTON,27 42,district,CHEVON,1455 42,district,PORK,348 42,district,CHICKEN,1665 42,district,DUCK,12 -42,district,TOTAL,7151 44,district,BUFF,4916 44,district,MUTTON,15 44,district,CHEVON,1724 44,district,PORK,355 44,district,CHICKEN,1677 44,district,DUCK,12 -44,district,TOTAL,8699 47,district,BUFF,4423 47,district,MUTTON,63 47,district,CHEVON,1171 47,district,PORK,115 47,district,CHICKEN,511 47,district,DUCK,3 -47,district,TOTAL,6286 52,district,BUFF,74 52,district,MUTTON,112 52,district,CHEVON,270 52,district,PORK,2 52,district,CHICKEN,7 52,district,DUCK,0 -52,district,TOTAL,465 53,district,BUFF,328 53,district,MUTTON,151 53,district,CHEVON,142 53,district,PORK,1 53,district,CHICKEN,20 53,district,DUCK,0 -53,district,TOTAL,642 56,district,BUFF,64 56,district,MUTTON,96 56,district,CHEVON,125 56,district,PORK,2 56,district,CHICKEN,10 56,district,DUCK,0 -56,district,TOTAL,297 54,district,BUFF,106 54,district,MUTTON,240 54,district,CHEVON,202 54,district,PORK,16 54,district,CHICKEN,29 54,district,DUCK,0 -54,district,TOTAL,593 55,district,BUFF,649 55,district,MUTTON,103 55,district,CHEVON,277 55,district,PORK,3 55,district,CHICKEN,24 55,district,DUCK,0 -55,district,TOTAL,1056 57,district,BUFF,1654 57,district,MUTTON,47 57,district,CHEVON,760 57,district,PORK,389 57,district,CHICKEN,293 57,district,DUCK,1 -57,district,TOTAL,3144 58,district,BUFF,1492 58,district,MUTTON,50 58,district,CHEVON,806 58,district,PORK,401 58,district,CHICKEN,219 58,district,DUCK,0 -58,district,TOTAL,2968 59,district,BUFF,1594 59,district,MUTTON,55 59,district,CHEVON,522 59,district,PORK,245 59,district,CHICKEN,465 59,district,DUCK,0 -59,district,TOTAL,2881 61,district,BUFF,3206 61,district,MUTTON,60 61,district,CHEVON,833 61,district,PORK,245 61,district,CHICKEN,265 61,district,DUCK,1 -61,district,TOTAL,4610 62,district,BUFF,975 62,district,MUTTON,83 62,district,CHEVON,617 62,district,PORK,47 62,district,CHICKEN,203 62,district,DUCK,0 -62,district,TOTAL,1925 63,district,BUFF,2145 63,district,MUTTON,50 63,district,CHEVON,578 63,district,PORK,142 63,district,CHICKEN,167 63,district,DUCK,0 -63,district,TOTAL,3082 64,district,BUFF,2456 64,district,MUTTON,24 64,district,CHEVON,1634 64,district,PORK,368 64,district,CHICKEN,789 64,district,DUCK,2 -64,district,TOTAL,5273 60,district,BUFF,3507 60,district,MUTTON,115 60,district,CHEVON,3352 60,district,PORK,679 60,district,CHICKEN,1604 60,district,DUCK,4 -60,district,TOTAL,9261 65,district,BUFF,3256 65,district,MUTTON,42 65,district,CHEVON,1652 65,district,PORK,620 65,district,CHICKEN,785 65,district,DUCK,1 -65,district,TOTAL,6356 66,district,BUFF,3405 66,district,MUTTON,35 66,district,CHEVON,1758 66,district,PORK,610 66,district,CHICKEN,474 66,district,DUCK,1 -66,district,TOTAL,6283 67,district,BUFF,708 67,district,MUTTON,66 67,district,CHEVON,451 67,district,PORK,26 67,district,CHICKEN,38 67,district,DUCK,0 -67,district,TOTAL,1289 69,district,BUFF,1208 69,district,MUTTON,89 69,district,CHEVON,572 69,district,PORK,34 69,district,CHICKEN,40 69,district,DUCK,0 -69,district,TOTAL,1943 72,district,BUFF,768 72,district,MUTTON,68 72,district,CHEVON,437 72,district,PORK,9 72,district,CHICKEN,31 72,district,DUCK,0 -72,district,TOTAL,1313 68,district,BUFF,1329 68,district,MUTTON,10 68,district,CHEVON,710 68,district,PORK,6 68,district,CHICKEN,47 68,district,DUCK,0 -68,district,TOTAL,2102 70,district,BUFF,1625 70,district,MUTTON,2 70,district,CHEVON,840 70,district,PORK,40 70,district,CHICKEN,106 70,district,DUCK,0 -70,district,TOTAL,2613 73,district,BUFF,1727 73,district,MUTTON,1 73,district,CHEVON,730 73,district,PORK,12 73,district,CHICKEN,14 73,district,DUCK,0 -73,district,TOTAL,2484 74,district,BUFF,1011 74,district,MUTTON,1 74,district,CHEVON,823 74,district,PORK,29 74,district,CHICKEN,70 74,district,DUCK,0 -74,district,TOTAL,1934 71,district,BUFF,5962 71,district,MUTTON,71 71,district,CHEVON,1480 71,district,PORK,469 71,district,CHICKEN,1303 71,district,DUCK,4 -71,district,TOTAL,9289 75,district,BUFF,3816 75,district,MUTTON,27 75,district,CHEVON,850 75,district,PORK,360 75,district,CHICKEN,1085 75,district,DUCK,2 -75,district,TOTAL,6140 \. @@ -578,7 +502,7 @@ NP,country,TOTAL,322059 -- ALTER TABLE ONLY agriculture_meat - ADD CONSTRAINT agriculture_meat_pkey PRIMARY KEY (geo_level, geo_code, meattype); + ADD CONSTRAINT agriculture_meat_pkey PRIMARY KEY (geo_level, geo_code, "meat type"); -- diff --git a/wazimap_np/agriculture.py b/wazimap_np/agriculture.py new file mode 100644 index 0000000..2fbb917 --- /dev/null +++ b/wazimap_np/agriculture.py @@ -0,0 +1,57 @@ +from collections import OrderedDict + +from wazimap.data.utils import get_stat_data + +MEAT_RECODES = OrderedDict([ + ('BUFF', 'Water Buffalo'), + ('CHEVON', 'Goat'), + ('CHICKEN', 'Chicken'), + ('DUCK', 'Duck'), + ('MUTTON', 'Mutton'), + ('PORK', 'Pork') +]) + +LIVESTOCK_RECODES = OrderedDict([ + ('BUFFALOES', 'Water Buffalo'), + ('CATTLE', 'Cattle'), + ('DUCKS', 'Ducks'), + ('FOWL', 'Fowl'), + ('GOATS', 'Goats'), + ('PIGS', 'Pigs'), + ('SHEEP', 'Sheep') +]) + + +def get_agriculture_profile(geo_code, geo_level, session): + agriculture_data = {'area_has_data': False} + + if geo_level != 'vdc': + + meat_dist, total_meat = get_stat_data( + 'meat type', geo_level, geo_code, session, + recode=dict(MEAT_RECODES), + percent=False, + order_by='-total') + + livestock_dist, total_livestock = get_stat_data( + 'livestock type', geo_level, geo_code, session, + recode=dict(LIVESTOCK_RECODES), + percent=False, + order_by='-total') + + agriculture_data = dict( + is_vdc=False, + area_has_data=True, + meat_distribution=meat_dist, + total_meat={ + 'name': 'Metric tons of meat produced', + 'values': {'this': total_meat} + }, + livestock_distribution=livestock_dist, + total_livestock={ + 'name': 'Number of livestock', + 'values': {'this': total_livestock} + }, + ) + + return agriculture_data diff --git a/wazimap_np/profiles.py b/wazimap_np/profiles.py index 4cfb8f6..f33da29 100644 --- a/wazimap_np/profiles.py +++ b/wazimap_np/profiles.py @@ -2,6 +2,7 @@ from wazimap.geo import geo_data from wazimap_np import ( + agriculture, business, demographics, development, @@ -17,15 +18,16 @@ # ensure tables are loaded PROFILE_SECTIONS = ( + 'agriculture', + 'business', 'demographics', + 'development', + 'disasters', + 'education', 'elections', 'forests', 'health', - 'households', - 'education', - 'business', - 'disasters', - 'development' + 'households' ) @@ -58,6 +60,10 @@ def get_census_profile(geo_code, geo_level, profile_name=None): return data +def get_agriculture_profile(geo_code, geo_level, session): + return agriculture.get_agriculture_profile(geo_code, geo_level, session) + + def get_business_profile(geo_code, geo_level, session): return business.get_business_profile(geo_code, geo_level, session) diff --git a/wazimap_np/tables.py b/wazimap_np/tables.py index 08cb6c0..d667842 100644 --- a/wazimap_np/tables.py +++ b/wazimap_np/tables.py @@ -230,6 +230,25 @@ year='2017', table_per_level=False) +# agriculture +# meat production +FieldTable(['meat type'], + id='agriculture_meat', + universe='Meat', + description='Meat production', + dataset='Statistical Information on Nepalese Agriculture', + year='2016', + table_per_level=False) + +# livestock +FieldTable(['livestock type'], + id='agriculture_livestock', + universe='Livestock', + description='Number of livestock', + dataset='Statistical Information on Nepalese Agriculture', + year='2016', + table_per_level=False) + # Simple Tables SimpleTable( id='lifeexpectancy', diff --git a/wazimap_np/templates/profile/profile_detail.html b/wazimap_np/templates/profile/profile_detail.html index b6a3d69..ef3c592 100644 --- a/wazimap_np/templates/profile/profile_detail.html +++ b/wazimap_np/templates/profile/profile_detail.html @@ -7,13 +7,14 @@ {% endblock %} {% block profile_detail %} -{% include 'profile/sections/demographics.html' %} -{% include 'profile/sections/elections.html' %} -{% include 'profile/sections/education.html' %} -{% include 'profile/sections/health.html' %} -{% include 'profile/sections/households.html' %} -{% include 'profile/sections/business.html' %} -{% include 'profile/sections/forests.html' %} -{% include 'profile/sections/disasters.html' %} -{% include 'profile/sections/development.html' %} + {% include 'profile/sections/demographics.html' %} + {% include 'profile/sections/elections.html' %} + {% include 'profile/sections/education.html' %} + {% include 'profile/sections/health.html' %} + {% include 'profile/sections/households.html' %} + {% include 'profile/sections/business.html' %} + {% include 'profile/sections/agriculture.html' %} + {% include 'profile/sections/forests.html' %} + {% include 'profile/sections/disasters.html' %} + {% include 'profile/sections/development.html' %} {% endblock %} diff --git a/wazimap_np/templates/profile/sections/agriculture.html b/wazimap_np/templates/profile/sections/agriculture.html new file mode 100644 index 0000000..fa21873 --- /dev/null +++ b/wazimap_np/templates/profile/sections/agriculture.html @@ -0,0 +1,47 @@ +
+ {% if agriculture.area_has_data == True %} +
+

Agriculture

+
+
+
+

+
+ {% include 'profile/_blocks/_stat_list.html' with stat=agriculture.total_livestock stat_type='number' %} +
+
+ Source:
+ Ministry + of Agricultural Development Statistical Information on + Nepalese Agriculture 2072/73 (PDF) +
+
+
+
+

+
+ {% include 'profile/_blocks/_stat_list.html' with stat=agriculture.total_meat stat_type='number' %} +
+
+ Source:
+ Ministry + of Agricultural Development Statistical Information on + Nepalese Agriculture 2072/73 (PDF) +
+
+
+
+ {% endif %} +
diff --git a/wazimap_np/templates/profile/sections/forests.html b/wazimap_np/templates/profile/sections/forests.html index 2a3db9a..8a7472b 100644 --- a/wazimap_np/templates/profile/sections/forests.html +++ b/wazimap_np/templates/profile/sections/forests.html @@ -1,4 +1,4 @@ -
+
{% if forests.area_has_data == True %}

Forests and Land Use