Ejemplo n.º 1
0
 /**
  * It will calculate the average of the z-values for Education
  * @return return the average of z-values by key field of each city
  */
 public function educationKeyField()
 {
     $education = new EducationController();
     //Get the z-values for high school
     $highSchoolFailure = $education->schoolFailureRate("Ensino_Medio");
     //High School z-value for failure
     $highSchoolFailureInverted = array_map(array($this, "addImpact"), $highSchoolFailure);
     $highSchoolDistortion = $education->schoolDistortionRate("Ensino_Medio");
     //High School z-value for distortion rate
     $highSchoolDistortionInverted = array_map(array($this, "addImpact"), $highSchoolDistortion);
     $highSchoolPass = $education->schoolPassRate("Ensino_Medio");
     //High School z-value for distortion rate
     $highSchoolDrop = $education->schoolDropOutRate("Ensino_Medio");
     //High School z-value for dropout
     $highSchoolDropInverted = array_map(array($this, "addImpact"), $highSchoolDrop);
     $highSchoolGraduates = $education->schoolNumberGraduates("Ensino_Medio");
     //High School z-value for number of graduates
     //Get the z-values for elementary and middle school
     $elemFailure = $education->schoolFailureRate("Ensino_Fundamental");
     //High School z-value for failure
     $elemFailureInverted = array_map(array($this, "addImpact"), $elemFailure);
     $elemDistortion = $education->schoolDistortionRate("Ensino_Fundamental");
     //High School z-value for distortion rate
     $elemDistortionInverted = array_map(array($this, "addImpact"), $elemDistortion);
     $elemPass = $education->schoolPassRate("Ensino_Fundamental");
     //High School z-value for distortion rate
     $elemDrop = $education->schoolDropOutRate("Ensino_Fundamental");
     //High School z-value for dropout
     $elemDropInverted = array_map(array($this, "addImpact"), $elemDrop);
     $elemGraduates = $education->schoolNumberGraduates("Ensino_Fundamental");
     //High School z-value for number of graduates
     //Get th z-values for preschool
     $preSchool = $education->preSchoolEnrollments();
     //sum z-values
     $sumZvalues = array_map(array($this, "sumCityValues"), $highSchoolFailureInverted, $highSchoolDistortionInverted, $highSchoolPass, $highSchoolDropInverted, $highSchoolGraduates, $elemFailureInverted, $elemDistortionInverted, $elemPass, $elemDropInverted, $elemGraduates, $preSchool);
     //Divide the sum of z-values to obtain the z-values average of each city
     $zValuesAvg = array_map(array($this, "divideKeyFields"), $sumZvalues, array_fill(0, count($sumZvalues), 11));
     //combine the array keys(cities'name) with the average of z-values gotten
     $zValuesAvg = array_combine(array_keys($preSchool), array_values($zValuesAvg));
     return $zValuesAvg;
 }
 /**
  * Return the education z-values for the selected city and its average
  * @param string $cityName name of the selected city
  * @return array $cityValues it contains the z-values and a z-values average
  */
 public function educationDomain($cityName)
 {
     if (isset($cityName)) {
         if (strcmp($cityName, '') != 0) {
             $education = new EducationController();
             //Get the z-values for high school
             $highSchoolFailure = $education->schoolFailureRate("Ensino_Medio");
             //High School z-value for failure
             $highSchoolDistortion = $education->schoolDistortionRate("Ensino_Medio");
             //High School z-value for distortion rate
             $highSchoolPass = $education->schoolPassRate("Ensino_Medio");
             //High School z-value for distortion rate
             $highSchoolDrop = $education->schoolDropOutRate("Ensino_Medio");
             //High School z-value for dropout
             $highSchoolGraduates = $education->schoolNumberGraduates("Ensino_Medio");
             //High School z-value for number of graduates
             //Get the z-values for elementary and middle school
             $elemFailure = $education->schoolFailureRate("Ensino_Fundamental");
             //High School z-value for failure
             $elemDistortion = $education->schoolDistortionRate("Ensino_Fundamental");
             //High School z-value for distortion rate
             $elemPass = $education->schoolPassRate("Ensino_Fundamental");
             //High School z-value for distortion rate
             $elemDrop = $education->schoolDropOutRate("Ensino_Fundamental");
             //High School z-value for dropout
             $elemGraduates = $education->schoolNumberGraduates("Ensino_Fundamental");
             //High School z-value for number of graduates
             //Get th z-values for preschool
             $preSchool = $education->preSchoolEnrollments();
             $cityEduInfo = array("Ensino Médio - Reprovação" => $highSchoolFailure[$cityName], "Ensino Médio - Distorção Idade-Série" => $highSchoolDistortion[$cityName], "Ensino Médio - Aprovação" => $highSchoolPass[$cityName], "Ensino Médio - Abandono" => $highSchoolDrop[$cityName], "Ensino Médio - Concluintes" => $highSchoolGraduates[$cityName], "Ensino Fundamental - Reprovação" => $elemFailure[$cityName], "Ensino Funcamental - Distorção Idade-Série" => $elemDistortion[$cityName], "Ensino Funcamental - Aprovação" => $elemPass[$cityName], "Ensino Funcamental - Abandono" => $elemDrop[$cityName], "Ensino Funcamental - Concluintes" => $elemGraduates[$cityName], "Educação Infantil - Matrículas" => $preSchool[$cityName]);
             $cityEduValues = CityProfileController::mergeAverage($cityEduInfo);
             return $cityEduValues;
         }
     }
     return 0;
 }