def valid_student(student_id): students_by_id = {student['id']: student for student in qs.get_students()} if not student_id in students_by_id.keys(): return False elif students_by_id[student_id]['classCode'] == 'N/A': return False return True
def main(): data_migration.create_file('report card data download') qs.api_logging.config(__file__, log_filename=data_migration.get_filename()) data_migration.check_before_run() # { studentID: {sectionId1: {marks: 100, grade: A}, sectionID2:{..}}, studentId2: {..}} all_rc_data = {} student_ids = [i['id'] for i in qs.get_students()] for student_id in data_migration.indicator(student_ids, 'GET'): report_card = qs.get_report_card_data(student_id, REPORT_CYCLE_ID) all_rc_data[student_id] = report_card['sectionLevel'] data_migration.save(all_rc_data)
def main(): qs.api_logging.config(__file__) twelfth_grader_ids = [ i['id'] for i in qs.get_students() if 'classId' in i and i['classId'] == twelfth_grade_id ] to_be_moved = {} for student_id in tqdm(twelfth_grader_ids, desc='GET'): data = qs.get_transcript_data(student_id) custom_semester_id = current_custom_semester_id(data) if not custom_semester_id: continue current_custom_subjects = { k: v for k, v in data['sectionLevel'].iteritems() if 'semester-id' in v and v['semester-id'] == custom_semester_id } valid_semester_ids = [i['id'] for i in qs.get_semesters_from_year()] current_actual_subject_names = [ v['subject-name'] for k, v in data['sectionLevel'].iteritems() if 'C' not in k and qs.get_section(k)['smsAcademicSemesterId'] in valid_semester_ids ] to_be_moved[student_id] = { k: v for k, v in current_custom_subjects.iteritems() if 'subject-name' in v and v['subject-name'].strip() not in current_actual_subject_names } to_be_moved[student_id].update( {'actual subjects': current_actual_subject_names}) json.dump(to_be_moved, open(output_filename, 'w'), indent=4)
def main(): qs.api_logging.config(__file__) for student_id in [i['id'] for i in qs.get_students()]: print student_id data = qs.get_transcript_data(student_id) custom_semester_id = current_custom_semester_id(data)
def main(): student_ids = [i['id'] for i in qs.get_students()] for student_id in tqdm(student_ids): qs.get_transcript_data(student_id)