Skip to content

Latest commit

 

History

History
489 lines (481 loc) · 13.1 KB

README.md

File metadata and controls

489 lines (481 loc) · 13.1 KB

Water Point Data Processing

Advance IT Test for Summit Institute of Development

Problem

Generate statistical information from Water Point Data that contains

  • The number of water points that are functional
  • The number of water points per community
  • The rank for each community by the percentage of broken water points, Descending Order

Result

{
	"total_water_points": 712,
	"total_functioning": 623,
	"total_non_functioning": 87,
	"total_unknown_functioning": 2,
	"village_statistic": [{
		"villageName": "Zukpeni",
		"totalWater": 6,
		"totalWaterFunctioning": 2,
		"totalWaterNonFunctioning": 4,
		"functioningPercentage": 33.333336,
		"nonFunctioningPercentage": 66.66667
	}, {
		"villageName": "Gbaarigu",
		"totalWater": 5,
		"totalWaterFunctioning": 2,
		"totalWaterNonFunctioning": 3,
		"functioningPercentage": 40.0,
		"nonFunctioningPercentage": 60.000004
	}, {
		"villageName": "Namgurima",
		"totalWater": 8,
		"totalWaterFunctioning": 4,
		"totalWaterNonFunctioning": 4,
		"functioningPercentage": 50.0,
		"nonFunctioningPercentage": 50.0
	}, {
		"villageName": "Arigu",
		"totalWater": 12,
		"totalWaterFunctioning": 6,
		"totalWaterNonFunctioning": 6,
		"functioningPercentage": 50.0,
		"nonFunctioningPercentage": 50.0
	}, {
		"villageName": "Kurugu",
		"totalWater": 9,
		"totalWaterFunctioning": 5,
		"totalWaterNonFunctioning": 4,
		"functioningPercentage": 55.555557,
		"nonFunctioningPercentage": 44.444447
	}, {
		"villageName": "Bandem",
		"totalWater": 7,
		"totalWaterFunctioning": 4,
		"totalWaterNonFunctioning": 3,
		"functioningPercentage": 57.14286,
		"nonFunctioningPercentage": 42.857143
	}, {
		"villageName": "Zanwara",
		"totalWater": 10,
		"totalWaterFunctioning": 6,
		"totalWaterNonFunctioning": 4,
		"functioningPercentage": 60.000004,
		"nonFunctioningPercentage": 40.0
	}, {
		"villageName": "Alavanyo",
		"totalWater": 3,
		"totalWaterFunctioning": 2,
		"totalWaterNonFunctioning": 1,
		"functioningPercentage": 66.66667,
		"nonFunctioningPercentage": 33.333336
	}, {
		"villageName": "Gbima",
		"totalWater": 3,
		"totalWaterFunctioning": 2,
		"totalWaterNonFunctioning": 1,
		"functioningPercentage": 66.66667,
		"nonFunctioningPercentage": 33.333336
	}, {
		"villageName": "Banyangsa",
		"totalWater": 10,
		"totalWaterFunctioning": 7,
		"totalWaterNonFunctioning": 3,
		"functioningPercentage": 70.0,
		"nonFunctioningPercentage": 30.000002
	}, {
		"villageName": "Soo",
		"totalWater": 7,
		"totalWaterFunctioning": 4,
		"totalWaterNonFunctioning": 2,
		"functioningPercentage": 57.14286,
		"nonFunctioningPercentage": 28.57143
	}, {
		"villageName": "Kubore",
		"totalWater": 18,
		"totalWaterFunctioning": 13,
		"totalWaterNonFunctioning": 5,
		"functioningPercentage": 72.22222,
		"nonFunctioningPercentage": 27.777779
	}, {
		"villageName": "Tantala",
		"totalWater": 22,
		"totalWaterFunctioning": 16,
		"totalWaterNonFunctioning": 6,
		"functioningPercentage": 72.72727,
		"nonFunctioningPercentage": 27.272728
	}, {
		"villageName": "Chanpolinsa",
		"totalWater": 4,
		"totalWaterFunctioning": 3,
		"totalWaterNonFunctioning": 1,
		"functioningPercentage": 75.0,
		"nonFunctioningPercentage": 25.0
	}, {
		"villageName": "Loagri_1_",
		"totalWater": 18,
		"totalWaterFunctioning": 14,
		"totalWaterNonFunctioning": 4,
		"functioningPercentage": 77.77778,
		"nonFunctioningPercentage": 22.222223
	}, {
		"villageName": "Longsa",
		"totalWater": 9,
		"totalWaterFunctioning": 7,
		"totalWaterNonFunctioning": 2,
		"functioningPercentage": 77.77778,
		"nonFunctioningPercentage": 22.222223
	}, {
		"villageName": "Nayoku",
		"totalWater": 35,
		"totalWaterFunctioning": 29,
		"totalWaterNonFunctioning": 6,
		"functioningPercentage": 82.85715,
		"nonFunctioningPercentage": 17.142859
	}, {
		"villageName": "Zogsa",
		"totalWater": 6,
		"totalWaterFunctioning": 5,
		"totalWaterNonFunctioning": 1,
		"functioningPercentage": 83.33333,
		"nonFunctioningPercentage": 16.666668
	}, {
		"villageName": "Jagsa",
		"totalWater": 38,
		"totalWaterFunctioning": 32,
		"totalWaterNonFunctioning": 6,
		"functioningPercentage": 84.210526,
		"nonFunctioningPercentage": 15.789473
	}, {
		"villageName": "Zangu-Vuga",
		"totalWater": 13,
		"totalWaterFunctioning": 11,
		"totalWaterNonFunctioning": 2,
		"functioningPercentage": 84.61539,
		"nonFunctioningPercentage": 15.384616
	}, {
		"villageName": "Zua",
		"totalWater": 28,
		"totalWaterFunctioning": 24,
		"totalWaterNonFunctioning": 4,
		"functioningPercentage": 85.71429,
		"nonFunctioningPercentage": 14.285715
	}, {
		"villageName": "Nabulugu",
		"totalWater": 31,
		"totalWaterFunctioning": 27,
		"totalWaterNonFunctioning": 4,
		"functioningPercentage": 87.09677,
		"nonFunctioningPercentage": 12.903225
	}, {
		"villageName": "Kanwaasa",
		"totalWater": 9,
		"totalWaterFunctioning": 8,
		"totalWaterNonFunctioning": 1,
		"functioningPercentage": 88.88889,
		"nonFunctioningPercentage": 11.111112
	}, {
		"villageName": "Kpatarigu",
		"totalWater": 51,
		"totalWaterFunctioning": 46,
		"totalWaterNonFunctioning": 5,
		"functioningPercentage": 90.196075,
		"nonFunctioningPercentage": 9.803922
	}, {
		"villageName": "Kulbugu",
		"totalWater": 11,
		"totalWaterFunctioning": 10,
		"totalWaterNonFunctioning": 1,
		"functioningPercentage": 90.909096,
		"nonFunctioningPercentage": 9.090909
	}, {
		"villageName": "Selinvoya",
		"totalWater": 13,
		"totalWaterFunctioning": 12,
		"totalWaterNonFunctioning": 1,
		"functioningPercentage": 92.30769,
		"nonFunctioningPercentage": 7.692308
	}, {
		"villageName": "Guuta",
		"totalWater": 32,
		"totalWaterFunctioning": 30,
		"totalWaterNonFunctioning": 2,
		"functioningPercentage": 93.75,
		"nonFunctioningPercentage": 6.25
	}, {
		"villageName": "Dorinsa",
		"totalWater": 17,
		"totalWaterFunctioning": 16,
		"totalWaterNonFunctioning": 1,
		"functioningPercentage": 94.117645,
		"nonFunctioningPercentage": 5.882353
	}, {
		"villageName": "Zundem",
		"totalWater": 30,
		"totalWaterFunctioning": 30,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Suik",
		"totalWater": 1,
		"totalWaterFunctioning": 1,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Bechinsa",
		"totalWater": 26,
		"totalWaterFunctioning": 26,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Sikabsa",
		"totalWater": 3,
		"totalWaterFunctioning": 3,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Kpikpaluk",
		"totalWater": 3,
		"totalWaterFunctioning": 3,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Badomsa",
		"totalWater": 27,
		"totalWaterFunctioning": 27,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Tankangsa",
		"totalWater": 6,
		"totalWaterFunctioning": 6,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Logvasgsa",
		"totalWater": 4,
		"totalWaterFunctioning": 4,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Akpari-yeri",
		"totalWater": 3,
		"totalWaterFunctioning": 3,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Jiningsa",
		"totalWater": 7,
		"totalWaterFunctioning": 7,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Nawaasa",
		"totalWater": 6,
		"totalWaterFunctioning": 5,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 83.33333,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Jaata",
		"totalWater": 8,
		"totalWaterFunctioning": 8,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Nyandema",
		"totalWater": 3,
		"totalWaterFunctioning": 3,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Jiniensa",
		"totalWater": 1,
		"totalWaterFunctioning": 1,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Piisa",
		"totalWater": 5,
		"totalWaterFunctioning": 5,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Gaadem",
		"totalWater": 2,
		"totalWaterFunctioning": 2,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Kanbangsa",
		"totalWater": 8,
		"totalWaterFunctioning": 8,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Jiningsa-Yipaala",
		"totalWater": 3,
		"totalWaterFunctioning": 3,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Kalaasa",
		"totalWater": 1,
		"totalWaterFunctioning": 1,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Guuta-Nasa",
		"totalWater": 11,
		"totalWaterFunctioning": 11,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Fiisa",
		"totalWater": 5,
		"totalWaterFunctioning": 5,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Luisa",
		"totalWater": 8,
		"totalWaterFunctioning": 8,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Jiriwiensa",
		"totalWater": 8,
		"totalWaterFunctioning": 8,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Tuisa",
		"totalWater": 4,
		"totalWaterFunctioning": 4,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Chondema",
		"totalWater": 4,
		"totalWaterFunctioning": 4,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Nyankpiensa",
		"totalWater": 8,
		"totalWaterFunctioning": 8,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Kom",
		"totalWater": 6,
		"totalWaterFunctioning": 6,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Zuedema",
		"totalWater": 18,
		"totalWaterFunctioning": 18,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Abanyeri",
		"totalWater": 4,
		"totalWaterFunctioning": 4,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Garigu",
		"totalWater": 1,
		"totalWaterFunctioning": 1,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Kunkwah",
		"totalWater": 3,
		"totalWaterFunctioning": 3,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Gumaryili",
		"totalWater": 1,
		"totalWaterFunctioning": 1,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Mwalorinsa",
		"totalWater": 8,
		"totalWaterFunctioning": 8,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Kaasa",
		"totalWater": 25,
		"totalWaterFunctioning": 25,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Chansa",
		"totalWater": 9,
		"totalWaterFunctioning": 9,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Dibisi",
		"totalWater": 2,
		"totalWaterFunctioning": 2,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}, {
		"villageName": "Vundema",
		"totalWater": 5,
		"totalWaterFunctioning": 5,
		"totalWaterNonFunctioning": 0,
		"functioningPercentage": 100.0,
		"nonFunctioningPercentage": 0.0
	}]
}

Developer Notes

  • Make sure to set your IDE environtment able to run Java 8 and support for Lambda function

  • There are 4 available sort type to sort village rank stats

    • Functioning Water Point Ascending : SortType.FUNCTION_ASC
    • Functioning Water Point Descending : SortType.FUNCTION_DESC
    • Non Functioning Water Point Ascending : SortType.NON_FUNCTION_ASC
    • Non Functioning Water Point Descending : SortType.NON_FUNCTION_DESC

    You can change the sort type on file MainClass line 26 by available sort type

  • If you use IntelliJ as IDE, don't forget to install Lombok Plugin