首页 > > 详细

代做COMP9321 20T1作业、代写data课程作业、代做Java语言作业、代写Java编程设计作业代写留学生Prolog|代做Processing

2020/3/20 Assignment-2 | COMP9321 20T1 | WebCMS3
Assignment-2
Assignment Specification
The data service should use JSON format to publish its data and implement following operations.
Question-1: Import a collection from the data service (2.5 marks)
This operation can be considered as an on-demand 'import' operation. The service will download the JSON
data for all countries (http://api.worldbank.org/v2/countries/all/indicators/NY.GDP.MKTP.CD?
date=2012:2017&format=json&per_page=1000) respective to the year 2012 to 2017 and identified by the
indicator id given by the user and process the content into an internal data format and store it in the database;
use sqlite for storing the data (the name of the database should be YOURZID.db ) .
For example, the following link can be used to obtain data for the indicator called: NY.GDP.MKTP.CD
(http://api.worldbank.org/v2/countries/all/indicators/NY.GDP.MKTP.CD?
date=2012:2017&format=json&per_page=1000)
http://api.worldbank.org/v2/countries/all/indicators/ NY.GDP.MKTP.CD ?
date=2012:2017&format=json&per_page=1000
(http://api.worldbank.org/v2/countries/all/indicators/NY.GDP.MKTP.CD?
date=2012:2017&format=json&per_page=1000)
To import data your require an indicator as a parameter given by the API user. The parameter should be a
query parameter named:
indicator_id : an indicator (http://api.worldbank.org/v2/indicators) http://api.worldbank.org/v2/indicators
(http://api.worldbank.org/v2/indicators)
After importing the collection, the service should return a response containing at least the following information:
uri : the URL with which the imported collection can be retrieved
id : a unique integer identifier automatically generated
creation_time : the time the collection stored in the database
Example:
HTTP operation: POST /collections?indicator_id=NY.GDP.MKTP.CD
Returns: 201 Created
Specification Make Submission Check Submission Collect Submission
2020/3/20 Assignment-2 | COMP9321 20T1 | WebCMS3
https://webcms3.cse.unsw.edu.au/COMP9321/20T1/resources/43071 2/5
{
"uri" : "/collections/1",
"id" : 1,
"creation_time": "2019-04-08T12:06:11Z",
"indicator_id" : "NY.GDP.MKTP.CD"
}
You should return appropriate responses (JSON formatted) in case of already imported collections,
invalid indicators or any invalid attempts to use the endpoint ( e.g. If the input indicator id doesn't exist in
the data source, return error 404 )
Question 2- Deleting a collection with the data service (2.5 marks)
This operation deletes an existing collection from the database. The interface should look like as below:
HTTP operation: DELETE /collections/{id}
Returns: 200 OK
{
"message" :"The collection 1 was removed from the database!",
"id": 1
}
3 - Retrieve the list of available collections (2.5 marks)
This operation retrieves all available collections. The interface should look like as like below:
"order_by" is a comma separated string value to sort the collection based on the given criteria. Each segment
of this value indicates how the collection should be sorted, and it consists of two parts (+ or -, and the name of
column e.g., id). In each segment, + indicates ascending order, and - indicates descending order. Here are
some samples:
+id,+creation_time order by "id ascending" and then "creation_time ascending"
In this case sorting by "id" has priority over "creation_time "
-creation_time order by "creation_time descending"
Returns: 200 OK
HTTP operation: GET /collections?order_by={+id,+creation_time,+indicator,-id,-creation_time,-in
2020/3/20 Assignment-2 | COMP9321 20T1 | WebCMS3
https://webcms3.cse.unsw.edu.au/COMP9321/20T1/resources/43071 3/5
[
{
"uri" : "/collections/1",
"id" : 1,
"creation_time": "2019-04-08T12:06:11Z",
"indicator" : "NY.GDP.MKTP.CD"
},
{
"uri" : "/collections/2",
"id" : 2,
"creation_time": "2019-05-08T12:16:11Z",
"indicator" : "2.0.cov.Math.pl_3.all"
},
...
4 - Retrieve a collection (2.5 marks)
This operation retrieves a collection by its ID . The response of this operation will show the imported content
from world bank API for all 6 years. That is, the data model that you have designed is visible here inside a
JSON entry's content part.
The interface should look like as like below:
HTTP operation: GET /collections/{id}
Returns: 200 OK
{
"id" : 1,
"indicator": "NY.GDP.MKTP.CD",
"indicator_value": "GDP (current US$)",
"creation_time" : "2019-04-08T12:06:11Z"
"entries" : [
{"country": "Arab World", "date": 2016, "value": 2500164034395.78 },
{"country": "Australia", "date": 2016, "value": 780016444034.00 },
...
]
}
5 - Retrieve economic indicator value for given country and a year (2.5 marks)
The interface should look like as like below:
HTTP operation: GET /collections/{id}/{year}/{country}
Returns: 200 OK
2020/3/20 Assignment-2 | COMP9321 20T1 | WebCMS3
https://webcms3.cse.unsw.edu.au/COMP9321/20T1/resources/43071 4/5
Resource created 22 days ago (Thursday 27 February 2020, 12:54:52 PM), last modified about 2 hours ago (Friday 20 March
2020, 01:12:01 PM).
{
"id": 1,
"indicator" : "NY.GDP.MKTP.CD",
"country": "Arab World",
"year": 2016,
"value": 780016444034.00
}
6 - Retrieve top/bottom economic indicator values for a given
year
(2.5 marks)
The interface should look like as like below:
HTTP operation: GET /collections/{id}/{year}?q=
Returns: 200 OK
{
"indicator": "NY.GDP.MKTP.CD",
"indicator_value": "GDP (current US$)",
"entries" : [
{
"country": "Arab World",
"value": 2500164034395.78
},
...
]
}
The is an optional integer parameter which can be either of following:
+N (or simply N) : Returns top N countries sorted by indicator value (highest first)
-N : Returns bottom N countries sorted by indicator value
where N can be an integer value between 1 and 100. For example, a request like " GET /collections/1 /2015?
query=+10 " should returns top 10 countries according to the id.
Notice:
Your code must implemented in flask-restplus and automatically generate swagger doc for testing the
endpoints.
Your code must be executable in CSE machines
Your code must not require installing any software (python libraries are fine)
Your code must be written in Python 3.5 or newer versions.
Your operations (API methods) must return appropriate responses in JSON format, and appropriate
HTTP response code! e.g., 500 Internal Server Error is inappropriate response!
Comments
2020/3/20 Assignment-2 | COMP9321 20T1 | WebCMS3
https://webcms3.cse.unsw.edu.au/COMP9321/20T1/resources/43071 5/5
There are no comments yet.
  (/COMP9321/20T1/forums/search?forum_choice=resource/43071)
 (/COMP9321/20T1/forums/resource/43071)
 Add a comment

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codehelp

联系我们 - QQ: 99515681 微信:codinghelp
© 2014 www.7daixie.com
程序代写网!