0% found this document useful (0 votes)
20 views6 pages

COMP3161 Lab 3

The document outlines the requirements for a lab assignment involving the extraction and storage of shopper data from a CSV file into a MySQL database. It specifies the submission of a SQL script, a data generation script, a Flask API, and a Postman collection with various endpoints for managing customer data. The endpoints include functionalities for retrieving customer information, adding customers, updating professions, and generating income reports based on specified criteria.

Uploaded by

xdonjaex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views6 pages

COMP3161 Lab 3

The document outlines the requirements for a lab assignment involving the extraction and storage of shopper data from a CSV file into a MySQL database. It specifies the submission of a SQL script, a data generation script, a Flask API, and a Postman collection with various endpoints for managing customer data. The endpoints include functionalities for retrieving customer information, adding customers, updating professions, and generating income reports based on specified criteria.

Uploaded by

xdonjaex
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

COMP3161

LAB 3

​ ​ ​ ​ Due Date: Mar 23 11:59 PM 2023

Problem

You are given a dataset on shoppers (Customers.csv). A company has approached


you to extract this data and store it in a database. You decide to create a mysql
database. The company also has a mobile app and requires an API that can be used to
get the data. You are required to create a script that can extract the data and to store it
in an sql database. You are also required to create an API with the specifications
outlined below.

What to submit.

1.​ A sql script that creates the table and inserts the data into the table. It is your job
to figure out how to generate this script. (Your are free to the name the table
and the database whatever you wish)
2.​ Submit whatever script you used to generate the insert queries if one was used.
E.g a python script.
3.​ Flask api
4.​ A postman collection with the following endpoints.

Submit everything in a zip file named with your id number. E.g 6200000.zip
a.​ /customers [GET]
This should return all the customers in the following format.

b.​ /customer/<customer_id> [GET]


This should return a shopper with the specified id. If no shopper is found
an appropriate error message should be returned.
c.​ /add_customer [POST]
This should allow a shopper to be added to the database. The endpoint
should accept a body in the following format. An appropriate success
message should be returned.

d.​ /update_profession/<customer_id> [PUT]

This should allow a customer’s profession to be added with the specified


customer id. The endpoint should accept a body with the following format.
An appropriate success message should be shown.

{
"Profession": “HealthCare”
}

e.​ /highest_income_report [GET]
This should return a report with the highest income earners by profession.
[
{
"CustomerID": 3,
"AnnualIncome": 100000,
"Profession": "Healthcare"
},
{
"CustomerID": 10,
"AnnualIncome": 40000,
"Profession": "Executive"
},
{
"CustomerID": 5,
"AnnualIncome": 20000,
"Profession": "Lawyer"
}
]

f.​ /total_income_report [GET]


This should show the total income earned by profession.
[
{
"TotalIncome": 100000,
"Profession": "Healthcare"
},
{
"TotalIncome": 503030000,
"Profession": "Executive"
},
{
"TotalIncome": 1300404000,
"Profession": "Lawyer"
}
]

g.​ /average_work_experience [GET]


This should show the average work experience by profession for
customers that are young high earners. A young high earner is one which
makes over $50,000 and is younger than 35 years old.
[
{
"AverageExperience": 4,
"Profession": "Healthcare"
},
{
"AverageExperience": 2,
"Profession": "Executive"
},
{
"AverageExperience": 5,
"Profession": "Lawyer"
}
]
h.​ /average_spending_score/<profession> [GET]

This should show the average spending score by gender for the profession
specified. E.g. /average_spending_score/engineers would return the average
spending score by gender for engineers. Output should look as follows

[
{
"Gender": "Male",
"AverageSpendingScore": 20
},
{
"Gender": "Female",
"AverageSpendingScore": 30
}
]
​ ​

You might also like