def generateDict (dataSet: dict) -> dict: """ For testing on a smaller dataset and increased modularity. Returns a data structure with the following format: { number_functional: …, number_water_points: { communityA: …, }, community_ranking: … } """ return dict( number_functional= compute.sumFunctionalWaterPoints(dataSet) , number_water_points = compute.sumWaterPointsPerSplitKey("communities_villages", dataSet) , community_ranking = compute.rank("water_functioning", "communities_villages", dataSet) )
def test_rankCommunitiesByPercentBrokenWaterPoints(self): assert compute.rank("water_pay", "water_functioning",TestCompute.data) == {"yes":(1/3*100), "no":50}
def percent_boolean_key_by(boolean_key, split_key): dataSet = data.get_data(boolean_key, split_key, url) return compute.rank(boolean_key, split_key, dataSet)
def percent_water_functioning_by(split_key: str) -> dict: dataSet = data.get_data("water_functioning", split_key, url) return compute.rank("water_functioning", split_key, dataSet)