[SOLVED] CS253 Assignment 2

30.00 $

Category: Tags: ,
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon cs253_assign_2-iiyrh0.zip (150.2 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
đź”’ Securely Powered by:
Secure Checkout
Rate this product

Assignment 2: Advanced Bash Scripting

We will be using the shell commands to accomplish a simple task here. The task is related to covid data extracted from www.covid19india.org. Download the json(you may use wget) from https://api.covid19india.org/v4/data.json. Name the file as covid_Data.json and place it in the home folder of the unzipped cs253_assign_2.zip.

Following is a small snippet showing how to access json data using jq(may have to install separately). Following is a sample json:

{
“A” : ”a”,
“B” : “b”,
“C” : “c”,
“D” : {

“d” : “4”

} }

To retrieve the value “c” one way to get is: –
jq “.C|values” <path_Of_The_JSON_File> –output c To retrieve the value “4” we get it like this: –
jq “.D.d|values” <path_Of_The_JSON_File> –output 4

Task

Explore and access the downloaded covid_Data json file from within the solution shell file. Make a csv file named processed_Covid_Data_<your_Roll_Number>.csv. with the format as shown,

<state>, <district>, <confirmed_Cases>, <recovery_Rate> where,

  • state is the state code, example AN, KA etc.,
  • district is the district name with maximum recovery rate,
  • confirmed_Cases is the number of confirmed cases for this district name
          (district with max recovery rate),
    
  • recovery_Rate is the recovery rate for this district name (district with

Note:

max recovery rate).
Recovery rate is calculated as [(recovered/confirmed) * 100]

Consider the following while performing the task:

• For every state code, consider districts with more than or equal to 5000 number of confirmed cases for processing, ignoring the rest.

  • Avoid including the state code entry in csv, if the number of confirmed cases for all of its districts is less than 5000.
  • While processing, you may get “Unknown” as a district name, ignore the processing for that district. In the csv, we should not have “Unknown” as a district name for any state code.
  • Recovery rate may be equal for two districts, include the one in csv that comes later while processing. Example, for a state code(st), db district (98 percent recovery rate) and da (98 percent recovery rate) are there, csv should consist of da as the district name.
  • Ignore errors at any stage (you may create log file).
  • You may add headers to the generated csv file if you wish.

    A csv file for a sample data on marks shown below, —————————————————————————–

Name Marks_Sub_1 Marks_Sub_2 Preeti 25 31
Ravi 25 30
Ankit 24 31

—————————————————————————– looks like this,

Preeti,25,31
Ravi,25,30
Ankit,24,31
  • cs253_assign_2-iiyrh0.zip