Assignment 2 (A2)
Due date: Friday, March 3, 2023 (11:59pm) Submission via Git only
Overview Programming environment ........................................................................................................................................1 Individual work ...........................................................................................................................................................2 Learning objectives .....................................................................................................................................................2 route_manager.py: Descriptive analytics about airline routes data ..........................................................................2 Restrictions .................................................................................................................................................................3 Testing your solution ..................................................................................................................................................3 What to submit ...........................................................................................................................................................4 Grading .......................................................................................................................................................................4 Scheme ...................................................................................................................................................................4 Scale ........................................................................................................................................................................5 Input specification ......................................................................................................................................................5 Output specification ...................................................................................................................................................6
Programming environment
For this assignment you must ensure your code executes correctly on the virtual machine or the programming environment (for M1\M2 computers) you configured as part of Lab 01. This is our “reference platform”. This same environment will also be used by the teaching team when evaluating your submitted work. You will have to make sure that your program executes perfectly on the reference platform. If your programs do not run on reference platform, your submission will receive 0 marks.
All test files and sample code for this assignment are available in the ‘a2’ folder of your git repository and you must use the git pull command to download a copy of the files: git pull
Individual work
This assignment is to be completed by each individual student (i.e., no group work). You are encouraged to discuss aspects of the problem with your fellow students. However, sharing of code fragments is strictly forbidden. Note SENG 265 uses highly effective plagiarism detection tools to discover copied code in your submitted work. Both, using code from others and providing code to others, are considered cheating.
Learning objectives
- Learn or review basic features of the Python 3 programming language.
- Use the Python 3 programming language to write an introductory data science project.
- Use Git to manage changes in your source code and annotate the evolution of your solution with messages provided during commits. Remember, the only acceptable way of submitting your work is using Git.
- Test your code against the provided test cases.
route_manager.py: Descriptive analytics about airline routes data
a) In A2, route_manager is a small program that uses relevant Python structures and libraries to
process airline routes data to produce descriptive analytics.
b) Based on provided arguments and data files (i.e., datasets), route_manager.py will help us
answer the following questions:
q1: What are the top 20 airlines that offer the greatest number of routes with destination
country as Canada?
q2: What are the top 30 countries with least appearances as destination country on the
routes data?
q3: What are the top 10 destination airports?
q4: What are the top 10 destination cities?
q5: What are the unique top 10 Canadian routes (i.e., if CYYJ-CYVR is included, CYVR-CYYJ
should not) with most difference between the destination altitude and the origin altitude?
c) The format of the arguments used for the program is similar to the one used for Assignment 1
(A1). A formal description of the inputs is described at the end of this document.
d) The output of your program WILL NOT be directed to stdout. After each execution, your program
must generate two files:
a. q
Restrictions
- Your program must run as a script.
- Your program must be decomposed into easy-to-understand components. Good program
- decomposition is required. Methods or functions must be short and effectively parameterized.
- Unwieldy functions are not accepted. The main function should especially be easy to understand and represent a decomposition of the problem at hand.
- Typing (i.e., type hints) must be used in variables and functions defined in your program.
- Do not use global variables.
- You can only use Python modules and libraries that DO NOT require additional installations on the reference platform. As part of the installation and configuration of the reference platform,
- we included relevant libraries for managing data such as numpy and pandas. The latter might be very useful to answer the assignment questions (i.e., q1, q2, q3, q4, and q5). For visualization purposes, matplotlib was also installed. For your reference, you can find all the Python modules\libraries installed in lines 54-64 in the Vagrantfile. Failing to comply with this restriction will result in significant lost marks or even 0 marks for the assignment.
- Keep all your code in one file (route_manager.py) for this assignment. In Assignment 4 we will
- use the multi-module features of Python.
Testing your solution
- This time the tester file will execute your program automatically. You’ll only need to pass the number of the question as an argument (e.g., ./tester 1). If no arguments are passed to the tester file (i.e., ./tester), it will run the tests for all the questions. Using a specialized library that compares the differences between .csv files, the tester file will describe the differences between the expected output and the one provided by your program.
- Refer to the example commands in the file “TESTS.md” for appropriate command line input. Your solution must accommodate all specified command line inputs.
- Make sure to use the test files provided as part of this assignment.
- Use the test files and listed test cases to guide your implementation effort. Develop your program incrementally. Save stages of your incremental development in your Git repository.
- For this assignment you can assume all test inputs are well-formed (i.e., exception handling is not required).
- DO NOT rely on visual inspection. You can use the provided tester file so you can verify the validity of your outputs in a simpler manner.
What to submit
A single Python source file named “route_manager.py” submitted (i.e., Git push to your remote repository) to the a2 folder in your repository.