Individual Assignment 1 Quarantine Data Dashboard
Data sources
A three-week piece of work, designed to:
Copyright By PowCoder代写 加微信 powcoder
build familiarity with various aspects of Django and deploying to Heroku.
build experience in consuming 3rd party APIs and working with JSON- formatted data.
And to practise with small examples of key agile artefacts:
Vision Statement
Wireframe UI Prototypes
Product Backlog as a set of User Stories
COMP3297: Software Engineering
Build a small web-based product that will retrieve data from 3rd party APIs, calculate derived data, and display.
The product is intended as a preliminary version of a dashboard that will be used by members of the HKSAR Covid Task Force dealing with quarantine issues.
It will query two DATA.GOV.HK data sources maintained by the Department of Health to obtain the most recently reported occupancy data from quarantine centres.
It will summarize the data and will check the consistency of the number of persons reported to be in quarantine by each data source.
COMP3297: Software Engineering 3
Establish the Vision Create UI wireframes Initial Product Backlog Explore APIs
Explore useful libraries/packages
Refine Vision
Refine Backlog Explore Template Python spikes Implement on Django
Assemble full set of User Stories Final Deployment
Construction
Transition
Wireframes [March 1]
Vision Statement
Full Backlog as User Stories Deployed Product URL Product Source Code
[March 15] 4
COMP3297: Software Engineering
DELIVERABLES
Data Sources: DATA.GOV.HK
Data Provider: Department of Health
COMP3297: Software Engineerin 5
https://data.gov.hk/en-data/dataset/hk-dh-chpsebcddr-novel-infectious-agent
Minimal Data Dictionary – source for data formats, types, and descriptions
COMP3297: Software Engineering
Data sources we’ll use
COMP3297: Software Engineering
https://data.gov.hk/en-data/dataset/hk-dh-chpsebcddr-novel-infectious-agent/resource/7f34f165-49d1-4348-bf8c-bbbe41cc3cec
URL of the resource we’ll use
To explore query string format
COMP3297: Software Engineering 8
https://data.gov.hk/en-data/dataset/hk-dh-chpsebcddr-novel-infectious-agent/resource/e494801b-00fc-4a74-87fe-07affddb0213
URL of the resource we’ll use
To explore query string format
COMP3297: Software Engineering 9
Using the Query Builder (API 1)
Query builder. Specify filtering and sorting rules here
See resulting query here
COMP3297: Software Engineering 10
Rule example
Resulting query in URL of request
Result from response
COMP3297: Software Engineering 11
API endpoint
Specification for JSON object to be encoded as query string
COMP3297: Software Engineering 12
Example from the API Spec of what you need to specify
See earlier slides
Check from builder
See columns in Data Dictionary
COMP3297: Software Engineering 13
During Inception: Make sure you understand the API
Drive down risks in working with the API
Review the DATA.GOV.HK API Spec.
Determine the required name/value pairs for the JSON string argument you’ll
use to assign a value to the query string parameter q. Confirm as follows: Use the API Builder to generate a query request.
Examine the generated URL and the key/value pairs passed in the query string. E.g.
q=%7B%22resource%22%3A%22http%3A%2F%2Fwww.chp.gov.hk%2Ffiles%2Fmi sc%2Foccupancy_of_quarantine_centres_eng.csv%22%2C%22section%22%3A1% 2C%22format%22%3A%22json%22%2C%22filters%22%3A%5B%5B1%2C%22eq% 22%2C%5B%2213%2F02%2F2022%22%5D%5D%5D%7D
This is, of course, URL-encoded. You can decode it, or just examine it directly to identify the name/value pairs in the serialized JSON object.
COMP3297: Software Engineering 14
During Construction: Make sure you can use the API
Drive down risks in making actual GET requests against the APIs
Write Python scripts to check you can retrieve the required quarantine data successfully for both APIs. In Inception you confirmed the format of the JSON object. Now you can write a Python script to make an identical query.
Create a Python dictionary containing key/value pairs required in the JSON string. Serialize the dict object to a JSON formatted string. JSON encoding/decoding is provided
by the built-in Python module json.
Use the function json.dumps() to serialize your dict object.
Then build the URL for the GET request specifying the API endpoint and a query string assigning your JSON string as the value associated with key q
Simplest way to do this is to use the Requests library which elegantly wraps many of the useful functions of urllib package modules. Or just use urllib modules if you prefer.
Using Requests, the function requests.get() will build, URL-encode, and make the GET request.
COMP3297: Software Engineering
During Construction: check it is working
You now have a Response object.
Requests contains a built-in JSON decoder. You can use this to deserialize to dicts from which you can extract the values of interest.
The names for the name/value pairs in the response content can be seen on the next slides, and in the data dictionary.
Or you can use the function json.loads() from the json module to deserialize the JSON formatted string of the response content.
Now check that you got what you expected, as shown on the following slide
In your actual application, the user wants to know if the request made to the API endpoint was successful. To do that, you must check the status code in the response.
For a response object resp, this can be obtained as resp.status_code if using Requests, or resp.status if using urllib (version 3.9 onwards)
Each entire script is just a few lines of Python.
COMP3297: Software Engineering 16
COMP3297: Software Engineering 17
COMP3297: Software Engineering 18
COMP3297: Software Engineering 19
For an easy life:
Don’t be a Deadline Fighter. You will have 3 weeks. If you leave everything until Transition you will die!
Keep it simple. All that is required is an MVP. The simpler the solution, the easier the deployment.
We will test your deployed solution. Don’t assume your deployment is guaranteed to go smoothly – that would be taking a big risk.
Even if you still need to refine your code, deploy a version early in Transition.
COMP3297: Software Engineering 20
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com