def main(): data = json.load(open(filename)) output = [] for student_id, subjectDicts in data.iteritems(): output.append({ 'name': qs.get_student(student_id)['fullName'], 'subjects': [d for k, d in subjectDicts.iteritems()] }) json.dump(output, open(output_filename, 'w'))
def main(): by_id = json.load(open(input_filename)) by_name = [] for student_id, subjects in by_id.iteritems(): by_name.append({ 'name': qs.get_student(student_id)['fullName'], 'subjectCount': len(subjects) }) json.dump(by_name, open(output_filename, 'w'))
def main(): qs.api_logging.config(__file__) to_upload = json.load(open(filename)) for student_id in to_upload: print qs.get_student(student_id)['fullName'] report_cycles = [ i for i in qs.get_report_cycles() if 'Report Card' in i['name'] and '2013-2014' in i['name'] ] for report_cycle in report_cycles: end_of_year_subjects = qs.get_report_card_data(student_id, report_cycle_id)['sectionLevel'] print report_cycle['name'] report_cycle_id = report_cycle['id'] subject_len = len(qs.get_report_card_data(student_id, report_cycle_id)['sectionLevel']) print subject_len print print
def main(): qs.api_logging.config(__file__) data = json.load(open(data_file)) for student_id in tqdm(data, desc='GET'): transcript = qs.get_transcript(student_id) semester_id = next(k for k, v in transcript['semesterLevel'].iteritems() if v['year-name'] == '2013/2014') qs.post_transcript(student_id, semester_level={ semester_id: { 'values': { 'class-level': qs.get_student(student_id)['className'] } } })
def manage_subjects_to_hide(transcript_sections, offline_sections, student_id): global rows valid_semesters = [i['id'] for i in qs.get_semesters_from_year()] transcript_sections = [ i for i in transcript_sections if 'C' not in i and qs.get_section(i)['smsAcademicSemesterId'] in valid_semesters ] transcript_section_names = [ qs.get_section(i)['sectionName'] for i in transcript_sections ] to_remove = [ i for i in transcript_section_names if i not in offline_sections.keys() ] rows.append({ cols[0]: qs.get_student(student_id)['fullName'], cols[1]: student_id, cols[2]: to_remove })
def main(): combined = json.load(open(input_filepath)) rows = [] for student, sections in combined.iteritems(): for section, idents in sections.iteritems(): s1 = idents.get('s-letter-grade-1') s2 = idents.get('s-letter-grade-2') if s1 and s2 and ('F' in s1 or 'F' in s2) and s1 != s2: rows.append({ 'Student Name': qs.get_student(student)['fullName'], 'Section Name': section, 'Semester 1 Grade': s1, 'Semester 2 Grade': s2, }) csv_tools.write_csv(rows, output_filepath, keys=[ 'Student Name', 'Section Name', 'Semester 1 Grade', 'Semester 2 Grade' ])