{"id":16352368,"url":"https://github.com/melbournedeveloper/covid-19-db","last_synced_at":"2025-10-29T14:36:42.959Z","repository":{"id":91838271,"uuid":"253984537","full_name":"MelbourneDeveloper/COVID-19-DB","owner":"MelbourneDeveloper","description":"COVID-19 database generated from Johns Hopkins CSSE data","archived":false,"fork":false,"pushed_at":"2022-12-08T10:10:32.000Z","size":962,"stargazers_count":8,"open_issues_count":7,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T16:13:36.710Z","etag":null,"topics":["covid-19","csv-files","sql","sqlite-database"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MelbourneDeveloper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-08T04:24:36.000Z","updated_at":"2024-06-16T05:52:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"fdb91b84-f207-4663-8a3a-52bdc4b6e67c","html_url":"https://github.com/MelbourneDeveloper/COVID-19-DB","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MelbourneDeveloper%2FCOVID-19-DB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MelbourneDeveloper%2FCOVID-19-DB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MelbourneDeveloper%2FCOVID-19-DB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MelbourneDeveloper%2FCOVID-19-DB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MelbourneDeveloper","download_url":"https://codeload.github.com/MelbourneDeveloper/COVID-19-DB/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245043871,"owners_count":20551844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["covid-19","csv-files","sql","sqlite-database"],"created_at":"2024-10-11T01:25:56.123Z","updated_at":"2025-10-12T20:51:56.695Z","avatar_url":"https://github.com/MelbourneDeveloper.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# COVID-19-DB\n\n## [Download Database Here](https://www.dropbox.com/s/02obmee01wgz2at/Covid19Db%202020-09-02.db?dl=0)\n\n[Follow Me](https://twitter.com/CFDevelop) on Twitter for updates to this database and code.\n\nThis database aggregates data from the Johns Hopkins CSSE CSV [daily reports](https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_daily_reports) in to a single SQLite database with C#. Open it with [DB Browser For SQLite](https://sqlitebrowser.org/). This is the [COVID-19 Johns Hopkins CSSEGithub page](https://github.com/CSSEGISandData/COVID-19).\n\n**This database is in beta. Please help by reporting bugs and inconsistencies in the issues section**\n\n## What Can It Do? ##\n\nYou should use this database to answer questions about COVID-19 over time. The daily figures show confirmed cases, deaths and recoveries for a given location day. The figures are not totals which means they can be averaged or used for other calculations. This gives you the tools you need to tell a story and educate people about the recent history of the virus. \n\nThis is an app I am building that plots the data on a map. It allows the user to slide through time and see new cases by day in each European country. This app should be available soon and allow users to plot data from any SQL query on the map. You can use the database with embedded maps on a we page with JavaScript.\n\n![Europe Daily New Cases](https://christianfindlay.files.wordpress.com/2020/04/europesmaller.gif)\n\n## Query the Data\nUse [DB Browser For SQLite](https://sqlitebrowser.org/) to open the database on any platform. The database structure looks like this:\n\n### List Top 20 Regions With Most New Cases In Last Week\n\n```sql\nselect\t\n\t\tRegions.Name,\n\t\tsum(newcases) as NewCasesLastWeek\nfrom locationdays \ninner join locations\non locations.id = locationdays.locationid\ninner join Provinces\non Provinces.id = locations.ProvinceId\ninner join Regions\non Regions.id = Provinces.RegionId\nwhere \ndate(DateOfCount) \u003e= date('now','-7 days')\nAND date(DateOfCount) \u003c date('now')\ngroup by \t\t\n\t\tRegions.Id,\n\t\tRegions.Name\norder by NewCasesLastWeek desc\t\t\nlimit 20\t\n```\n\nAs of 2020-04-18\n\n| Region         | NewCasesLastWeek |\n|----------------|------------------|\n| US             | 205870           |\n| United Kingdom | 35440            |\n| Turkey         | 30162            |\n| Spain          | 28699            |\n| Italy          | 23654            |\n| Russia         | 23209            |\n| Germany        | 18434            |\n| France         | 18422            |\n| Brazil         | 15931            |\n| Canada         | 11040            |\n| Iran           | 10839            |\n| Belgium        | 9165             |\n| Peru           | 7572             |\n| India          | 7276             |\n| Netherlands    | 7195             |\n| Ireland        | 5830             |\n| Japan          | 4291             |\n| Saudi Arabia   | 4241             |\n| Portugal       | 3698             |\n| Singapore      | 3693             |\n\n### Get Totals for Australian States\n\n```sql\nselect\tProvinces.Name,\n\t\tsum(newcases) as TotalCases,\n\t\tsum(deaths) as TotalDeaths,\n\t\tsum(Recoveries) as TotalRecoveries\t\nfrom locationdays \ninner join locations\non locations.id = locationdays.locationid\ninner join Provinces\non Provinces.id = locations.ProvinceId\ninner join Regions\non Regions.id = Provinces.RegionId\nwhere Regions.Name='Australia'\ngroup by Provinces.Name\n```\nAs of 2020 - 4 - 17 GMT\n\n| State                        | Confirmed | Deaths | Recoveries |\n|------------------------------|-----------|--------|------------|\nAustralian Capital Territory|103|3|81\nExternal territories|0|0|0\nFrom Diamond Princess|0|0|0\nJervis Bay Territory|0|0|0\nN/A|4| | \nNew South Wales|2926|26|1379\nNorthern Territory|28|0|9\nQueensland|1007|5|442\nSouth Australia|435|4|331\nTasmania|180|7|67\nVictoria|1302|14|1159\nWestern Australia|541|7|340\n\n#### Database Structure\n\n![Database Structure](Images/DBStructure.png)\n\nThe `LocationDays` table contains `LocationId`, `DateOfCount`, `Deaths`, `Recoveries`, and `NewCases`. These values can be summarized as below.\n\n## Getting Started (Generate the Database)\n\nRun these commands at the command prompt or terminal. Make sure you run initialize the submodule if you clone with your favourite Git client.\n\n- Clone the repo and source data. **This includes the [Johns Hopkins CSSE COVID-19 repo](https://github.com/CSSEGISandData/COVID-19).**\n\n\u003e git clone --recursive https://github.com/MelbourneDeveloper/COVID-19-DB.git\n\n- Navigate to COVID-19-DB/src/Covid19DB\n\n- Run the app\n\n\u003e dotnet run ../../CSSE-COVID-19/csse_covid_19_data/csse_covid_19_daily_reports\n\nOr, open the solution in Visual Studio 2019 and run the app.\n\n**Make sure you do a pull on the Johns Hopkins CSSE submodule to get the latest data!**\n\n## Why a database?\nThe current Johns Hopkins data is stored in CSV files and is split into daily sets. This makes it difficult to query the data over time. Databases provide a useful way to query the data with SQL. The code in this repo provides a replicable way to generate the database from the CSV files that John Hopkins provides daily. The database is currently an SQLite database, but the code allows for any database platform to generate the data. It is possible to generate the database as an SQL Server database, Oracle database, MySQL, or other database types. The code uses Entity Framework to create the database. Please change the connection string to use a different database.\n\n## CSV Reader\n\nThe code is useful for anyone who wants to read the Johns Hopkins CSV files. It's easy aggregate all the files in to memory. This code loads data from the entire dataset in to memory and then filters it down to the state of Victoria, Australia and orders the data by date. It then dumps the data back out to a CSV or markdown file.\n\n```cs\nprivate static async Task ProcessAsync(string directoryPath)\n{\n    var logger = new Logger\u003cProcessor\u003e();\n    var fileSystemCsvFileService = new FileSystemCsvFileService(directoryPath);\n    var csvReader = new CsvReader(fileSystemCsvFileService);\n    var rows = await csvReader.ReadCsvFiles();\n\n    //Filter by state and order by date\n    var victoriaRows = rows.Where(r =\u003e r.Province_State == \"Victoria\").OrderBy(r =\u003e r.Date).ToList();\n    victoriaRows.ToMarkdownTable(\"Victoria.md\");\n}\n```\n\nOutput (Some data truncated):\n\n|Country_Region|Province_State|Lat|Long_|Confirmed|Deaths|Recovered|Active|Date|Admin2|CsvRowNumber|\n|--|--|--|--|--|--|--|--|--|--|--|\n|Australia|Victoria|-37.8136|144.9631|296|0|70|226|2020/03/22||3192|\n|Australia|Victoria|-37.8136|144.9631|355|0|97|258|2020/03/23||3247|\n|Australia|Victoria|-37.8136|144.9631|411|0|97|314|2020/03/24||3247|\n|Australia|Victoria|-37.8136|144.9631|466|0|97|369|2020/03/25||3247|\n|Australia|Victoria|-37.8136|144.9631|520|3|149|368|2020/03/26||3245|\n|Australia|Victoria|-37.8136|144.9631|574|3|171|400|2020/03/27||3252|\n|Australia|Victoria|-37.8136|144.9631|685|3|191|491|2020/03/28||3252|\n|Australia|Victoria|-37.8136|144.9631|769|4|191|574|2020/03/29||3256|\n|Australia|Victoria|-37.8136|144.9631|821|4|191|626|2020/03/30||3260|\n|Australia|Victoria|-37.8136|144.9631|917|4|291|622|2020/03/31||2253|\n|Australia|Victoria|-37.8136|144.9631|968|4|343|621|2020/04/01||2302|\n|Australia|Victoria|-37.8136|144.9631|1036|5|422|609|2020/04/02||2386|\n|Australia|Victoria|-37.8136|144.9631|1085|7|476|602|2020/04/03||2442|\n|Australia|Victoria|-37.8136|144.9631|1115|8|527|580|2020/04/04||2496|\n|Australia|Victoria|-37.8136|144.9631|1135|8|573|554|2020/04/05||2579|\n|Australia|Victoria|-37.8136|144.9631|1158|10|620|528|2020/04/06||2623|\n|Australia|Victoria|-37.8136|144.9631|1191|11|620|560|2020/04/07||2672|\n|Australia|Victoria|-37.8136|144.9631|1212|12|620|580|2020/04/08||2698|\n|Australia|Victoria|-37.8136|144.9631|1228|12|736|480|2020/04/09||2726|\n|Australia|Victoria|-37.8136|144.9631|1241|13|926|302|2020/04/10||2755|\n|Australia|Victoria|-37.8136|144.9631|1265|14|926|325|2020/04/11||2779|\n|Australia|Victoria|-37.8136|144.9631|1268|14|926|328|2020/04/12||2802|\n|Australia|Victoria|-37.8136|144.9631|1281|14|926|341|2020/04/13||2816|\n|Australia|Victoria|-37.8136|144.9631|1291|14|1118|159|2020/04/14||2828|\n|Australia|Victoria|-37.8136|144.9631|1299|14|1118|167|2020/04/15||2841|\n|Australia|Victoria|-37.8136|144.9631|1299|14|1137|148|2020/04/16||2856|\n\n\n## How  Can I Help?\n\nThe hope is that this database can be thoroughly tested and validated. The hope is that this database will help create more accurate reporting data and allow people to more readily report on the figures. The database is not ready for this. It needs rigorous validation. Please comment on the database structure and code to help make this database ready for reporting.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelbournedeveloper%2Fcovid-19-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelbournedeveloper%2Fcovid-19-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelbournedeveloper%2Fcovid-19-db/lists"}