Sale!

DSCI 551 Homework #1 (Firebase) SOLVED

Original price was: $40.00.Current price is: $35.00.

Category:

Description

5/5 - (1 vote)

Consider the air quality index provided to you as a zip file named aqi.zip which contains aqi.csv. The file
has four columns: date, country, status, aqi value.
1. Write a Python script stat.py that computes the average AQI value of each country from July
2022 to January 2023 (note some months might not have data for every day of the month).
Output the results in a JSON file in the following format:
[{“Country”: “Albania”, “Year”: 2022, “Month”: 7, “Avg AQI”: 32.9}, …]
Execution format: python3 stat.py aqi.csv aqi.json
Where aqi.json is the output JSON file.
2. Write a Python script load.py that load the aqi.json produced in step 1 into your Firebase
database.
Execution format: python3 load.py aqi.json <database-url>/aqi.json
Where <database-url> is the base URL of your Firebase database, e.g.,
https://dsci551-default-rtdb.firebaseio.com/.
3. Write a Python script search.py that outputs countries’ names along with the corresponding
month and year if the average AQI falls in the given range.
Execution format: python3 search.py <database-url>/aqi.json 20 30
This will find all countries (with months and years) whose average AQI is between 20 and 30,
inclusive. You can expect the second argument would always be smaller than or equal to the
third argument. You can also expect the .indexOn has been set properly.
Allowed python packages: sys, pandas, requests, json
Hints: when grading, we only run the above execution codes (e.g. ‘python3 stat.py aqi.csv aqi.json’) in
our terminal and check whether your code gives the desired output.

Submission:

1. 3 .py files, no .ipynb files
2. Do not zip your files
3. Do not submit any other files except the 3 .py files
4. If your code does not run, you will get 0 points
5. Submit your work by the deadline. No exceptions will be made!