Initial commit
This commit is contained in:
commit
50db809735
9 changed files with 90525 additions and 0 deletions
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* @lunatech-labs/current-assessments
|
69
INSTRUCTIONS.md
Normal file
69
INSTRUCTIONS.md
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
# Lunatech COVID Assessment Instructions
|
||||||
|
|
||||||
|
We’d like to invite you to do a code assessment as discussed during your
|
||||||
|
interview. Please read these instructions carefully to ensure that you implement
|
||||||
|
everything as expected. *Be sure to do your work on a separate branch and when
|
||||||
|
you are ready for your code to be reviewed, open a pull request to the main
|
||||||
|
branch*. This is important as it will signify that you've completed the
|
||||||
|
assessment. After completing the assessment, developers from Lunatech will
|
||||||
|
review your code and you'll be given the chance to "hand off" the application to
|
||||||
|
them. You'll give a demo of your app, explain your technical choices, and
|
||||||
|
discuss the application with them.
|
||||||
|
|
||||||
|
The code assessment is not a puzzle; it's not meant to be tricky or confusing.
|
||||||
|
If you have any questions do not hesitate to contact us, we'll be glad to answer
|
||||||
|
them.
|
||||||
|
|
||||||
|
## Guidelines
|
||||||
|
|
||||||
|
- Approach this assessment if as you were developing a real world project. We
|
||||||
|
want to see how you conduct your engineering practice (project structure,
|
||||||
|
code quality, readability, documentation and so on). GitHub Actions are
|
||||||
|
enabled for this repo, so feel free to use them.
|
||||||
|
- The one week limit is to be able to give rapid feedback, you can have more
|
||||||
|
time, just send us an email. It’s OK if you haven’t completed all the
|
||||||
|
requirements, the exercise is meant to start a discussion. Remember:
|
||||||
|
Quality over Quantity.
|
||||||
|
- When you're complete, make sure all of your code is pushed up to this repo
|
||||||
|
and let us know.
|
||||||
|
- You're free to use whatever tech stack you're comfortable with, just make
|
||||||
|
sure the stack makes sense given the assignment
|
||||||
|
|
||||||
|
## The Details
|
||||||
|
The goal of this assessment is to produce a web application written in Java or
|
||||||
|
Scala, using data available in this repository. This application covers the
|
||||||
|
following requirements:
|
||||||
|
|
||||||
|
### Query:
|
||||||
|
|
||||||
|
For this endpoint, given a country name, and date (eg. 14-06-2020), get the daily
|
||||||
|
infections and deaths up until, and including, the specified date. For bonus points,
|
||||||
|
make the test partial/fuzzy (e.g. entering 'Zimb' will result in 'Zimbabwe').
|
||||||
|
|
||||||
|
### Reports:
|
||||||
|
|
||||||
|
This endpoint will return to the user the following reports:
|
||||||
|
- 10 countries with the highest vaccinations (with count), and countries
|
||||||
|
with lowest number of vaccinations.
|
||||||
|
- 10 countries with the highest infections per 100k inhabitants (with count)
|
||||||
|
- Bonus: If we consider all populations wants to become fully vaccinated (there is
|
||||||
|
no such thing as an Anti-Vaxxer), print countries that haven't vaccinated their
|
||||||
|
whole population with at least one shot or jab.
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
To speed up the assessment development, we have provided a `docker-compose` file that
|
||||||
|
will run a [PostgreSQL](https://www.postgresql.org/) instance with all the data loaded,
|
||||||
|
which you can start with the following command: `docker-compose up`. You can connect to
|
||||||
|
this instance from your application with the following values:
|
||||||
|
|
||||||
|
```
|
||||||
|
JDBC URL = jdbc:postgresql://localhost:5432/lunatech_covid
|
||||||
|
Username = postgres
|
||||||
|
Password = postgres
|
||||||
|
```
|
||||||
|
|
||||||
|
The schema is defined within the file `schema.sql` in the `database-init`
|
||||||
|
folder. For whatever reason if you want to change anything in the
|
||||||
|
`docker-compose` or re-use it in your own `docker-compose`, feel free. It's
|
||||||
|
provided for your convenience.
|
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Lunatech COVID Assessment
|
||||||
|
|
||||||
|
Please use this readme as your projects readme. You can find instructions for
|
||||||
|
the assignment in the [`INSTRUCTIONS.md`](INSTRUCTIONS.md) file.
|
61580
database-init/cases.csv
Normal file
61580
database-init/cases.csv
Normal file
File diff suppressed because it is too large
Load diff
248
database-init/countries.csv
Normal file
248
database-init/countries.csv
Normal file
|
@ -0,0 +1,248 @@
|
||||||
|
"id","code","name","population","continent","wikipedia_link","keywords"
|
||||||
|
302672,"AD","Andorra",77265,"EU","http://en.wikipedia.org/wiki/Andorra",
|
||||||
|
302618,"AE","United Arab Emirates",9890400,"AS","http://en.wikipedia.org/wiki/United_Arab_Emirates","UAE"
|
||||||
|
302619,"AF","Afghanistan",38928341,"AS","http://en.wikipedia.org/wiki/Afghanistan",
|
||||||
|
302722,"AG","Antigua and Barbuda",97928,"NA","http://en.wikipedia.org/wiki/Antigua_and_Barbuda",
|
||||||
|
302723,"AI","Anguilla",97928,"NA","http://en.wikipedia.org/wiki/Anguilla",
|
||||||
|
302673,"AL","Albania",2837743,"EU","http://en.wikipedia.org/wiki/Albania",
|
||||||
|
302620,"AM","Armenia",2963234,"AS","http://en.wikipedia.org/wiki/Armenia",
|
||||||
|
302556,"AO","Angola",32866268,"AF","http://en.wikipedia.org/wiki/Angola",
|
||||||
|
302615,"AQ","Antarctica",436080728,"AN","http://en.wikipedia.org/wiki/Antarctica",
|
||||||
|
302789,"AR","Argentina",45376763,"SA","http://en.wikipedia.org/wiki/Argentina",
|
||||||
|
302763,"AS","American Samoa",55197,"OC","http://en.wikipedia.org/wiki/American_Samoa",
|
||||||
|
302674,"AT","Austria",8917205,"EU","http://en.wikipedia.org/wiki/Austria",
|
||||||
|
302764,"AU","Australia",25687041,"OC","http://en.wikipedia.org/wiki/Australia",
|
||||||
|
302725,"AW","Aruba",106766,"NA","http://en.wikipedia.org/wiki/Aruba",
|
||||||
|
302621,"AZ","Azerbaijan",10093121,"AS","http://en.wikipedia.org/wiki/Azerbaijan",
|
||||||
|
302675,"BA","Bosnia and Herzegovina",3280815,"EU","http://en.wikipedia.org/wiki/Bosnia_and_Herzegovina",
|
||||||
|
302726,"BB","Barbados",287371,"NA","http://en.wikipedia.org/wiki/Barbados",
|
||||||
|
302622,"BD","Bangladesh",164689383,"AS","http://en.wikipedia.org/wiki/Bangladesh",
|
||||||
|
302676,"BE","Belgium",11555997,"EU","http://en.wikipedia.org/wiki/Belgium",
|
||||||
|
302557,"BF","Burkina Faso",20903278,"AF","http://en.wikipedia.org/wiki/Burkina_Faso",
|
||||||
|
302677,"BG","Bulgaria",6934015,"EU","http://en.wikipedia.org/wiki/Bulgaria",
|
||||||
|
302623,"BH","Bahrain",1701583,"AS","http://en.wikipedia.org/wiki/Bahrain",
|
||||||
|
302558,"BI","Burundi",11890781,"AF","http://en.wikipedia.org/wiki/Burundi",
|
||||||
|
302559,"BJ","Benin",12123198,"AF","http://en.wikipedia.org/wiki/Benin",
|
||||||
|
302760,"BL","Saint Barthélemy",9877,"NA","http://en.wikipedia.org/wiki/Saint_Barthélemy",
|
||||||
|
302727,"BM","Bermuda",63903,"NA","http://en.wikipedia.org/wiki/Bermuda",
|
||||||
|
302624,"BN","Brunei",437483,"AS","http://en.wikipedia.org/wiki/Brunei",
|
||||||
|
302790,"BO","Bolivia",11673029,"SA","http://en.wikipedia.org/wiki/Bolivia",
|
||||||
|
302724,"BQ","Caribbean Netherlands",7442291,"NA","http://en.wikipedia.org/wiki/Caribbean_Netherlands",
|
||||||
|
302791,"BR","Brazil",212559409,"SA","http://en.wikipedia.org/wiki/Brazil","Brasil;Brasilian"
|
||||||
|
302728,"BS","Bahamas",389486,"NA","http://en.wikipedia.org/wiki/Bahamas",
|
||||||
|
302625,"BT","Bhutan",771612,"AS","http://en.wikipedia.org/wiki/Bhutan",
|
||||||
|
302560,"BW","Botswana",2351625,"AF","http://en.wikipedia.org/wiki/Botswana",
|
||||||
|
302678,"BY","Belarus",9379952,"EU","http://en.wikipedia.org/wiki/Belarus","Belarussian;Беларусь"
|
||||||
|
302729,"BZ","Belize",397621,"NA","http://en.wikipedia.org/wiki/Belize",
|
||||||
|
302730,"CA","Canada",38005238,"NA","http://en.wikipedia.org/wiki/Canada",
|
||||||
|
302626,"CC","Cocos (Keeling) Islands",596,"AS","http://en.wikipedia.org/wiki/Cocos_(Keeling)_Islands",
|
||||||
|
302561,"CD","Congo (Kinshasa)",86790568,"AF","http://en.wikipedia.org/wiki/Congo_(Kinshasa)",
|
||||||
|
302562,"CF","Central African Republic",4829764,"AF","http://en.wikipedia.org/wiki/Central_African_Republic",
|
||||||
|
302563,"CG","Congo (Brazzaville)",5380504,"AF","http://en.wikipedia.org/wiki/Congo_(Brazzaville)",
|
||||||
|
302679,"CH","Switzerland",8636896,"EU","http://en.wikipedia.org/wiki/Switzerland",
|
||||||
|
302564,"CI","Côte d'Ivoire",26378275,"AF","http://en.wikipedia.org/wiki/Côte_d'Ivoire","Ivory Coast"
|
||||||
|
302765,"CK","Cook Islands",17459,"OC","http://en.wikipedia.org/wiki/Cook_Islands",
|
||||||
|
302792,"CL","Chile",19116209,"SA","http://en.wikipedia.org/wiki/Chile",
|
||||||
|
302565,"CM","Cameroon",26545864,"AF","http://en.wikipedia.org/wiki/Cameroon",
|
||||||
|
302627,"CN","China",1410929362,"AS","http://en.wikipedia.org/wiki/China",
|
||||||
|
302793,"CO","Colombia",50882884,"SA","http://en.wikipedia.org/wiki/Colombia",
|
||||||
|
302731,"CR","Costa Rica",5094114,"NA","http://en.wikipedia.org/wiki/Costa_Rica",
|
||||||
|
302732,"CU","Cuba",11326616,"NA","http://en.wikipedia.org/wiki/Cuba",
|
||||||
|
302566,"CV","Cape Verde",555988,"AF","http://en.wikipedia.org/wiki/Cape_Verde",
|
||||||
|
302762,"CW","Curaçao",155014,"NA","http://en.wikipedia.org/wiki/Cura%C3%A7ao",
|
||||||
|
302628,"CX","Christmas Island",1402,"AS","http://en.wikipedia.org/wiki/Christmas_Island",
|
||||||
|
302629,"CY","Cyprus",1207361,"AS","http://en.wikipedia.org/wiki/Cyprus",
|
||||||
|
302680,"CZ","Czech Republic",10698896,"EU","http://en.wikipedia.org/wiki/Czech_Republic",
|
||||||
|
302681,"DE","Germany",83240525,"EU","http://en.wikipedia.org/wiki/Germany","Deutschland"
|
||||||
|
302567,"DJ","Djibouti",988002,"AF","http://en.wikipedia.org/wiki/Djibouti",
|
||||||
|
302682,"DK","Denmark",5831404,"EU","http://en.wikipedia.org/wiki/Denmark",
|
||||||
|
302733,"DM","Dominica",71991,"NA","http://en.wikipedia.org/wiki/Dominica",
|
||||||
|
302734,"DO","Dominican Republic",10847904,"NA","http://en.wikipedia.org/wiki/Dominican_Republic",
|
||||||
|
302568,"DZ","Algeria",43851043,"AF","http://en.wikipedia.org/wiki/Algeria",
|
||||||
|
302794,"EC","Ecuador",17643060,"SA","http://en.wikipedia.org/wiki/Ecuador",
|
||||||
|
302683,"EE","Estonia",1331057,"EU","http://en.wikipedia.org/wiki/Estonia",
|
||||||
|
302569,"EG","Egypt",100388076,"AF","http://en.wikipedia.org/wiki/Egypt",
|
||||||
|
302570,"EH","Western Sahara",619811,"AF","http://en.wikipedia.org/wiki/Western_Sahara","Sahrawian"
|
||||||
|
302571,"ER","Eritrea",3621464,"AF","http://en.wikipedia.org/wiki/Eritrea",
|
||||||
|
302684,"ES","Spain",47351567,"EU","http://en.wikipedia.org/wiki/Spain",
|
||||||
|
302572,"ET","Ethiopia",114963583,"AF","http://en.wikipedia.org/wiki/Ethiopia",
|
||||||
|
302685,"FI","Finland",5530719,"EU","http://en.wikipedia.org/wiki/Finland",
|
||||||
|
302766,"FJ","Fiji",896444,"OC","http://en.wikipedia.org/wiki/Fiji",
|
||||||
|
302795,"FK","Falkland Islands",2840,"SA","http://en.wikipedia.org/wiki/Falkland_Islands",
|
||||||
|
302767,"FM","Micronesia",113811,"OC","http://en.wikipedia.org/wiki/Micronesia",
|
||||||
|
302686,"FO","Faroe Islands",48865,"EU","http://en.wikipedia.org/wiki/Faroe_Islands",
|
||||||
|
302687,"FR","France",67391582,"EU","http://en.wikipedia.org/wiki/France",
|
||||||
|
302573,"GA","Gabon",2225728,"AF","http://en.wikipedia.org/wiki/Gabon",
|
||||||
|
302688,"GB","United Kingdom",67215293,"EU","http://en.wikipedia.org/wiki/United_Kingdom","Great Britain"
|
||||||
|
302735,"GD","Grenada",112519,"NA","http://en.wikipedia.org/wiki/Grenada",
|
||||||
|
302630,"GE","Georgia",3714000,"AS","http://en.wikipedia.org/wiki/Georgia_(country)",
|
||||||
|
302796,"GF","French Guiana",294071,"SA","http://en.wikipedia.org/wiki/French_Guiana","French Guyana"
|
||||||
|
302689,"GG","Guernsey",62792,"EU","http://en.wikipedia.org/wiki/Guernsey",
|
||||||
|
302574,"GH","Ghana",31072945,"AF","http://en.wikipedia.org/wiki/Ghana",
|
||||||
|
302690,"GI","Gibraltar",33691,"EU","http://en.wikipedia.org/wiki/Gibraltar",
|
||||||
|
302736,"GL","Greenland",56367,"NA","http://en.wikipedia.org/wiki/Greenland",
|
||||||
|
302575,"GM","Gambia",2347696,"AF","http://en.wikipedia.org/wiki/Gambia",
|
||||||
|
302576,"GN","Guinea",13132792,"AF","http://en.wikipedia.org/wiki/Guinea",
|
||||||
|
302737,"GP","Guadeloupe",395700,"NA","http://en.wikipedia.org/wiki/Guadeloupe",
|
||||||
|
302577,"GQ","Equatorial Guinea",1402985,"AF","http://en.wikipedia.org/wiki/Equatorial_Guinea",
|
||||||
|
302691,"GR","Greece",10715549,"EU","http://en.wikipedia.org/wiki/Greece",
|
||||||
|
302616,"GS","South Georgia and the South Sandwich Islands",3989167,"AN","http://en.wikipedia.org/wiki/South_Georgia_and_the_South_Sandwich_Islands",
|
||||||
|
302738,"GT","Guatemala",16858333,"NA","http://en.wikipedia.org/wiki/Guatemala",
|
||||||
|
302768,"GU","Guam",168783,"OC","http://en.wikipedia.org/wiki/Guam",
|
||||||
|
302578,"GW","Guinea-Bissau",1967998,"AF","http://en.wikipedia.org/wiki/Guinea-Bissau",
|
||||||
|
302797,"GY","Guyana",786559,"SA","http://en.wikipedia.org/wiki/Guyana",
|
||||||
|
302631,"HK","Hong Kong",7507400,"AS","http://en.wikipedia.org/wiki/Hong_Kong",
|
||||||
|
302739,"HN","Honduras",9904608,"NA","http://en.wikipedia.org/wiki/Honduras",
|
||||||
|
302692,"HR","Croatia",4047200,"EU","http://en.wikipedia.org/wiki/Croatia",
|
||||||
|
302740,"HT","Haiti",11402533,"NA","http://en.wikipedia.org/wiki/Haiti",
|
||||||
|
302693,"HU","Hungary",9749763,"EU","http://en.wikipedia.org/wiki/Hungary",
|
||||||
|
302632,"ID","Indonesia",273523621,"AS","http://en.wikipedia.org/wiki/Indonesia",
|
||||||
|
302694,"IE","Ireland",4994724,"EU","http://en.wikipedia.org/wiki/Ireland","Eire"
|
||||||
|
302633,"IL","Israel",9216900,"AS","http://en.wikipedia.org/wiki/Israel",
|
||||||
|
302695,"IM","Isle of Man",85032,"EU","http://en.wikipedia.org/wiki/Isle_of_Man",
|
||||||
|
302634,"IN","India",1380004385,"AS","http://en.wikipedia.org/wiki/India",
|
||||||
|
302635,"IO","British Indian Ocean Territory",3000,"AS","http://en.wikipedia.org/wiki/British_Indian_Ocean_Territory",
|
||||||
|
302636,"IQ","Iraq",40222503,"AS","http://en.wikipedia.org/wiki/Iraq",
|
||||||
|
302637,"IR","Iran",82913893,"AS","http://en.wikipedia.org/wiki/Iran",
|
||||||
|
302696,"IS","Iceland",366425,"EU","http://en.wikipedia.org/wiki/Iceland",
|
||||||
|
302697,"IT","Italy",59554023,"EU","http://en.wikipedia.org/wiki/Italy","Italia"
|
||||||
|
302698,"JE","Jersey",97857,"EU","http://en.wikipedia.org/wiki/Jersey",
|
||||||
|
302741,"JM","Jamaica",2961161,"NA","http://en.wikipedia.org/wiki/Jamaica",
|
||||||
|
302638,"JO","Jordan",10203140,"AS","http://en.wikipedia.org/wiki/Jordan",
|
||||||
|
302639,"JP","Japan",125836021,"AS","http://en.wikipedia.org/wiki/Japan","Nippon"
|
||||||
|
302579,"KE","Kenya",53771300,"AF","http://en.wikipedia.org/wiki/Kenya",
|
||||||
|
302640,"KG","Kyrgyzstan",6591600,"AS","http://en.wikipedia.org/wiki/Kyrgyzstan",
|
||||||
|
302641,"KH","Cambodia",16718971,"AS","http://en.wikipedia.org/wiki/Cambodia",
|
||||||
|
302769,"KI","Kiribati",119446,"OC","http://en.wikipedia.org/wiki/Kiribati",
|
||||||
|
302580,"KM","Comoros",869595,"AF","http://en.wikipedia.org/wiki/Comoros","جزر القمر"
|
||||||
|
302742,"KN","Saint Kitts and Nevis",53192,"NA","http://en.wikipedia.org/wiki/Saint_Kitts_and_Nevis",
|
||||||
|
302642,"KP","North Korea",25778816,"AS","http://en.wikipedia.org/wiki/North_Korea",
|
||||||
|
302643,"KR","South Korea",51269185,"AS","http://en.wikipedia.org/wiki/South_Korea",
|
||||||
|
302720,"KS","Kosovo",1775378,"EU","http://en.wikipedia.org/wiki/Kosovo","Kosova"
|
||||||
|
302644,"KW","Kuwait",4270563,"AS","http://en.wikipedia.org/wiki/Kuwait",
|
||||||
|
302743,"KY","Cayman Islands",65720,"NA","http://en.wikipedia.org/wiki/Cayman_Islands",
|
||||||
|
302645,"KZ","Kazakhstan",18754440,"AS","http://en.wikipedia.org/wiki/Kazakhstan","Kazakh"
|
||||||
|
302646,"LA","Laos",7275556,"AS","http://en.wikipedia.org/wiki/Laos",
|
||||||
|
302647,"LB","Lebanon",6825442,"AS","http://en.wikipedia.org/wiki/Lebanon",
|
||||||
|
302744,"LC","Saint Lucia",183629,"NA","http://en.wikipedia.org/wiki/Saint_Lucia",
|
||||||
|
302699,"LI","Liechtenstein",38137,"EU","http://en.wikipedia.org/wiki/Liechtenstein",
|
||||||
|
302648,"LK","Sri Lanka",21919000,"AS","http://en.wikipedia.org/wiki/Sri_Lanka",
|
||||||
|
302581,"LR","Liberia",5057677,"AF","http://en.wikipedia.org/wiki/Liberia",
|
||||||
|
302582,"LS","Lesotho",2142252,"AF","http://en.wikipedia.org/wiki/Lesotho",
|
||||||
|
302700,"LT","Lithuania",2794700,"EU","http://en.wikipedia.org/wiki/Lithuania",
|
||||||
|
302701,"LU","Luxembourg",632275,"EU","http://en.wikipedia.org/wiki/Luxembourg",
|
||||||
|
302702,"LV","Latvia",1901548,"EU","http://en.wikipedia.org/wiki/Latvia",
|
||||||
|
302583,"LY","Libya",6871287,"AF","http://en.wikipedia.org/wiki/Libya",
|
||||||
|
302584,"MA","Morocco",36910558,"AF","http://en.wikipedia.org/wiki/Morocco",
|
||||||
|
302703,"MC","Monaco",39244,"EU","http://en.wikipedia.org/wiki/Monaco",
|
||||||
|
302704,"MD","Moldova",2620495,"EU","http://en.wikipedia.org/wiki/Moldova",
|
||||||
|
302705,"ME","Montenegro",621306,"EU","http://en.wikipedia.org/wiki/Montenegro",
|
||||||
|
302759,"MF","Saint Martin",38659,"NA","http://en.wikipedia.org/wiki/Saint_Martin_(France)",
|
||||||
|
302585,"MG","Madagascar",27691019,"AF","http://en.wikipedia.org/wiki/Madagascar",
|
||||||
|
302770,"MH","Marshall Islands",59194,"OC","http://en.wikipedia.org/wiki/Marshall_Islands",
|
||||||
|
302706,"MK","Macedonia",2083243,"EU","http://en.wikipedia.org/wiki/Macedonia",
|
||||||
|
302586,"ML","Mali",20250834,"AF","http://en.wikipedia.org/wiki/Mali",
|
||||||
|
302649,"MM","Burma",54967748,"AS","http://en.wikipedia.org/wiki/Burma","Myanmar"
|
||||||
|
302650,"MN","Mongolia",3278292,"AS","http://en.wikipedia.org/wiki/Mongolia",
|
||||||
|
302651,"MO","Macau",640446,"AS","http://en.wikipedia.org/wiki/Macau","Macao"
|
||||||
|
302771,"MP","Northern Mariana Islands",57557,"OC","http://en.wikipedia.org/wiki/Northern_Mariana_Islands",
|
||||||
|
302745,"MQ","Martinique",374820,"NA","http://en.wikipedia.org/wiki/Martinique",
|
||||||
|
302587,"MR","Mauritania",4649660,"AF","http://en.wikipedia.org/wiki/Mauritania",
|
||||||
|
302746,"MS","Montserrat",4992,"NA","http://en.wikipedia.org/wiki/Montserrat",
|
||||||
|
302707,"MT","Malta",525285,"EU","http://en.wikipedia.org/wiki/Malta",
|
||||||
|
302588,"MU","Mauritius",1265740,"AF","http://en.wikipedia.org/wiki/Mauritius",
|
||||||
|
302652,"MV","Maldives",540542,"AS","http://en.wikipedia.org/wiki/Maldives",
|
||||||
|
302589,"MW","Malawi",19129955,"AF","http://en.wikipedia.org/wiki/Malawi",
|
||||||
|
302747,"MX","Mexico",128932753,"NA","http://en.wikipedia.org/wiki/Mexico",
|
||||||
|
302653,"MY","Malaysia",32365998,"AS","http://en.wikipedia.org/wiki/Malaysia",
|
||||||
|
302590,"MZ","Mozambique",31255435,"AF","http://en.wikipedia.org/wiki/Mozambique",
|
||||||
|
302591,"NA","Namibia",2540916,"AF","http://en.wikipedia.org/wiki/Namibia",
|
||||||
|
302772,"NC","New Caledonia",271960,"OC","http://en.wikipedia.org/wiki/New_Caledonia",
|
||||||
|
302592,"NE","Niger",24206636,"AF","http://en.wikipedia.org/wiki/Niger",
|
||||||
|
302773,"NF","Norfolk Island",1748,"OC","http://en.wikipedia.org/wiki/Norfolk_Island",
|
||||||
|
302593,"NG","Nigeria",206139587,"AF","http://en.wikipedia.org/wiki/Nigeria",
|
||||||
|
302748,"NI","Nicaragua",6624554,"NA","http://en.wikipedia.org/wiki/Nicaragua",
|
||||||
|
302708,"NL","Netherlands",17441139,"EU","http://en.wikipedia.org/wiki/Netherlands","Holland"
|
||||||
|
302709,"NO","Norway",5379475,"EU","http://en.wikipedia.org/wiki/Norway",
|
||||||
|
302654,"NP","Nepal",29136808,"AS","http://en.wikipedia.org/wiki/Nepal",
|
||||||
|
302774,"NR","Nauru",10834,"OC","http://en.wikipedia.org/wiki/Nauru",
|
||||||
|
302775,"NU","Niue",1626,"OC","http://en.wikipedia.org/wiki/Niue",
|
||||||
|
302776,"NZ","New Zealand",5084300,"OC","http://en.wikipedia.org/wiki/New_Zealand",
|
||||||
|
302655,"OM","Oman",5106622,"AS","http://en.wikipedia.org/wiki/Oman",
|
||||||
|
302749,"PA","Panama",4314768,"NA","http://en.wikipedia.org/wiki/Panama",
|
||||||
|
302798,"PE","Perú",32971846,"SA","http://en.wikipedia.org/wiki/Perú",
|
||||||
|
302777,"PF","French Polynesia",280904,"OC","http://en.wikipedia.org/wiki/French_Polynesia",
|
||||||
|
302778,"PG","Papua New Guinea",8947027,"OC","http://en.wikipedia.org/wiki/Papua_New_Guinea",
|
||||||
|
302656,"PH","Philippines",109581085,"AS","http://en.wikipedia.org/wiki/Philippines","Philippine;Phillipines Philipines"
|
||||||
|
302657,"PK","Pakistan",220892331,"AS","http://en.wikipedia.org/wiki/Pakistan",
|
||||||
|
302710,"PL","Poland",37950802,"EU","http://en.wikipedia.org/wiki/Poland",
|
||||||
|
302750,"PM","Saint Pierre and Miquelon",5794,"NA","http://en.wikipedia.org/wiki/Saint_Pierre_and_Miquelon",
|
||||||
|
302779,"PN","Pitcairn",193,"OC","http://en.wikipedia.org/wiki/Pitcairn",
|
||||||
|
302751,"PR","Puerto Rico",3194034,"NA","http://en.wikipedia.org/wiki/Puerto_Rico",
|
||||||
|
302658,"PS","Palestinian Territory",5101414,"AS","http://en.wikipedia.org/wiki/Palestinian_Territory",
|
||||||
|
302711,"PT","Portugal",10305564,"EU","http://en.wikipedia.org/wiki/Portugal",
|
||||||
|
302780,"PW","Palau",18092,"OC","http://en.wikipedia.org/wiki/Palau",
|
||||||
|
302799,"PY","Paraguay",7132530,"SA","http://en.wikipedia.org/wiki/Paraguay",
|
||||||
|
302659,"QA","Qatar",2881060,"AS","http://en.wikipedia.org/wiki/Qatar",
|
||||||
|
302594,"RE","Réunion",895312,"AF","http://en.wikipedia.org/wiki/Réunion","Île Bourbon;La Réunion"
|
||||||
|
302712,"RO","Romania",19286123,"EU","http://en.wikipedia.org/wiki/Romania",
|
||||||
|
302713,"RS","Serbia",6908224,"EU","http://en.wikipedia.org/wiki/Serbia","Serb"
|
||||||
|
302714,"RU","Russia",144104080,"EU","http://en.wikipedia.org/wiki/Russia","Soviet;Sovietskaya, Sovetskaya"
|
||||||
|
302595,"RW","Rwanda",12952209,"AF","http://en.wikipedia.org/wiki/Rwanda",
|
||||||
|
302660,"SA","Saudi Arabia",34813867,"AS","http://en.wikipedia.org/wiki/Saudi_Arabia",
|
||||||
|
302781,"SB","Solomon Islands",686878,"OC","http://en.wikipedia.org/wiki/Solomon_Islands",
|
||||||
|
302596,"SC","Seychelles",98462,"AF","http://en.wikipedia.org/wiki/Seychelles",
|
||||||
|
302597,"SD","Sudan",43849269,"AF","http://en.wikipedia.org/wiki/Sudan",
|
||||||
|
302715,"SE","Sweden",10353442,"EU","http://en.wikipedia.org/wiki/Sweden",
|
||||||
|
302661,"SG","Singapore",5685807,"AS","http://en.wikipedia.org/wiki/Singapore",
|
||||||
|
302598,"SH","Saint Helena",6077,"AF","http://en.wikipedia.org/wiki/Saint_Helena",
|
||||||
|
302716,"SI","Slovenia",2100126,"EU","http://en.wikipedia.org/wiki/Slovenia",
|
||||||
|
302717,"SK","Slovakia",5458827,"EU","http://en.wikipedia.org/wiki/Slovakia",
|
||||||
|
302599,"SL","Sierra Leone",7976985,"AF","http://en.wikipedia.org/wiki/Sierra_Leone",
|
||||||
|
302718,"SM","San Marino",33938,"EU","http://en.wikipedia.org/wiki/San_Marino",
|
||||||
|
302600,"SN","Senegal",16743930,"AF","http://en.wikipedia.org/wiki/Senegal",
|
||||||
|
302601,"SO","Somalia",15893219,"AF","http://en.wikipedia.org/wiki/Somalia",
|
||||||
|
302800,"SR","Suriname",586634,"SA","http://en.wikipedia.org/wiki/Suriname",
|
||||||
|
302614,"SS","South Sudan",11193729,"AF","http://en.wikipedia.org/wiki/South_Sudan",
|
||||||
|
302602,"ST","São Tomé and Principe",219159,"AF","http://en.wikipedia.org/wiki/São_Tomé_and_Principe",
|
||||||
|
302752,"SV","El Salvador",6486201,"NA","http://en.wikipedia.org/wiki/El_Salvador","Salvadorian;Salvadorean"
|
||||||
|
302761,"SX","Sint Maarten",40812,"NA","http://en.wikipedia.org/wiki/Sint_Maarten",
|
||||||
|
302662,"SY","Syria",17500657,"AS","http://en.wikipedia.org/wiki/Syria",
|
||||||
|
302603,"SZ","Swaziland",1178502,"AF","http://en.wikipedia.org/wiki/Swaziland",
|
||||||
|
302753,"TC","Turks and Caicos Islands",38718,"NA","http://en.wikipedia.org/wiki/Turks_and_Caicos_Islands",
|
||||||
|
302604,"TD","Chad",16425859,"AF","http://en.wikipedia.org/wiki/Chad",
|
||||||
|
302617,"TF","French Southern Territories",400,"AN","http://en.wikipedia.org/wiki/French_Southern_Territories",
|
||||||
|
302605,"TG","Togo",8278737,"AF","http://en.wikipedia.org/wiki/Togo",
|
||||||
|
302663,"TH","Thailand",69799978,"AS","http://en.wikipedia.org/wiki/Thailand","Siam;Siamese"
|
||||||
|
302664,"TJ","Tajikistan",9537642,"AS","http://en.wikipedia.org/wiki/Tajikistan","Tajik"
|
||||||
|
302782,"TK","Tokelau",1357,"OC","http://en.wikipedia.org/wiki/Tokelau",
|
||||||
|
302665,"TL","Timor-Leste",1318442,"AS","http://en.wikipedia.org/wiki/Timor-Leste","East Timor"
|
||||||
|
302666,"TM","Turkmenistan",6031187,"AS","http://en.wikipedia.org/wiki/Turkmenistan",
|
||||||
|
302606,"TN","Tunisia",11818618,"AF","http://en.wikipedia.org/wiki/Tunisia",
|
||||||
|
302783,"TO","Tonga",105697,"OC","http://en.wikipedia.org/wiki/Tonga",
|
||||||
|
302667,"TR","Turkey",84339067,"AS","http://en.wikipedia.org/wiki/Turkey",
|
||||||
|
302754,"TT","Trinidad and Tobago",1399491,"NA","http://en.wikipedia.org/wiki/Trinidad_and_Tobago",
|
||||||
|
302784,"TV","Tuvalu",11792,"OC","http://en.wikipedia.org/wiki/Tuvalu",
|
||||||
|
302668,"TW","Taiwan",23816775,"AS","http://en.wikipedia.org/wiki/Taiwan",
|
||||||
|
302607,"TZ","Tanzania",59734213,"AF","http://en.wikipedia.org/wiki/Tanzania",
|
||||||
|
302719,"UA","Ukraine",44134693,"EU","http://en.wikipedia.org/wiki/Ukraine",
|
||||||
|
302608,"UG","Uganda",45741000,"AF","http://en.wikipedia.org/wiki/Uganda",
|
||||||
|
302785,"UM","United States Minor Outlying Islands",315,"OC","http://en.wikipedia.org/wiki/United_States_Minor_Outlying_Islands",
|
||||||
|
302755,"US","United States",329484123,"NA","http://en.wikipedia.org/wiki/United_States","America"
|
||||||
|
302801,"UY","Uruguay",3473727,"SA","http://en.wikipedia.org/wiki/Uruguay",
|
||||||
|
302669,"UZ","Uzbekistan",34232050,"AS","http://en.wikipedia.org/wiki/Uzbekistan","Uzbek"
|
||||||
|
302721,"VA","Vatican City",825,"EU","http://en.wikipedia.org/wiki/Vatican_City","The Holy See"
|
||||||
|
302756,"VC","Saint Vincent and the Grenadines",110947,"NA","http://en.wikipedia.org/wiki/Saint_Vincent_and_the_Grenadines",
|
||||||
|
302802,"VE","Venezuela",28515829,"SA","http://en.wikipedia.org/wiki/Venezuela",
|
||||||
|
302757,"VG","British Virgin Islands",30237,"NA","http://en.wikipedia.org/wiki/British_Virgin_Islands",
|
||||||
|
302758,"VI","U.S. Virgin Islands",106290,"NA","http://en.wikipedia.org/wiki/U.S._Virgin_Islands",
|
||||||
|
302670,"VN","Vietnam",97338583,"AS","http://en.wikipedia.org/wiki/Vietnam",
|
||||||
|
302786,"VU","Vanuatu",307150,"OC","http://en.wikipedia.org/wiki/Vanuatu",
|
||||||
|
302787,"WF","Wallis and Futuna",11239,"OC","http://en.wikipedia.org/wiki/Wallis_and_Futuna",
|
||||||
|
302788,"WS","Samoa",198410,"OC","http://en.wikipedia.org/wiki/Samoa",
|
||||||
|
302671,"YE","Yemen",29161922,"AS","http://en.wikipedia.org/wiki/Yemen",
|
||||||
|
302609,"YT","Mayotte",270372,"AF","http://en.wikipedia.org/wiki/Mayotte",
|
||||||
|
302610,"ZA","South Africa",59308690,"AF","http://en.wikipedia.org/wiki/South_Africa",
|
||||||
|
302611,"ZM","Zambia",18383956,"AF","http://en.wikipedia.org/wiki/Zambia",
|
||||||
|
302612,"ZW","Zimbabwe",14862927,"AF","http://en.wikipedia.org/wiki/Zimbabwe",
|
||||||
|
302613,"ZZ","Unknown or unassigned country",0,"AF","http://en.wikipedia.org/wiki/Unknown_or_unassigned_country",
|
|
46
database-init/initialize-db.sh
Executable file
46
database-init/initialize-db.sh
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
Bold='\033[1m' # Bold
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# To change this banner, go to http://patorjk.com/software/taag/#p=display&f=Big&t=Lunatech%0ACOVID%0AAssessment
|
||||||
|
cat << "EOF"
|
||||||
|
_ _ _
|
||||||
|
| | | | | |
|
||||||
|
| | _ _ _ __ __ _| |_ ___ ___| |__
|
||||||
|
| | | | | | '_ \ / _` | __/ _ \/ __| '_ \
|
||||||
|
| |___| |_| | | | | (_| | || __/ (__| | | |
|
||||||
|
|______\__,_|_| |_|\__,_|\__\___|\___|_| |_|
|
||||||
|
_____ ______ _______ _____
|
||||||
|
/ ____/ __ \ \ / /_ _| __ \
|
||||||
|
| | | | | \ \ / / | | | | | |
|
||||||
|
| | | | | |\ \/ / | | | | | |
|
||||||
|
| |___| |__| | \ / _| |_| |__| | _
|
||||||
|
\__/\_\____/ \/ |_____|_____/ | |
|
||||||
|
/ \ ___ ___ ___ ___ ___ _ __ ___ ___ _ __ | |_
|
||||||
|
/ /\ \ / __/ __|/ _ \/ __/ __| '_ ` _ \ / _ \ '_ \| __|
|
||||||
|
/ ____ \\__ \__ \ __/\__ \__ \ | | | | | __/ | | | |_
|
||||||
|
/_/ \_\___/___/\___||___/___/_| |_| |_|\___|_| |_|\__|
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo -e "${Bold}Initializing schema...${NC}"
|
||||||
|
psql --host=postgres --username=postgres -w -d lunatech_covid -f ./schema.sql &&
|
||||||
|
echo -e "\n${Bold}Initializing countries...${NC}"
|
||||||
|
psql --host=postgres --username=postgres -w -d lunatech_covid -c "\copy countries(id, code, name, population, continent, wikipedia_link, keywords) FROM 'countries.csv' DELIMITER ',' CSV HEADER"
|
||||||
|
echo -e "\n${Bold}Initializing airports...${NC}"
|
||||||
|
psql --host=postgres --username=postgres -w -d lunatech_covid -c "\copy cases(recorded_date,infections,deaths,iso_country) FROM 'cases.csv' DELIMITER ',' CSV HEADER"
|
||||||
|
echo -e "\n${Bold}Initializing runways...${NC}"
|
||||||
|
psql --host=postgres --username=postgres -w -d lunatech_covid -c "\copy vaccinations(recorded_date,daily_vaccinations_raw,daily_vaccinations,iso_country) FROM 'vaccinations.csv' DELIMITER ',' CSV HEADER"
|
||||||
|
|
||||||
|
# To change this banner, go to http://patorjk.com/software/taag/#p=display&f=Big&t=DB%20ready%20to%20use!
|
||||||
|
cat << "EOF"
|
||||||
|
_____ ____ _ _ _
|
||||||
|
| __ \| _ \ | | | | | |
|
||||||
|
| | | | |_) | _ __ ___ __ _ __| |_ _ | |_ ___ _ _ ___ ___| |
|
||||||
|
| | | | _ < | '__/ _ \/ _` |/ _` | | | | | __/ _ \ | | | / __|/ _ \ |
|
||||||
|
| |__| | |_) | | | | __/ (_| | (_| | |_| | | || (_) | | |_| \__ \ __/_|
|
||||||
|
|_____/|____/ |_| \___|\__,_|\__,_|\__, | \__\___/ \__,_|___/\___(_)
|
||||||
|
__/ |
|
||||||
|
|___/
|
||||||
|
EOF
|
29
database-init/schema.sql
Normal file
29
database-init/schema.sql
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS countries (
|
||||||
|
id INTEGER CONSTRAINT PK_COUNTRIES PRIMARY KEY,
|
||||||
|
code VARCHAR(10) NOT NULL,
|
||||||
|
name VARCHAR(255) NOT NULL,
|
||||||
|
population INTEGER NOT NULL,
|
||||||
|
continent VARCHAR(10) NOT NULL,
|
||||||
|
wikipedia_link VARCHAR(255),
|
||||||
|
keywords VARCHAR(100),
|
||||||
|
CONSTRAINT UNQ_CODE UNIQUE(code),
|
||||||
|
CONSTRAINT UNQ_NAME UNIQUE(name)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS cases (
|
||||||
|
recorded_date DATE,
|
||||||
|
infections INTEGER NOT NULL,
|
||||||
|
deaths INTEGER NOT NULL,
|
||||||
|
iso_country VARCHAR(10),
|
||||||
|
PRIMARY KEY (recorded_date, iso_country),
|
||||||
|
FOREIGN KEY (iso_country) REFERENCES countries(code)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS vaccinations (
|
||||||
|
recorded_date DATE,
|
||||||
|
daily_vaccinations_raw INTEGER,
|
||||||
|
daily_vaccinations INTEGER,
|
||||||
|
iso_country VARCHAR(10),
|
||||||
|
PRIMARY KEY (recorded_date, iso_country),
|
||||||
|
FOREIGN KEY (iso_country) REFERENCES countries(code)
|
||||||
|
);
|
28513
database-init/vaccinations.csv
Normal file
28513
database-init/vaccinations.csv
Normal file
File diff suppressed because it is too large
Load diff
35
docker-compose.yaml
Normal file
35
docker-compose.yaml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
version: '2.1'
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:13
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=postgres
|
||||||
|
- POSTGRES_PASSWORD=postgres
|
||||||
|
- POSTGRES_DB=lunatech_covid
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
networks:
|
||||||
|
- default
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
logging:
|
||||||
|
driver: none
|
||||||
|
|
||||||
|
postgres-init:
|
||||||
|
image: postgres:13
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
environment:
|
||||||
|
- PGPASSWORD=postgres
|
||||||
|
volumes:
|
||||||
|
- ./database-init/initialize-db.sh:/initialize-db.sh
|
||||||
|
- ./database-init/schema.sql:/schema.sql
|
||||||
|
- ./database-init/cases.csv:/cases.csv
|
||||||
|
- ./database-init/countries.csv:/countries.csv
|
||||||
|
- ./database-init/vaccinations.csv:/vaccinations.csv
|
||||||
|
command: bash -c "sleep 10 && chmod u+x /initialize-db.sh && /initialize-db.sh"
|
Loading…
Reference in a new issue