def main(): outfile = open("changes_new.txt", "w") schools_file = open("ride_schools_info.csv", "r") schools = list(csv.DictReader(schools_file)) schools_file.close() # schools, districts = web_scraper.getAllInfo("ride_all_schools.html") sch_enrolls, dist_enrolls = enroll.main("enroll.csv") schools_dict = {} for i in web_scraper.convertAllToString(schools): if "Public School" in i["type"]: schools_dict[i["code"]] = i f = open("last_year.csv", "r") access = list(csv.DictReader(f)) f.close() checked = set() websites = {} for b in schools_dict: # if b not in checked: # outfile.write(schools_dict[b]["name"] + # " not in last year's database.\n") checkGrades(schools_dict[b], sch_enrolls, outfile) # if schools_dict[b]["url"] != "": # schools_dict[b]["url"] = "http://" + schools_dict[b]["url"] + "/" schools_dict[b]["url"] = fixURL(schools_dict[b]["url"]) url = schools_dict[b]["url"] # url = "http://" + schools_dict[b]["url"] if url not in websites: websites[url] = 1 else: websites[url] += 1 # url_check = checkURL(url, outfile) # if url_check != False: # schools_dict[b]["url"] = url_check # else: # outfile.write("Failure connecting to URL for " + schools_dict[b]["name"] + # ".\n(" + url + ")\n") schools_dict[b]["num_students"] = getTotalEnroll(schools_dict[b]["code"], sch_enrolls, outfile) for a in access: ac = a["school_code"] checked.add(ac) try: for prop in a: if prop in VM: if a[prop] != schools_dict[ac][VM[prop]]: outfile.write(a["name_iwl"] + " has a mismatch:\n" + "Old " + prop + ": " + a[prop] + "\n" + "New " + prop + ": " + schools_dict[ac][VM[prop]] + "\n") except KeyError as e: outfile.write("School " + ac + " missing from new data.\n") for c in schools_dict: if c not in checked: outfile.write(schools_dict[c]["name"] + " not in last year's database.\n") for w in websites: if websites[w] > 1: outfile.write(w + " is listed as a website for " + str(websites[w]) + " schools.\n") outfile.close() return schools_dict
def create_enroll_wind(): enroll.main(database, vid, mrcnn, gaitnet, args)
def main(): outfile = open("changes_new.txt", "w") schools_file = open("ride_schools_info.csv", "r") schools = list(csv.DictReader(schools_file)) schools_file.close() # schools, districts = web_scraper.getAllInfo("ride_all_schools.html") sch_enrolls, dist_enrolls = enroll.main("enroll.csv") schools_dict = {} for i in web_scraper.convertAllToString(schools): if "Public School" in i["type"]: schools_dict[i["code"]] = i f = open("last_year.csv", "r") access = list(csv.DictReader(f)) f.close() checked = set() websites = {} for b in schools_dict: # if b not in checked: # outfile.write(schools_dict[b]["name"] + # " not in last year's database.\n") checkGrades(schools_dict[b], sch_enrolls, outfile) # if schools_dict[b]["url"] != "": # schools_dict[b]["url"] = "http://" + schools_dict[b]["url"] + "/" schools_dict[b]["url"] = fixURL(schools_dict[b]["url"]) url = schools_dict[b]["url"] # url = "http://" + schools_dict[b]["url"] if url not in websites: websites[url] = 1 else: websites[url] += 1 # url_check = checkURL(url, outfile) # if url_check != False: # schools_dict[b]["url"] = url_check # else: # outfile.write("Failure connecting to URL for " + schools_dict[b]["name"] + # ".\n(" + url + ")\n") schools_dict[b]["num_students"] = getTotalEnroll( schools_dict[b]["code"], sch_enrolls, outfile) for a in access: ac = a["school_code"] checked.add(ac) try: for prop in a: if prop in VM: if a[prop] != schools_dict[ac][VM[prop]]: outfile.write(a["name_iwl"] + " has a mismatch:\n" + "Old " + prop + ": " + a[prop] + "\n" + "New " + prop + ": " + schools_dict[ac][VM[prop]] + "\n") except KeyError as e: outfile.write("School " + ac + " missing from new data.\n") for c in schools_dict: if c not in checked: outfile.write(schools_dict[c]["name"] + " not in last year's database.\n") for w in websites: if websites[w] > 1: outfile.write(w + " is listed as a website for " + str(websites[w]) + " schools.\n") outfile.close() return schools_dict
import enroll import sys print("*************************************") print("*************************************") print("To run continuous video stream: press 1") print("To run facial recognition: press 2") print("To add face to list of known faces: press 3") print("To exit: press q") print("-------------------------------------") while True: response = input() if response == "1": print("Continuous stream booting...") server.run() if response == "2": print("Facial recognition booting...") facerec.run() if response == "3": print("Enrollment booting...") enroll.main() if response == "q": print("Shutting down...") sys.exit() else: print("-------------------------------------") print("To run continuous video stream: press 1") print("To run facial recognition: press 2") print("To add face to list of known faces: press 3") print("To exit: press q") print("-------------------------------------")
def main(NEW_FILE): """Calculates the stats, writes them to a CSV, returns them as a dict.""" # List of all schools sch = [s for s in utils.getDataFromCSV(SLICE_FILE) if s["is_open"] == "Y"] # Enrollment figures for all schools and districts sch_enrolls, dist_enrolls = enroll.main(ENROLL_FILE) # Schools by type dist_schools = getSchoolsByType(sch, "Public School") dist_charters = getSchoolsByType(sch, "District Charter School") ind_charters = getSchoolsByType(sch, "Independent Charter School") state_schools = getSchoolsByType(sch, "State Operated School") reg_collabs = getSchoolsByType(sch, "Regional Collaborative") # Students in charters dist_ch_students = sum([int(d["num_students"]) for d in dist_charters]) ind_ch_students = sum([int(i["num_students"]) for i in ind_charters]) ch_students = dist_ch_students + ind_ch_students # Schools by grade configuration e = getSchoolsByConfig(sch, "Emh") m = getSchoolsByConfig(sch, "eMh") h = getSchoolsByConfig(sch, "emH") em = getSchoolsByConfig(sch, "EMh") mh = getSchoolsByConfig(sch, "eMH") emh = getSchoolsByConfig(sch, "EMH") # Summary stats # (Messy variable names are that way to match the names used in past yrs) summary = { "School_Year": SCHOOL_YEAR, "Students -Total #": dist_enrolls["00"].getTotal(), "Students-Public E": sum(dist_enrolls["00"].getEnrolls("PK", "5")), "Students-Public M": sum(dist_enrolls["00"].getEnrolls("6", "8")), "Students-Public H": sum(dist_enrolls["00"].getEnrolls("9", "12")), "Students - Charter District": dist_ch_students, "Students-Charter Independent": ind_ch_students, "Students - Charter Total #": ch_students, "Students-Chart Total %": toPct(float(ch_students) / float(dist_enrolls["00"].getTotal())), "Schools-Total #": len(sch), "Schools-E": len(e), "Schools-M": len(m), "Schools-H": len(h), "Schools-EM": len(em), "Schools-MH": len(mh), "Schools-EMH": len(emh), "Schools-District Operated": len(dist_schools), "Schools-State Operated": len(state_schools), "Schools - Charter District": len(dist_charters), "Schools-Charter Independent": len(ind_charters), "Schools-Collaboratives": len(reg_collabs), "Schools-Preschools": len([p for p in sch_enrolls if isPkOnly(sch_enrolls[p])]) } # Past years included this preschools-only number, then later cut it del summary["Schools-Preschools"] writeCSV(new_csv_file, summary) return summary