Beispiel #1
0
 def create_facilities_from_csv(self, sector, data_source):
     path = os.path.join(self._data_dir, 'facility_csvs', data_source)
     for d in CsvReader(path).iter_dicts():
         if '_lga_id' not in d:
             print "FACILITY MISSING LGA ID"
             continue
         if d['_lga_id'] not in self.lga_ids:
             continue
         d['_data_source'] = data_source
         d['_facility_type'] = sector.lower()
         d['sector'] = sector
         facility = FacilityBuilder.create_facility_from_dict(d)
Beispiel #2
0
 def test_student_teacher_ratio(self):
     """
     Test to make sure that when we create a school with number of
     students and number of teachers the student teacher ratio is
     automatically added to that school. Note: this only works if
     you use facility builder. Note how we create new calculated
     variables in the setUp method above.
     """
     d = {
         'sector': self.sector.name,
         '_lga_id': self.lga.id,
         '_facility_type': self.sector.slug,
         'num_students_total': 100,
         'num_tchrs_total': 20,
         }
     f = FacilityBuilder.create_facility_from_dict(d)
     self.assertEquals(
         f.get_latest_value_for_variable('student_teacher_ratio'),
         5
         )