程序代写 Table of Contents

Table of Contents
1. Key Information 3
1.1. Do and Do NOT 4 1.2. Documentation 4 1.3. Submission 4
2. Getting help 6

Copyright By PowCoder代写 加微信 powcoder

2.1. English language skills 6 2.2. Study skills 6 2.3. Things are tough right now 6 2.4. Things in the unit don¡¯t make sense 6 2.5. I don¡¯t know what I need 6
3. Key tasks 7
3.1. Overview 7 3.2. Website business logic description 8 3.2 Task 1 – design classes 16
3.2.1 User class 16 3.2.2 Admin class 18 3.2.3 Instructor class 19 3.2.4 Student class 21 3.2.5 Course class 21
3.3. Task 2 – Index, user register, login and logout 25 3.4. Task 3 – Students page 26 3.5. Task 4 – Courses page 27 3.6. Task 5 – Instructors page 28
Important Notes: 28

1. Key Information
This assessment is related to the following learning objectives (LO):
¡ñ LO4: Investigate useful Python packages for scientific computing
and data analysis
¡ñ LO5: Experiment with basic data manipulation, analysis, and
visualisation technique to formulate business insight
¡ñ L07: Build a basic web application based on Python web
frameworks
It is an Individual assignment, where you will write a code for a simple emulation of a data analysis website.
30% of your total marks for the unit
[Friday 10th Jun 2022, week 14] 4:30 pm
Submission
¡ñ Via Moodle Assignment Submission.
¡ñ Turnitin will be used for similarity checking of all submissions.
Assessment Criteria
See Moodle Assessment page
Late Penalties
¡ñ 10% deduction per calendar day or part thereof for up to one week
¡ñ Submissions more than 7 calendar days after the due date will receive a mark of zero (0) and no assessment feedback will be provided.
Support Resources
See Moodle Assessment page
Feedback will be provided on student work via:
general cohort performance
specific student feedback ten working days post submission

1.1. Do and Do NOT
¡ñ Maintain academic integrity1
¡ñ Get support early from this unit and other
services in the university
¡ñ Apply for special consideration for
extensions2
¡ñ Leave your assignment in draft mode
¡ñ Submit late (10% daily penalty applies)3
¡ñ Submission is not accepted after 7 days of
the due date, unless you have special consideration.
1.2. Documentation
Commenting your code is essential as part of the assessment criteria (refer to Marking Rubrics).
You should also include comments at the beginning of your program file, which specify your name, your Student ID, the start date and the last modified date of the program, as well as with a high-level description of the program. In-line comments within the program are also part of the required documentation.
1.3. Submission
Your have to submit your assignment via the assignment submission link (i.e., ¡°Assignment 2 Submission¡±) on the Moodle site by the deadline specified in Section 1, i.e. 10th Jun 2022 (Friday) by 4:30 pm:
¡ñ There will be NO hard copy submission required for this assignment.
¡ñ You are required to submit your assignment as a .zip file named with your Student ID. For example, if your Student ID is 12345678, you would submit a zipped file named 12345678.zip
¡ñ Do not include any unnecessary file in this folder
¡ñ Note that marks will be deducted if this requirement is not strictly complied
¡ñ No submission accepted via email. 1
https://www.monash.edu/rlo/research-writing-assignments/referencing-and-academic-integrit y/academic-integrity
2 https://www.monash.edu/exams/changes/special-consideration (All the Special Consideration should be applied no later than two University working days after the due date of the affected assessment). 3 eg: original mark was 70/100, submitting 2 days late results in 50/100 (10 marks off). This includes weekends

1.4. Deliverables
Your submission should contain the following documents:
¡ñ All files in the ¡°model¡± folder include course.py, user.py, user_admin.py, user_instructor.py and user_student.py.
¡ñ All files in the ¡°controller¡± folder include course_controller.py, index_controller.py, instructor_controller.py and user_controller.py.
¡ñ Several files in the ¡°templates¡± folder include 00login.html, 00register.html, 10student_list.html and 11student_info.html.
¡ñ All files need to be compressed into a zip file. The final submission file name is {your_student_id}.zip.
¡ñ Marks will be deducted for any of these requirements that are not strictly complied with.

2. Getting help
2.1. English language skills
if you don¡¯t feel confident with your English.
¡ñ Talk to English Connect: https://www.monash.edu/english-connect
2.2. Study skills
If you feel like you just don¡¯t have enough time to do everything you need to, maybe you just need a new approach
¡ñ Talk to a learning skills advisor: https://www.monash.edu/library/skills/contacts
2.3. Things are tough right now
Everyone needs to talk to someone at some point in their life, no judgement here.
¡ñ Talk to a counsellor: https://www.monash.edu/health/counselling/appointments (friendly, approachable, confidential, free)
2.4. Things in the unit don¡¯t make sense
Even if you¡¯re not quite sure what to ask about, if you¡¯re not sure you won¡¯t be alone, it¡¯s always better to ask.
¡ñ Ask in Ed: https://edstem.org/au/courses/7429/discussion/
¡ñ Attend a consultation:
https://lms.monash.edu/course/view.php?id=135703&section=21
2.5. I don¡¯t know what I need
Everyone at Monash University is here to help you. If things are tough now they won¡¯t magically get better by themselves. Even if you don¡¯t exactly know, come and talk with us and we¡¯ll figure it out. We can either help you ourselves or at least point you in the right direction.

3. Key tasks
This assignment is a data analysis website. You are required to analyse the given data in folder data/source_course_files. This project is based on Python Flask Framework and you need to complete the files inside the controller folder named course_controller.py, index_controller.py, instructor_controller.py and user_controller.py, model folder named course.py, user.py, user_admin.py, user_instructor.py and user_student.py and several html pages (views) in the templates folder called 00login.html, 00register.html, 10student_list.html and 11student_info.html.
This is an individual assignment and must be your own work.
You can use any libraries except the time-related libraries or functions in this assignment.
In the provided project-> lib folder, there are a few methods and variables in the helper.py file that can be imported and used in your tasks. For example, if you need to access the course.txt data file, you can add ¡°from lib.helper import course_data_path¡± in your file. All the path variables in the helper.py should not be changed. Any unexpected changes may cause the website to not run,which will lead to mark penalties.
3.1. Overview
1. Data explanation In the data folder, the source_course_file folder contains all the data files we need to use in this assignment. The course.txt and user.txt files are used to save all the course and user data. The example of course and user data can be found in _demo_course.txt and _demo_user.txt files. (course.txt and user.txt files are provided but empty)
2. Folder structure

The image above shows a folder structure of this assignment. Running the main.py file can start this web application. The template file has some incomplete code which will generate errors. It is better to finish some tasks before starting to run the web application.
3. Start the assignment
Step1. Create a new project in Pycharm and copy all the files into this project. Step2. Open requirements.txt file and you can see the image below.
Step3. Click install requirements.
After the instalment of all libraries, you can start to work on this assignment.
( Feel free to use the `pip install -r requirements.txt` if you can understand this command)
3.2. Website business logic description
1. Index page – Index page is the homepage of your web application. To launch the application you must run the main.py file, and use the link:http://localhost:5000/ in the browser.

Figure 3.1 Index page no login
2. Login page – Login page allows the user to login into the web application which requires them to input username and password. There are three different kinds of users, i.e., Admin, Instructor, and student. Each kind of user will see different contents from the home (index) pages after login.
Figure 3.2 Login page
For example, when a student logs in, the index (home) page looks like the figure 3.3. Students can only check their own information and logout.

Figure 3.3 Student login page
For example, when the instructor logs in, the index (home) page looks like the figure 3.4. Instructors can only see the courses they teach and logout.
Figure 3.4 Instructor login page
For example, when admin logs in, the index (home) page looks like the figure 3.5. There is a reset database button which can remove all the content in the course.txt and user.txt files.

Figure 3.5 Admin login page
4. Register page – Register page allows users to register them into the web application, in the case they do not have an account. It is required to enter username, password, email address and role when registering a user. And a register timestamp(unix epoch time) will be generated automatically. All these five values will be sent to the application¡¯s backend to store the values in the user.txt file.

Figure 3.6 Register page
5. Courses page – After a user logs in as admin, they can see the similar page as in figure3.7. In this page, the total number of courses and 20 course objects will be displayed. All the course objects can be returned based on the page number. By default, the page number is 1. Each page has a maximum of 20 courses. At the bottom of the webpage, a page number list is shown. By default, the page number list is always be [1,2,3,4,5,6,7,8,9].
Two buttons are placed below the total number of courses, which are the Process Course Data button and the Course Analysis Figure button. The Process Course Data button will retrieve all the data from given course data files(this process may take some time). The Course Analysis Figure button will generate 6 figures and the explanations of each figure. All the figures are saved into lib.helper.figure_save_path and all the explanations(i.e., the trend of the figure) about each figure will be displayed in a new webpage.

For each item of course, there will be a Details button and a Delete button. Details button will take you to the course details page. The Delete button will remove selected data from the course.txt file and user.txt file.
Figure 3.7 Course list page
Figure 3.8 Course details page

If you login as an instructor, the courses page will show the courses this instructor teaches.
Figure 3.9 Courses page when login as instructor
If you login as a student, there is no courses page available.
6. Instructors page – In this page, the total number of instructors will be displayed. Because each instructor can teach more than one course, the total number of instructors is less than the total number of courses. All the instructor objects can be returned based on the page number. By default, the page number is 1. Each page has a maximum of 20 instructors. At the bottom of the webpage, a page number list is shown. For each instructor, we can see all the courses this instructor teaches by clicking the Teach Courses button.
There are two buttons below the total number, that are Process Instructor Data button and Instructor Analysis Figure button. The Process Instructor will extract all the instructor information from the given data files and store instructors info into the user.txt file. This method may take a while to finish. The Instructor Analysis Figure button has similar functionality as the course analysis button.

Figure 3.10 Instructors page
7. Students page. In this page, the total number of students and a list of students will be displayed. Students¡¯ info are not extracted from the files but registered manually in the register page.
Figure 3.11 students page
Admin can click the details button to see students¡¯ details and click the delete button to remove this student (the student info will be deleted from the user.txt file).

If you login as a student, you can only see the MyInfo page.
Figure 3.12 Myinfo page when login as a student
3.2 Task 1 – design classes
You are required to implement the User class, Admin class, Instructor class, Student class, and Course class in the user.py, user_admin.py, user_instructor.py, user_student.py and course.py files respectively. The Admin, Instructor and Student class should inherit from the User class. The methods of each class are described below.
3.2.1 User class
1. constructor.
Five positional arguments: uid(int, default value is -1), username(str, default value is ¡°¡±), password(str, default value is ¡°¡±), register_time(str, default value is ¡°yyyy-MM-dd_HH:mm:ss.SSS¡±), role(str, default value is ¡°¡±). The role can only be value ¡°admin¡±, ¡°instructor¡± and ¡°student¡±.
2. __str__()->str.
Return string format example: ¡°uid;;;username;;;password;;;register_time;;;role¡±
3. authenticate_user()->bool.
Two positional arguments – username and password. This method is used to check whether username and password can be matched with users saved in user.txt data file. If matched, this method will return True, otherwise return False.

4. check_username_exist()->bool.
One positional argument – username. This method is to check whether the given username exists in the user.txt data file. If it exists, return True, otherwise return False.
5. generate_unique_user_id()->str.
This method is used to generate and return a 6 digit unique user id which is not in the user.txt file.
6. encrypt_password()->str.
One positional argument – password. For a given password, you are required to encrypt the string. You can reuse the encryption method in A1/A2 here.
7. register_user()->bool.
Four positional arguments – username, password, email, register_time, role.
o If the username exists in the user.txt file, return False.
o A unique user id is required when registering a new user.
o If the user registers successfully, return True.
o Register_time will be a unix epoch timestamp (milli seconds) which
needs to be converted using date_conversion() method.
o The new user needs to be written into the user.txt file. All the attributes are separated by three semicolons – ¡°;;;¡±. The registration of different
roles could generate different strings. The format example 1:
The format example 2:
(username: test_instructor, password: test_instructor)
The 9 semi-colons here indicate there are no values for display_name(str, default value is ¡°¡±), job_title(str, default value is ¡°¡±) and course_id_list(list, default value is []).
8. date_conversion()-> str.

One positional argument – register_time. The given register_time will be a unix epoch timestamp (milli seconds) and it needs to be converted to format ¡°year-month-day_hour:minute:second.milliseconds¡±. For example, a timestamp 1637549590753 will be converted to str ¡°2021-11-22_13:53:10.753¡± and returned. The time should be GMT+11 Melbourne timezone.
Refer this link https://www.unixtimestamp.com/index.php to check how to convert unix epoch time to human readable format. A method called get_day_from_timestamp(timestamp) is provided in the lib.helper file. By using this method, you can convert the timestamp to the day of month. You can import and use this method in the user.py file. It is not allowed to use any time-related libraries or functions here. You are required to implement the conversion by yourself.
9. validate_username()-> bool.
One positional argument – username. The username can only be letters or underscore. If not, return False.
10. validate_password()-> bool.
One positional argument – password. The length of password must be greater than or equal to 8. If not, return False.
11. validate_email()-> bool.
One positional argument – email. Use regex expressions to check whether the email address is valid or not. The email should end with ¡°.com¡±, contain and have length greater than 8. If not, return False.
12. clear_user_data() no return.
This method will remove all the data in the user.txt file.
13. Class variable current_login_user.
Default value is None. This variable is used to save the user object(Could be Admin, Instructor or Student object) after login. If the user is not logged in, the web application will redirect the web page to the index page.
3.2.2 Admin class
1. constructor.
This method has five positional arguments: uid(int, default value is -1), username(str, default value is ¡°¡±), password(str, default value is ¡°¡±), register_time(str, default value is ¡°yyyy-MM-dd_HH:mm:ss.SSS¡±) and role(int, default value is ¡°admin¡±).

2. __str__()->str.
Return string format example:
3. register_admin() no return.
This method will create a new admin account and write this account into the user.txt file.
3.2.3 Instructor class
1. constructor.
This method has 9 positional arguments: uid(int, default value is -1), username(str, default value is ¡°¡±), password(str, default value is ¡°¡±), register_time(str, default value is ¡°yyyy-MM-dd_HH:mm:ss.SSS¡±), role(str, default value is ¡°instructor¡±), email(str, default value is ¡°¡±), display_name(str, default value is ¡°¡±), job_title(str, default value is ¡°¡±) and course_id_list(list, default value is []).
2. __str__()->str.
Return string format example:
Example 1 (registered manually, so display_name=¡±¡±, job_title=¡±¡±, course_id_list=[]):
Example 2 (extracted from files):
3. get_instructors() no return.
This method will extract instructor information from the given course data files. Similar to the process of retrieving course data, but this method focuses on the instructor data of each course. In each course item, there could be multiple instructors.

After retrieving the required data, you need to write the info into user.txt file to save all the instructor data. Each attribute needs to be separated by ¡°;;;¡±. The required attributes and data format is: ¡°{instructor_id};;;{username};;;{password};;;{register_time};;;{role};;;{email};;;{ instructor_display_name};;;{instructor_job_title};;;{course_id_list}¡±. The username is generated by converting the display name to lowercase and replacing the whitespace to underscore. The password uses the instructor_id value directly. The email address is generated by combining the username and the All the course ids in the course_id_list will be connected to using two ¡°-¡± marks. The format is ¡°course_id–course_id–course_id¡±. If an instructor is already in the user.txt file, only update the course_id_list which saves the course this instructor teaches. The register_time uses the default value.
The auto-generated instructor accounts are different from the manually registered instructor account. Manually registered instructor accounts do not have any course_id_list. And, the display name and job title are empty. However, these accounts should have the same format in user.txt as the auto-generated accounts.
For example:
4. get_instructors_by_page()->tuple
One positional argument: page. This method reads the user.txt file to retrieve all the instructor information. With all the instructor information and the current page number, a list of Instructor objects and the total pages will be generated. Each page has at most 20 instructors. A tuple contains the list of instructors, total page number and the total number of instructors will be returned.
5. generate_instructor_figure1()->str
Generate a graph that shows the top 10 instructors who teach the most courses.(any chart)

In all the graphs, if the instructor display name is too long, you need to extract the first 3 words. The generate_instructor_figure1() method is required to return a string explanation about

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com