Sam Trenholme's webpage
Support this website

COVID-19 Website

 

July 14 2020

I have created an entire website showing COVID-19 growth rates. This website is being updated every day. 617 words

==The website==

The website is here:

https://www.samiam.org/COVID-19/
The dashboard first shows a heat map of the United States; it shows which states are experiencing the most COVID-19 growth, with red indicating high growth and green indicating low growth.

Below this, I link to a graph showing the growth rate (doubling time, actually) for the US as a whole. From that page, it is possible to go to a page for each state, such as California or Florida. In addition, we have a page for each and every county in the US, such as San Diego county or Miami-Dade county.

In addition, while county-level graphs are not available, it is possible to look at overall deaths in the US, as well as death rates for each state such as California or Texas.

Also included is case data for “Red states” (states where the governor is a Republican)1 and “Blue states” (states where a Democrat occupies the governor’s mansion), as well as “Red state” mortality data and “Blue state” mortality data.

The page includes a list of the states and counties experiencing the most growth.

The entire site is very responsive (no Javascript is needed to load this site), is compatible with every mainstream browser since Internet Explorer 9, works on cell phones (just tap on a graph to view and zoom the data), and uses a minimum of bandwidth.

==Making this site==

The script used to make this site is open source and available on GitHub:

https://github.com/samboy/covid-19-html
The Lua language is used to generate this website; the Lua used is compatible with Lua 5.1 and also works with the current (5.4) version of Lua. I have a fork of Lua 5.1 whose binary is only 120k in size. Despite the binary being so small, the script generates the site in 90 seconds, including directions for Gnuplot to make each graph. Gnuplot makes the graphs in about five minutes.

The reason I am using Lua is because my daughter is obsessed with Roblox right now, which uses Lua as its scripting language for games. While I have been programming in Lua for 13 years, I finally bought the Lua book and read it through to fully understand Lua’s view of the world.

==My thoughts on Lua==

I am quite impressed with Lua. Not only is it tiny, but it is very fast and memory efficient. It has most of the ability of the much larger Python, with a big caveat: In order to make the scripting engine as small as possible, things often times require more code in Lua than Python. As one example, Lua does not include copy.deepcopy, but one can implement it in 17 lines of Lua code.

My workaround for Lua’s “batteries not included” design is making a public domain repository of LUA functions to cover common use cases Lua itself does not cover (sorted tables, deep table copying, printing a table’s contents, splitting a string, etc.)

Lua’s main advantage over Python is that it is an order of magnitude smaller than Python—my own personal fork of Lua is only 120,832 bytes in size—and it’s far easier to embed Lua in a C or C++ program than Python.

On a subjective level, its syntax is Pascal-style, a style which is not seen in many languages here in the 2020s. I prefer its syntax over Python’s syntax: Whitespace is not significant in Lua. There have been multiple forks to give Lua more C-like syntax over the years, including LJS, which is currently maintained.

==Footnote==

  1. For the purposes of this data, Puerto Rico’s governor is considered a Republican, even though she was a Democrat until 2019.

Did you know that all of my blog entries are available in a free to download eBook at https://www.samiam.org/blog/ebooks.html.