Giter Site home page Giter Site logo

rhlkumar728 / covid_data Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5.51 MB

In this project we will be Analyzing covid data, Coming from covid19india.org, The data is coming in json and then we are converting it into Csv and then doing analyzing in MSSQL and then Making Dashboard on Excel

HTML 0.01% Jupyter Notebook 100.00%

covid_data's Introduction

Covid_Data

In this project we will be Analyzing covid data, Coming from covid19india.org, The data is coming in json and then we are converting it into Csv and then doing analyzing in MSSQL and then Making Dashboard on Excel

Data Defination

#Delta: Data of that same day #Delta7: 7 days Moving Avaerage data #Total: Moving total of Tested,Recovered,deceased

Dashboard Screenshot

image image

SQL Code and Table

#1 Create Pivot select * from( select State,year(Date)as Year,DATENAME(MONTH,date) as Month,Date, Type,COALESCE(Tested,0)as Tested,COALESCE(Confirmed,0)as Confirmed, COALESCE(Recovered,0)as Recovered,COALESCE(Deceased,0)as Deceased,COALESCE(Vaccinated1,0)as First_Vaccine, COALESCE(Vaccinated2,0)as Second_Vaccine,Datepart(Month,date) as Month_Num from( select * from( select * from date ) as d pivot ( sum([Count]) for [Operation] in([Tested],[Confirmed],[Recovered],[Deceased],[Vaccinated1],[Vaccinated2]) ) as e ) as f ) as g group by State,Year,Month,Date,Type,Tested,confirmed,recovered,Deceased,First_Vaccine,Second_Vaccine,Month_num

image

#2 Storing into View to Work on it

create view covid as( select * from( select State,year(Date)as Year,DATENAME(MONTH,date) as Month,Date, Type,COALESCE(Tested,0)as Tested,COALESCE(Confirmed,0)as Confirmed, COALESCE(Recovered,0)as Recovered,COALESCE(Deceased,0)as Deceased,COALESCE(Vaccinated1,0)as First_Vaccine, COALESCE(Vaccinated2,0)as Second_Vaccine,Datepart(Month,date) as Month_Num from( select * from( select * from date ) as d pivot ( sum([Count]) for [Operation] in([Tested],[Confirmed],[Recovered],[Deceased],[Vaccinated1],[Vaccinated2]) ) as e ) as f ) as g group by State,Year,Month,Date,Type,Tested,confirmed,recovered,Deceased,First_Vaccine,Second_Vaccine,Month_num );

#3 State Total Date of Delta,Delta7,Total

select State as State_code,type,Tested,Confirmed,Recovered,Deceased,First_Vaccine as Vaccinated1,Second_Vaccine as Vaccinated2 from( select * , DENSE_RANK()over(Partition by state order by date desc) as rank from covid ) as d where rank=1

image

#3 Weekly Evolution of data

select Year, Month,week,Tested,Confirmed,Deceased,Recovered from( select Year,Month,Month_Num,ceiling (cast(datepart(dd,date)as numeric(38,8))/7) as week ,Sum(Tested) as Tested ,sum(Confirmed) as Confirmed,Sum(Recovered) as Recovered,Sum(Deceased) as Deceased from covid where state='TT' and type='Delta7' group by Year,Month,ceiling (cast(datepart(dd,date)as numeric(38,8))/7),Month_Num )as d order by year,Month_Num,Month,week

image

-----Worst Month With Respect to Highest confirmed Cases ----- Using TOP1

select Top 1 Year, Month,Tested,Confirmed,Deceased,Recovered from( select Year,Month,Month_Num ,Sum(Tested) as Tested ,sum(Confirmed) as Confirmed,Sum(Recovered) as Recovered,Sum(Deceased) as Deceased from covid where state='TT' and type='Delta' group by Year,Month,Month_Num )as d order by Confirmed desc

image

-----State Data with First and Second Vaccine Percentage and Death and Recovery rate of Each State

select *, (convert(float,Deceased)/convert(float,Confirmed))*100 as Death_Rate, (convert(float,Recovered)/convert(float,Confirmed))*100 as Recovery_Rate from( select *,convert(decimal(5,2),(convert(float,Vaccinated1)/convert(float,population)))*100 as First_Vaccine_Percent, convert(decimal(5,2),(convert(float,Vaccinated2)/convert(float,population)))100 as Second_Vaccine_Percent from( select s.,population from state_total as s Join population as p on p.state_code=s.State_code ) as d where type='Total' ) as e order by First_Vaccine_Percent desc

image

And so on, Rest you can Check SQL File

covid_data's People

Contributors

rhlkumar728 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.