COVID19 VACCINE SHOTS ANALYSIS USING SQL

In this post, I use a simulated hospital database from Synthea to extract covid19 data using SQL.

pasted-movie.png

In this table, data of covid shots is among other shots like flu, hepa.. I select covid data and merge the table with patient data from Patients table as follow:

pasted-movie.png

Many patients have two shots apart a couple of weeks, few patients just have only one shot as in the red frame. I will create new columns showing first shots and second shots as well as the date for the first and second shots.

Patients who have 2 shots will have date2 data, otherwise date2 data is ‘null’.

pasted-movie.png

I want to count numbers of shots. Data shows 65 first shots and 61 second shots, so there are 4 patients just have their first shots.

pasted-movie.png

I now create a new column called ‘interval’ for days apart between first and second shots. I just keep rows with full data having ‘times’ = 1 and get rid of rows with ‘times’ = 2. The SQL commands as follow:

I save out this table to a local directory called ‘covid19’ then connect to Tableau for analyzing and visualizing.

pasted-movie.png

Summary

There are 61 patients having two shots, 4 patients having just one shot. The average interval between the two shots is 23.9 days. The numbers of patients by their gender and race as following:

pasted-movie.png