This is a Laravel-powered API source for tracking COVID-19 cases in a region. It is currently used by the COVID-19 Tracker Canada project.
See it in action at https://api.covid19tracker.ca
A hosting environment configured for Laravel 7.x should have no issues. Please see Laravel's Server Requirements for up-to-date information.
Data is stored in a MySQL database. You will need to create one for this project to use.
Laravel Homestead is also supported out of box for local development.
Important In order to use the CSV Seeders, you must have PHP 7.4 installed. Most deployments typically install version 7.2.
git clone [email protected]:andrewthong/covid19tracker-api.git
cd covid19tracker-api
composer install
cp .env.example .env
Modify the .env with the proper database credentials.
php artisan key:generate
php artisan migrate
You can now launch. Instructions vary depending on your setup (LEMP server, Homestead...). When ready, browse to the URL as configured and you should see the API documentation.
The database seeders are specific to Canada, but can be tweaked for another region as needed.
Running this seed inserts all 13 provinces and territories of Canada.
php artisan db:seed --class=ProvinceSeeder
This is a sample of report data. Be sure to adjust the province to match the province data accordingly.
php artisan db:seed --class=ReportSeeder
These do not have a sample CSV, but the seeder classes are available.
php artisan db:seed --class=CaseSeeder
php artisan db:seed --class=FatalitySeeder
Admin panel still under consideration.
Processing the reports is done through the CLI. Run the following command in the project root:
php artisan report:process
The prompt should be straightforward. Out-of-box, the processing function:
- Sums the daily case and fatality totals for each province
- Calculates the day-to-day change in tests, hospitalizations, criticals (intensive care) and recoveries from the
reports. - Stores this summarized data, which is used by the reports API
- Laravel - The web framework used
Feel free to contribute :)
- Andrew Thong - Initial work - GitHub
See also the list of contributors who participated in this project.
This project is licensed under the MIT License.
- COVID-19 Tracker Canada - the tracker that inspired this project
- Adminer - convenient single-line database administration
- DigitalOcean Hub for Good - infrastructure