def _get_sections(client_facade: ClientFacade, output_directory: str) -> None: sections = client_facade.get_sections() result_bucket["sections"] = sections _create_file_from_dataframe(sections, lms.get_section_file_path(output_directory))
def _initialize( arguments: MainArguments, ) -> Tuple[ClientFacade, sqlalchemy.engine.base.Engine]: global logger try: request_client: RequestClient = RequestClient(arguments.client_key, arguments.client_secret) db_engine = get_sync_db_engine(arguments.sync_database_directory) facade = ClientFacade(request_client, arguments.page_size, db_engine) # Will generate an exception if directory is not valid os.lstat(arguments.output_directory) if arguments.input_directory: os.lstat(arguments.input_directory) return facade, db_engine except BaseException as e: logger.critical(e) print( "A fatal error occurred, please review the log output for more information.", file=sys.stderr, ) sys.exit(1)
def _get_section_activities(facade: ClientFacade, output_directory: str, section_id: int) -> None: section_activities_file_path: str = lms.get_section_activities_file_path( output_directory, section_id) section_activities = facade.get_section_activities(section_id) _create_file_from_dataframe(section_activities, section_activities_file_path)
def _get_section_associations(client_facade: ClientFacade, output_directory: str, section_id: int) -> None: file_path = lms.get_section_association_file_path(output_directory, section_id) section_associations = client_facade.get_section_associations(section_id) result_bucket["section_associations"] = section_associations _create_file_from_dataframe(section_associations, file_path)
def _get_assignments(client_facade: ClientFacade, output_directory: str, section_id: int) -> None: assignment_file_path: str = lms.get_assignment_file_path( output_directory, section_id) assignments = client_facade.get_assignments(section_id) result_bucket["assignments"] = assignments _create_file_from_dataframe(assignments, assignment_file_path)
def _get_attendance_events(client_facade: ClientFacade, output_directory: str, section_id: int) -> None: file_path = lms.get_attendance_events_file_path(output_directory, section_id) section_associations: DataFrame = result_bucket["section_associations"] attendance_events: DataFrame = client_facade.get_attendance_events( section_id, section_associations) _create_file_from_dataframe(attendance_events, file_path)
def _get_submissions(client_facade: ClientFacade, output_directory: str, section_id: int) -> None: assignments: DataFrame = result_bucket["assignments"] if not assignments.empty: for assignment in assignments["SourceSystemIdentifier"].tolist(): assignment_id = int(assignment) submission_file_name = lms.get_submissions_file_path( output_directory, section_id, assignment_id) submissions = client_facade.get_submissions( assignment_id, section_id) _create_file_from_dataframe( submissions, submission_file_name, )
def _get_users(client_facade: ClientFacade, output_directory: str) -> None: users = client_facade.get_users() _create_file_from_dataframe(users, lms.get_user_file_path(output_directory))