Python代写|COMP0035 Coursework 2 LSA Specification

这是一篇来自美国的python代写

 

Introduction

This is an individual assessment and is worth 60% of the marks available for the module. This is an alternative assessment as the requirements of the LSA are that a new assessment be set. This LSA version is not related to coursework 1 and you will not use a dataset.

You should expect that this coursework will take 20-25 hours to complete. This is calculated based on the 150 learning hours (learning + assessment) expected for an average module https://www.ucl.ac.uk/module-catalogue/glossary-terminology#learning-hours). COMP0035 was designed with the expectation that you would spend the following time on coursework:

  • 5 hours per week (all weeks except reading week)
  • 7 hours during reading week
  • 10 hours during Christmas period

Technologies to use

You must use Python.

You should use markdown for text and to provide links to each of the items. If you cannot do this then a document saved in PDF format will be accepted.

You do not need to use GitHub for source code control, though you are strongly encouraged to do so.

What you need to create

Create a python project folder e.g. ‘comp0035_lsa’ and include all the files within that.

Ideally add your project folder and files to a repository in GitHub.

Create a markdown document and in it provide evidence for the items listed below by adding text where appropriate or a hyperlink to file (e.g. to a python test code file, a PDF of a persona, etc). If you cannot write in markdown then create the document in another format and save it as a PDF for the coursework submission.

The items to create for the coursework are listed as follows with more detailed instructions in the subsequent sub-sections.

  1. Requirements analysis
  2. User interface design
  3. Application design
  4. Testing

3.1 Requirements analysis

Mandatory: Using an appropriate Agile user story format, write between 5 and 10 user stories based on the following scenario and persona. The user stories should be consistent with the scenario and persona given below. Prioritise the user stories using an appropriate prioritisation technique.

The persona and scenario are written for a project to develop a website, wimbledondata.org, that will provide data and analysis on the Wimbledon tennis tournament.

Optional: Other techniques may be useful to model and understand the project’s requirements e.g. UML use cases, UML activity diagrams etc. If you wish to you can use any appropriate additional techniques.

3.1.1 Persona

George is 52 and lives in South West London and works as a freelance sports writer. He grew up playing tennis, hockey, golf and also enjoyed athletics. He played tennis competitively at school and university but now just plays casually with friends.

He is inspired by professional players of his youth such as John McEnroe, Ivan Lendl and Björn Borg and resonates with their passion and drive.

His goal is to become a sports editor for a major media organisation such as the BBC and report and edit stories for major tennis tournaments.

He is frustrated that it is difficult to analyse tennis match data as much of the data is in a raw format and not easy to analyse without specialist programming and statistical skills (which he does not have).

He does not like web sites that have complicated layouts. He likes to be able to visualise data and see general trends before being able to narrow down to specific data/details. He also dislikes having to go to lots of different sites in his research for example going to different places for player biographies; match statistics; tournament statistics etc.

3.1.2 Scenario

  1. It’s Monday morning and George is working at his laptop in his home office. He wants to do some research before the start of the Wimbledon tournament to give him some ideas for potential stories and match analysis.
  2. George Google’s ‘Wimbledon data dashboard’ and visits the top result in the search which is wimbledondata.org
  3. He looks at an overview of Wimbledon tournaments over the last 50 years. He decides to focus on the last decade.
  4. He looks at the analysis for the mens finals and finds the player who has had most success. He tries to see what the variables are that affected their success, perhaps speed of play, the weather, or who they were drawn to play against.
  5. He decides to bookmark the data visualisation that he has tailored so that he can return to it later. To do this he has to create an account on the website by entering his email address and password. Once the account is created he is automatically logged in and can then save the visualisation.
  6. He finds a player he is interested in and clicks on their name to be taken to a bio page for that player. He downloads the player bio in a text format that will be easy to copy facts from for his articles.

3.2 User interface design

Create wireframes to model the user interface for the web application. The user interface refers to the web pages that the target audience using your web app/data visualisation dashboard will see.

There are no marks for creating digital wireframes rather than hand drawn wireframes. Chose the format you find easiest to work with.

There are no marks for colour/artistic design or novel interface interactions. Focus on the structure and information flow.

Consider whether you are designing for mobile or desktop use (this will depend on your target audience).

3.3 Application design

Assume that the web app will be created using Flask.

Mandatory: Design the routes and controller functions. See guidance from page 7 of this document on Moodle https://moodle.ucl.ac.uk/pluginfile.php/4310590/mod_folder/content/0/ht_application_design.pdf?forcedownload=1 which is in COMP0035_21-22 > Further resources > All ‘how to…’ guides in PDF format section on Moodle.

Optional: Create any other application design models you wish e.g. a UML class diagram, an ERD for a database.

3.4 Testing

Mandatory

  1. Select and install an appropriate unit testing library (e.g. unittest or pytest)
  2. Create an appropriately named test directory in your project
  3. Write at least four (4) tests to test the SportsPerson and/or TennisPlayer classes
  4. Run the tests and provide evidence of the results (e.g. screenshot).

Consider the quality of your Python test code. Code quality is covered in the course materials on Moodle.

Optional: Create and use a continuous integration pipeline using GitHub Actions or similar. There are template pipelines in GitHub actions that will configure and run pytest unit tests as well as tools such as linters.

3.4.1 Python class code for testing

Create a python file called ‘tennis.py’ and add the following code to it. You will likely have to reformat the text once it is copied into python.

The code has not been tested and so may contain errors!

from datetime import date

class SportsPerson(object):

“””Creates a generic sports person.

    Attributes

    ———-

    name : str

        First name

    surname : str

        Last or family name

    birthdate : datetime.date

        Date of birth in datetime.date format e.g. datetime.datetime(2020, 5, 17) which is 17th May 2020

    nation : str

        The nation or country they represent in their chosen sport which may differ from their nationality at birth

    sport : str, optional

        The sport they play

    “””

  def __init__(self, name, surname, birthdate, nation, sport=None):

self.name = name

self.surname = surname

self.birthdate = birthdate

self.nation = nation

self.sport = sport

@property

def age(self):

“””Returns the current age calculated from the birthdate and today’s date”””

        today = date.today()

age = today.year – self.birthdate.year

if today < date(today.year, self.birthdate.month, self.birthdate.day):

age -= 1

return age

@property

def fullname(self):

“””Returns the full name”””

        return self.name + ‘ ‘ + self.surname

def __repr__(self):

return f’SportsPerson(name={self.name}, surname={self.surname}, birthdate={self.birthdate}, nationality=’ \

f'{self.nation}, sport={self.sport})’

def __str__(self):

return f’The sports person\’s name is {self.fullname}. Their birthdate is {self.birthdate} and ‘ \

f’current age is {self.age}. They represent {self.nation} in the sport of {self.sport}.’

class TennisPlayer(SportsPerson):

“””

    Creates a tennis sports person.

    Inherits the attributes from SportsPerson. The ‘sport’ attribute is set to tennis. The ranking points attribute

    can be set, if it is not set it should default to zero.

    “””

    def __init__(self, name, surname, birthdate, nation, sport, ranking_points=0):

super().__init__(name, surname, birthdate, nation, sport)

self.sport = “tennis”

self.ranking_points = ranking_points

def update_ranking_points(self, points_change):

“””Updates the ranking points.

        Should accept increases or decreases to the points but should not go below zero”””

        self.ranking_points += points_change

def __str__(self):

return f’The tennis player\’s name is {self.fullname}. Their birthdate is {self.birthdate} ‘ \

‘and current age is {self.age}. They represent {self.nation} and their current ranking is {‘ \

‘self.ranking_points}.’

def __repr__(self):

return f”TennisPlayer((name={self.name}, surname={self.surname}, birthdate={self.birthdate}, nationality=’ \

f'{self.nation}, sport={self.sport}, ranking_points={self.ranking_points})”

4.Submission

  1. Create a zip file

When you have created everything listed in section 3, create a single.zip file with all of the coursework contents. If you used GitHub then this provides an option to download a repository as a zip. Do not include the venv or other unnecessary files in the zip.

  1. Upload the zip file to Moodle

Upload the .zip to Moodle in the LSA submission location. The email you received informing you of this coursework should have provided a link to the relevant location. The email you received also stated the deadline date and time.

Check the Moodle file size upload limit well before the deadline to ensure you don’t exceed it.

Late submission rules apply.