# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
1 Brazil * 675,830 27,726 4.40% 17 17,396 36,026 818 2.36% 30 583 302,084 338,110 337,720 170 5.331% 10.655% 212,559,417 0.318% 0.159% 0.017%
2 Mexico * 113,619 4,346 4.11% 18 3,593 13,511 625 4.98% 15 341 81,544 95,055 18,564 105 11.891% 14.214% 128,932,753 0.088% 0.014% 0.010%
3 USA * 1,988,544 35,683 1.83% 39 6,334 112,096 816 0.73% 95 135 751,894 863,990 1,124,554 339 5.637% 12.974% 331,002,651 0.601% 0.340% 0.034%
4 Colombia * 38,027 1,515 4.31% 17 1,392 1,205 58 5.34% 14 60 14,382 15,587 22,440 24 3.169% 7.731% 50,882,891 0.075% 0.044% 0.002%
5 Panama * 16,004 419 2.79% 26 541 386 7 1.93% 37 16 10,118 10,504 5,500 90 2.412% 3.675% 4,314,767 0.371% 0.127% 0.009% 0.002%
6 Guatemala * 6,792 331 5.38% 14 307 230 58 36.71% 3 14 1,133 1,363 5,429 13 3.386% 16.875% 17,915,568 0.038% 0.030% 0.001%
7 Sudan * 6,081 151 2.64% 27 216 359 14 4.20% 17 12 2,014 2,373 3,708 8 5.904% 15.129% 43,849,260 0.014% 0.008% 0.001%
8 Nigeria * 12,233 328 2.85% 25 389 342 10 3.10% 23 9 3,826 4,168 8,065 2 2.796% 8.205% 206,139,589 0.006% 0.004%
9 Japan * 17,103 46 0.27% 257 39 914 4 0.44% 157 7 15,079 15,993 1,110 7 5.344% 5.715% 126,476,461 0.014% 0.001% 0.001%
10 Argentina * 22,020 840 4.16% 18 983 648 27 4.39% 17 6 6,180 6,828 15,192 14 2.943% 9.490% 45,195,774 0.049% 0.034% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
11 Honduras * 6,155 91 1.55% 46 184 250 5 2.06% 35 2 697 947 5,208 25 4.062% 26.399% 9,904,607 0.062% 0.053% 0.003%
12 Congo * 683 48 22 2 210 232 451 4 3.221% 9.483% 5,518,087 0.012% 0.008%
13 New... * 20 18 18 2 285,498 0.007% 0.001%
14 Portugal * 34,351 382 1.12% 62 1,474 9 0.61% 114 20,807 22,281 12,070 145 4.291% 6.616% 10,196,709 0.337% 0.118% 0.014% 0.001%
15 Poland * 25,986 576 2.27% 31 1,153 16 1.41% 50 12,641 13,794 12,192 30 4.437% 8.359% 37,846,611 0.069% 0.032% 0.003%
16 New Zealand * 1,504 22 1,481 1,503 1 4 1.463% 1.464% 4,822,233 0.031%
17 Netherlands * 47,335 183 0.39% 179 6,011 6 0.10% 695 6,011 41,324 351 12.699% 100.000% 17,134,872 0.276% 0.241% 0.035% 0.002%
18 Nepal * 3,235 323 11.09% 7 13 2 18.18% 5 365 378 2,857 0.402% 3.439% 29,136,808 0.011% 0.010%
19 Ré... * 480 1 411 412 68 1 0.208% 0.243% 895,312 0.054% 0.008%
20 Qatar * 67,195 1,700 2.60% 28 51 2 4.08% 18 42,527 42,578 24,617 18 0.076% 0.120% 2,881,053 2.332% 0.854% 0.002% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
21 Namibia * 29 4 16.00% 5 16 16 13 2,540,905 0.001% 0.001%
22 Nicaragua * 1,118 46 370 416 702 7 4.114% 11.058% 6,624,554 0.017% 0.011% 0.001%
23 Niger * 970 4 65 867 932 38 3 6.701% 6.974% 24,206,644 0.004%
24 Myanmar * 240 4 1.69% 42 6 156 162 78 2.500% 3.704% 54,409,800
25 Oman * 16,016 930 6.16% 12 72 3,451 3,523 12,493 14 0.450% 2.044% 5,106,626 0.314% 0.245% 0.001%
26 Pakistan * 93,983 4,734 5.30% 14 1,935 97 5.28% 14 32,581 34,516 59,467 9 2.059% 5.606% 220,892,340 0.043% 0.027% 0.001%
27 Palestine * 464 3 400 403 61 1 0.647% 0.744% 5,101,414 0.009% 0.001%
28 Norway * 8,531 21 0.25% 282 238 8,138 8,376 155 44 2.790% 2.841% 5,421,241 0.157% 0.003% 0.004% 0.001%
29 Paraguay * 1,090 3 0.28% 252 11 532 543 547 2 1.009% 2.026% 7,132,538 0.015% 0.008%
30 Philippines 21,340 714 3.46% 21 994 7 0.71% 99 4,441 5,435 15,905 9 4.658% 18.289% 109,581,078 0.019% 0.015% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
31 Peru * 191,758 4,358 2.33% 31 5,301 139 2.69% 27 82,731 88,032 103,726 161 2.764% 6.022% 32,971,854 0.582% 0.315% 0.016%
32 North... * 2,915 125 4.48% 16 151 2 1.34% 52 1,640 1,791 1,124 72 5.180% 8.431% 2,083,374 0.140% 0.054% 0.007% 0.003%
33 Papua New... * 8 8 8 8,947,024
34 Morocco * 8,151 80 0.99% 71 208 7,315 7,523 628 6 2.552% 2.765% 36,910,560 0.022% 0.002% 0.001%
35 Malawi * 409 4 55 59 350 0.978% 6.780% 19,129,952 0.002% 0.002%
36 Madagascar * 1,026 51 5.23% 14 8 1 14.29% 6 212 220 806 0.780% 3.636% 27,691,018 0.004% 0.003%
37 Malaysia * 8,303 37 0.45% 156 117 1 0.86% 81 6,635 6,752 1,551 4 1.409% 1.733% 32,365,999 0.026% 0.005%
38 Maldives * 1,901 18 0.96% 73 8 1 14.29% 6 763 771 1,130 15 0.421% 1.038% 540,544 0.352% 0.209% 0.001% 0.003%
39 Mali * 1,523 38 2.56% 28 90 3 3.45% 21 845 935 588 4 5.909% 9.626% 20,250,833 0.008% 0.003%
40 Macao * 45 45 45 649,335 0.007%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
41 Luxembourg * 4,035 3 0.07% 932 110 3,888 3,998 37 176 2.726% 2.751% 625,978 0.645% 0.006% 0.018% 0.028%
42 Liberia * 345 11 3.29% 22 30 185 215 130 6 8.696% 13.953% 5,057,681 0.007% 0.003% 0.001%
43 Libya * 256 30 14.35% 6 17 5 52 57 199 1 1.953% 8.772% 6,871,292 0.004% 0.003%
44 Liechtens... * 82 1 55 56 26 26 1.220% 1.786% 38,128 0.215% 0.068% 0.003% 0.068%
45 Lithuania * 1,705 11 0.65% 108 71 1,321 1,392 313 26 4.164% 5.101% 2,722,289 0.063% 0.011% 0.003% 0.001%
46 Malta * 627 2 0.32% 217 9 596 605 22 20 1.435% 1.488% 441,543 0.142% 0.005% 0.002% 0.005%
47 Martinique * 202 2 1.00% 70 14 98 112 90 37 6.931% 12.500% 375,265 0.054% 0.024% 0.004% 0.010%
48 Montenegro * 324 9 315 324 14 2.778% 2.778% 628,066 0.052% 0.001% 0.002%
49 Montserrat * 11 1 10 11 200 9.091% 9.091% 4,992 0.220% 0.020% 4.006%
50 Romania * 20,290 187 0.93% 75 1,322 6 0.46% 153 14,419 15,741 4,549 69 6.516% 8.398% 19,237,691 0.105% 0.024% 0.007%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
51 Mozambique * 409 55 15.54% 5 2 126 128 281 0.489% 1.563% 31,255,435 0.001% 0.001%
52 Mongolia * 193 2 1.05% 67 71 71 122 3,278,290 0.006% 0.004%
53 Monaco * 99 4 93 97 2 102 4.040% 4.124% 39,242 0.252% 0.005% 0.010% 0.260%
54 Mauritania * 947 64 7.25% 10 49 6 13.95% 6 104 153 794 11 5.174% 32.026% 4,649,658 0.020% 0.017% 0.001%
55 Mauritius * 337 10 324 334 3 8 2.967% 2.994% 1,271,768 0.026% 0.001% 0.001%
56 Mayotte * 2,079 25 1,523 1,548 531 92 1.203% 1.615% 272,815 0.762% 0.195% 0.009% 0.034%
57 Moldova * 9,511 264 2.85% 25 331 8 2.48% 29 5,450 5,781 3,730 82 3.480% 5.726% 4,033,963 0.236% 0.092% 0.008% 0.002%
58 MS Zaandam * 9 2 2 7 22.222% 100.000% 1,243 0.724% 0.563% 0.161%
59 Saint... * 15 15 15 53,199 0.028%
60 Trinidad... * 117 8 108 116 1 6 6.838% 6.897% 1,399,488 0.008% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
61 Togo * 487 2 0.41% 169 13 240 253 234 2 2.669% 5.138% 8,278,724 0.006% 0.003%
62 Tunisia * 1,087 49 977 1,026 61 4 4.508% 4.776% 11,818,619 0.009% 0.001%
63 Turkey * 169,218 878 0.52% 134 4,669 21 0.45% 154 135,322 139,991 29,227 55 2.759% 3.335% 84,339,067 0.201% 0.035% 0.006%
64 Turks and... * 12 1 11 12 26 8.333% 8.333% 38,717 0.031% 0.003% 0.067%
65 Timor-Leste * 24 24 24 1,318,445 0.002%
66 Thailand * 3,104 2 0.06% 1,076 58 2,971 3,029 75 1 1.869% 1.915% 69,799,978 0.004%
67 Syria * 125 1 0.81% 87 6 58 64 61 4.800% 9.375% 17,500,658 0.001%
68 Switzerland * 30,956 20 0.06% 1,073 1,921 28,700 30,621 335 222 6.206% 6.273% 8,654,622 0.358% 0.004% 0.022% 0.003%
69 Taiwan * 443 7 429 436 7 1.580% 1.606% 23,816,775 0.002%
70 Tajikistan * 4,453 83 1.90% 37 48 2,583 2,631 1,822 5 1.078% 1.824% 9,537,645 0.047% 0.019% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
71 Tanzania * 509 21 183 204 305 4.126% 10.294% 59,734,218 0.001% 0.001%
72 UAE * 38,268 626 1.66% 43 275 1 0.36% 191 21,061 21,336 16,932 28 0.719% 1.289% 9,890,402 0.387% 0.171% 0.003%
73 Uganda * 593 36 6.46% 12 82 82 511 45,741,007 0.001% 0.001%
74 Western... * 9 1 6 7 2 2 11.111% 14.286% 597,339 0.002%
75 Vietnam * 329 1 0.30% 228 307 307 22 97,338,579
76 Yemen * 482 13 2.77% 26 111 23 134 348 4 23.029% 82.836% 29,825,964 0.002% 0.001%
77 Zambia * 1,089 7 912 919 170 0.643% 0.762% 18,383,955 0.006% 0.001%
78 Zimbabwe * 279 28 11.81% 7 14 4 33 37 242 1.434% 10.811% 14,862,924 0.002% 0.002%
79 Venezuela * 2,145 58 2.78% 26 20 334 354 1,791 1 0.932% 5.650% 28,435,940 0.008% 0.006%
80 Vatican City * 12 12 12 825 1.455%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
81 UK * 284,868 1,557 0.55% 127 40,465 204 0.51% 138 40,465 244,403 596 14.205% 100.000% 67,886,011 0.420% 0.360% 0.060% 0.001%
82 Ukraine * 26,514 550 2.12% 34 777 15 1.97% 36 11,812 12,589 13,925 18 2.931% 6.172% 43,733,762 0.061% 0.032% 0.002%
83 Uruguay * 845 2 0.24% 289 11 23 726 749 96 7 2.722% 3.071% 3,473,730 0.024% 0.003% 0.001%
84 Uzbekistan * 4,094 57 1.42% 50 30 17 1 6.25% 12 3,268 3,285 809 1 0.415% 0.518% 33,469,203 0.012% 0.002%
85 Sweden * 43,887 948 2.21% 32 4,656 17 0.37% 190 4,656 39,231 461 10.609% 100.000% 10,099,265 0.435% 0.388% 0.046% 0.005%
86 Suriname * 100 8 8.89% 9 2 1 9 10 90 2 1.000% 10.000% 586,632 0.017% 0.015%
87 Sao Tome... * 499 12 68 80 419 55 2.405% 15.000% 219,159 0.228% 0.191% 0.005% 0.025%
88 San Marino * 680 42 428 470 210 1,238 6.176% 8.936% 33,931 2.004% 0.619% 0.124% 3.649%
89 Saudi Arabia * 98,869 3,121 3.26% 22 676 34 5.30% 14 71,791 72,467 26,402 19 0.684% 0.933% 34,813,871 0.284% 0.076% 0.002%
90 Senegal * 4,249 94 2.26% 31 47 2 4.44% 16 2,512 2,559 1,690 3 1.106% 1.837% 16,743,927 0.025% 0.010%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
91 Serbia * 11,741 74 0.63% 110 248 1 0.40% 172 11,056 11,304 437 28 2.112% 2.194% 8,737,371 0.134% 0.005% 0.003%
92 Saint... * 1 1 1 5,794 0.017%
93 Saint Martin * 41 3 33 36 5 78 7.317% 8.333% 38,666 0.106% 0.013% 0.008% 0.202%
94 Rwanda * 431 11 2.62% 27 2 283 285 146 0.464% 0.702% 12,952,218 0.003% 0.001%
95 S. Korea * 11,776 51 0.44% 159 57 273 10,552 10,825 951 5 2.318% 2.522% 51,269,185 0.023% 0.002% 0.001%
96 Lesotho * 4 2 2 2 2,142,249
97 Saint Lucia * 19 18 18 1 183,627 0.010% 0.001%
98 Seychelles * 11 11 11 98,347 0.011%
99 Sierra Leone * 946 17 1.83% 39 48 1 2.13% 33 600 648 298 6 5.074% 7.407% 7,976,983 0.012% 0.004% 0.001%
100 Spain * 288,390 332 0.12% 602 27,135 1 18,809 27,135 261,255 580 9.409% 100.000% 46,754,778 0.617% 0.559% 0.058% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
101 South Sudan * 994 10 6 16 978 1 1.006% 62.500% 11,193,725 0.009% 0.009%
102 Sri Lanka * 1,814 13 0.72% 97 11 891 902 912 1 0.606% 1.220% 21,413,249 0.008% 0.004%
103 St. Barth * 6 6 6 9,877 0.061%
104 St.... * 26 15 15 11 110,940 0.023% 0.010%
105 South Africa * 45,973 2,539 5.85% 13 952 44 4.85% 15 24,258 25,210 20,763 16 2.071% 3.776% 59,308,690 0.078% 0.035% 0.002%
106 Somalia * 2,289 85 3.86% 19 82 3 3.80% 19 431 513 1,776 5 3.582% 15.984% 15,893,222 0.014% 0.011% 0.001%
107 Singapore * 37,527 344 0.93% 76 25 1 4.17% 17 24,559 24,584 12,943 4 0.067% 0.102% 5,850,342 0.641% 0.221%
108 Sint Maarten * 77 15 61 76 1 350 19.481% 19.737% 42,876 0.180% 0.002% 0.035% 0.816%
109 Slovakia * 1,528 2 0.13% 530 28 1,379 1,407 121 5 1.832% 1.990% 5,459,642 0.028% 0.002% 0.001%
110 Slovenia * 1,484 5 0.34% 206 109 1,359 1,468 16 52 7.345% 7.425% 2,078,938 0.071% 0.001% 0.005% 0.003%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
111 Russia * 458,689 8,855 1.97% 36 5,725 197 3.56% 20 221,388 227,113 231,576 39 1.248% 2.521% 145,934,462 0.314% 0.159% 0.004%
112 Kyrgyzstan * 1,974 38 1.96% 36 22 1,360 1,382 592 3 1.114% 1.592% 6,524,195 0.030% 0.009%
113 CAR * 1,570 119 8.20% 9 5 1 25.00% 4 37 42 1,528 1 0.318% 11.905% 4,829,767 0.033% 0.032%
114 Canada * 95,057 691 0.73% 95 41 7,773 71 0.92% 76 53,614 61,387 33,670 206 8.177% 12.662% 37,742,154 0.252% 0.089% 0.021% 0.001%
115 Caribbean... * 7 7 7 26,223 0.027%
116 Cayman... * 164 1 93 94 70 15 0.610% 1.064% 65,722 0.250% 0.107% 0.002% 0.023%
117 Chad * 836 69 1 1.47% 48 672 741 95 4 8.254% 9.312% 16,425,864 0.005% 0.001%
118 Cameroon * 7,599 207 2.80% 26 212 7 3.41% 21 4,587 4,799 2,800 8 2.790% 4.418% 26,545,863 0.029% 0.011% 0.001%
119 Cambodia * 125 123 123 2 16,718,965 0.001%
120 Bulgaria * 2,711 41 1.56% 45 43 160 1 0.63% 111 1,545 1,705 1,006 23 5.902% 9.384% 6,948,445 0.039% 0.014% 0.002%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
121 Burkina Faso * 888 53 765 818 70 3 5.968% 6.479% 20,903,273 0.004%
122 Burundi * 83 20 1 45 46 37 1.205% 2.174% 11,890,784 0.001%
123 Cabo Verde * 542 6 1.12% 63 5 240 245 297 9 0.923% 2.041% 555,987 0.097% 0.053% 0.001% 0.002%
124 Channel... * 563 2 0.36% 195 46 512 558 5 265 8.171% 8.244% 173,863 0.324% 0.003% 0.026% 0.152%
125 Chile * 127,745 5,246 4.28% 17 1,541 93 6.42% 12 95,631 97,172 30,573 81 1.206% 1.586% 19,116,201 0.668% 0.160% 0.008%
126 Czechia * 9,567 26 0.27% 255 21 327 6,885 7,212 2,355 31 3.418% 4.534% 10,708,981 0.089% 0.022% 0.003%
127 Cyprus * 960 18 1 5.88% 13 807 825 135 15 1.875% 2.182% 1,207,359 0.080% 0.011% 0.001% 0.001%
128 Denmark * 11,924 49 0.41% 169 587 1 0.17% 407 10,721 11,308 616 101 4.923% 5.191% 5,792,202 0.206% 0.011% 0.010% 0.002%
129 Diamond... * 712 13 651 664 48 1.826% 1.958% 3,711 19.186% 1.293% 0.350%
130 Djibouti * 4,169 46 1.12% 63 26 1,815 1,841 2,328 26 0.624% 1.412% 988,000 0.422% 0.236% 0.003% 0.003%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
131 Cura&cced... * 21 1 15 16 5 6 4.762% 6.250% 164,093 0.013% 0.003% 0.001% 0.004%
132 Cuba * 2,173 40 1.88% 38 83 1,855 1,938 235 7 3.820% 4.283% 11,326,616 0.019% 0.002% 0.001%
133 China * 83,036 3 19,184 6 4,634 78,332 82,966 70 3 5.581% 5.585% 1,439,323,776 0.006%
134 Comoros * 141 9 6.82% 11 2 67 69 72 2 1.418% 2.899% 869,601 0.016% 0.008%
135 Costa Rica * 1,263 35 2.85% 25 10 701 711 552 2 0.792% 1.406% 5,094,118 0.025% 0.011%
136 Croatia * 2,247 104 1 0.97% 72 2,121 2,225 22 25 4.628% 4.674% 4,105,267 0.055% 0.001% 0.003% 0.001%
137 Brunei * 141 2 138 140 1 5 1.418% 1.429% 437,479 0.032% 0.001%
138 British... * 8 1 7 8 33 12.500% 12.500% 30,231 0.026% 0.003% 0.109%
139 Aruba * 101 3 98 101 28 2.970% 2.970% 106,766 0.095% 0.003% 0.026%
140 Armenia * 12,364 547 4.63% 16 190 7 3.83% 19 3,720 3,910 8,454 64 1.537% 4.859% 2,963,243 0.417% 0.285% 0.006% 0.002%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
141 Australia * 7,255 4 0.06% 1,257 102 6,690 6,792 463 4 1.406% 1.502% 25,499,884 0.028% 0.002%
142 Austria * 16,898 55 0.33% 213 672 15,789 16,461 437 75 3.977% 4.082% 9,006,398 0.188% 0.005% 0.007% 0.001%
143 Azerbaijan * 7,239 379 5.52% 13 84 2 2.44% 29 4,024 4,108 3,131 8 1.160% 2.045% 10,139,177 0.071% 0.031% 0.001%
144 Antigua... * 26 3 20 23 3 31 11.538% 13.043% 97,929 0.027% 0.003% 0.003% 0.032%
145 Anguilla * 3 3 3 15,003 0.020%
146 Albania * 1,232 20 1.65% 43 34 1 3.03% 24 925 959 273 12 2.760% 3.545% 2,877,797 0.043% 0.009% 0.001%
147 Algeria * 10,050 115 1.16% 61 698 8 1.16% 61 6,631 7,329 2,721 16 6.945% 9.524% 43,851,044 0.023% 0.006% 0.002%
148 Andorra * 852 51 741 792 60 660 5.986% 6.439% 77,265 1.103% 0.078% 0.066% 0.854%
149 Angola * 88 2 2.33% 31 4 24 28 60 4.545% 14.286% 32,866,272
150 Bahamas * 103 1 0.98% 72 11 62 73 30 28 10.680% 15.068% 393,244 0.026% 0.008% 0.003% 0.007%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
151 Bahrain * 14,383 548 3.96% 18 24 2 9.09% 8 9,056 9,080 5,303 14 0.167% 0.264% 1,701,575 0.845% 0.312% 0.001% 0.001%
152 Bhutan * 48 11 11 37 771,608 0.006% 0.005%
153 Bermuda * 141 9 114 123 18 144 6.383% 7.317% 62,278 0.226% 0.029% 0.014% 0.231%
154 Bolivia * 12,728 483 3.94% 18 427 12 2.89% 25 1,739 2,166 10,562 37 3.355% 19.714% 11,673,021 0.109% 0.090% 0.004%
155 Bosnia... * 2,606 159 1,968 2,127 479 48 6.101% 7.475% 3,280,819 0.079% 0.015% 0.005% 0.001%
156 Botswana * 40 1 23 24 16 2.500% 4.167% 2,351,627 0.002% 0.001%
157 Benin * 261 3 151 154 107 1.149% 1.948% 12,123,200 0.002% 0.001%
158 Belize * 19 1 5.56% 13 2 16 18 1 5 10.526% 11.111% 397,628 0.005% 0.001% 0.001%
159 Bangladesh * 63,026 2,635 4.36% 17 846 35 4.32% 17 13,325 14,171 48,855 5 1.342% 5.970% 164,689,383 0.038% 0.030% 0.001%
160 Barbados * 92 7 81 88 4 24 7.609% 7.955% 287,375 0.032% 0.001% 0.002% 0.008%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
161 Belarus * 47,751 883 1.88% 38 263 4 1.54% 46 23,015 23,278 24,473 28 0.551% 1.130% 9,449,323 0.505% 0.259% 0.003%
162 Belgium * 59,072 165 0.28% 248 9,580 14 0.15% 474 16,190 25,770 33,302 827 16.217% 37.175% 11,589,623 0.510% 0.287% 0.083% 0.007%
163 Dominica * 18 16 16 2 71,986 0.025% 0.003%
164 Dominican... * 19,195 487 2.60% 27 536 11 2.10% 34 11,919 12,455 6,740 49 2.792% 4.303% 10,847,910 0.177% 0.062% 0.005%
165 India * 246,622 10,438 4.42% 17 6,946 297 4.47% 16 118,695 125,641 120,981 5 2.816% 5.528% 1,380,004,385 0.018% 0.009% 0.001%
166 Iceland * 1,806 10 1,794 1,804 2 29 0.554% 0.554% 341,243 0.529% 0.001% 0.003% 0.008%
167 Indonesia * 30,514 993 3.36% 21 1,801 31 1.75% 40 9,907 11,708 18,806 7 5.902% 15.383% 273,523,615 0.011% 0.007% 0.001%
168 Iran * 169,425 2,269 1.36% 52 8,209 75 0.92% 76 132,038 140,247 29,178 98 4.845% 5.853% 83,992,949 0.202% 0.035% 0.010%
169 Iraq * 11,098 1,252 12.72% 6 318 33 11.58% 7 4,904 5,222 5,876 8 2.865% 6.090% 40,222,493 0.028% 0.015% 0.001%
170 Hungary * 3,990 20 0.50% 138 545 3 0.55% 126 2,279 2,824 1,166 56 13.659% 19.299% 9,660,351 0.041% 0.012% 0.006% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
171 Hong Kong * 1,106 3 0.27% 256 4 1,048 1,052 54 1 0.362% 0.380% 7,496,981 0.015% 0.001%
172 Guinea * 4,117 57 1.40% 50 23 2,857 2,880 1,237 2 0.559% 0.799% 13,132,795 0.031% 0.009%
173 Guinea-Bi... * 1,368 29 2.17% 33 12 4 50.00% 2 153 165 1,203 6 0.877% 7.273% 1,968,001 0.070% 0.061% 0.001%
174 Guyana * 154 1 12 80 92 62 15 7.792% 13.043% 786,552 0.020% 0.008% 0.002% 0.002%
175 Haiti * 3,072 184 6.72% 11 148 50 24 74 2,998 4 1.628% 67.568% 11,402,528 0.027% 0.026%
176 Ireland * 25,183 20 0.08% 873 1,678 8 0.48% 146 22,698 24,376 807 340 6.663% 6.884% 4,937,786 0.510% 0.016% 0.034% 0.007%
177 Isle of Man * 336 24 312 336 282 7.143% 7.143% 85,033 0.395% 0.028% 0.332%
178 Kuwait * 31,131 487 1.59% 44 254 10 4.10% 18 19,282 19,536 11,595 60 0.816% 1.300% 4,270,571 0.729% 0.272% 0.006% 0.001%
179 Kenya * 2,600 126 5.09% 14 83 4 5.06% 15 706 789 1,811 2 3.192% 10.520% 53,771,296 0.005% 0.003%
180 Afghanistan * 19,551 582 3.07% 23 327 18 5.83% 13 1,830 2,157 17,394 8 1.673% 15.160% 38,928,346 0.050% 0.045% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
181 Laos * 19 18 18 1 7,275,560
182 Latvia * 1,086 1 0.09% 753 25 781 806 280 13 2.302% 3.102% 1,886,198 0.058% 0.015% 0.001% 0.001%
183 Kazakhstan * 12,511 199 1.62% 44 53 1 1.92% 37 7,135 7,188 5,323 3 0.424% 0.737% 18,776,707 0.067% 0.028%
184 Jordan * 795 11 1.40% 50 9 586 595 200 1 1.132% 1.513% 10,203,134 0.008% 0.002%
185 Israel 17,752 190 1.08% 65 295 4 1.37% 51 15,042 15,337 2,415 32 1.662% 1.923% 8,655,535 0.205% 0.028% 0.003%
186 Italy * 234,801 270 0.12% 603 33,846 72 0.21% 326 165,078 198,924 35,877 560 14.415% 17.015% 60,461,826 0.388% 0.059% 0.056% 0.001%
187 Ivory Coast * 3,557 126 3.67% 20 36 1,750 1,786 1,771 1 1.012% 2.016% 26,378,274 0.013% 0.007%
188 Jamaica * 596 4 0.68% 103 1 10 404 414 182 3 1.678% 2.415% 2,961,167 0.020% 0.006%
189 Guadeloupe * 164 14 144 158 6 35 8.537% 8.861% 400,124 0.041% 0.001% 0.003% 0.009%
190 Grenada * 23 22 22 1 112,523 0.020% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
191 Eswatini * 322 17 5.57% 13 3 224 227 95 3 0.932% 1.322% 1,160,164 0.028% 0.008%
192 Estonia * 1,931 21 1.10% 64 69 1,675 1,744 187 52 3.573% 3.956% 1,326,535 0.146% 0.014% 0.005% 0.004%
193 Ethiopia * 1,934 129 7.15% 11 20 1 5.26% 14 281 301 1,633 1.034% 6.645% 114,963,588 0.002% 0.001%
194 Faeroe... * 187 187 187 48,863 0.383%
195 Falkland... * 13 13 13 3,480 0.374%
196 Eritrea * 39 39 39 3,546,421 0.001%
197 Equatoria... * 1,306 12 200 212 1,094 9 0.919% 5.660% 1,402,985 0.093% 0.078% 0.001% 0.001%
198 DRC * 3,878 114 3.03% 24 82 1 1.23% 57 537 619 3,259 1 2.114% 13.247% 89,561,403 0.004% 0.004%
199 Ecuador * 41,575 3,534 20,568 24,102 17,473 201 8.500% 14.663% 17,643,054 0.236% 0.099% 0.020% 0.001%
200 Egypt * 32,612 1,497 4.81% 15 1,198 32 2.74% 26 8,538 9,736 22,876 12 3.673% 12.305% 102,334,404 0.032% 0.022% 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
201 El Salvador * 2,934 85 2.98% 24 53 1,281 1,334 1,600 8 1.806% 3.973% 6,486,205 0.045% 0.025% 0.001%
202 Fiji * 18 18 18 896,445 0.002%
203 Finland * 6,964 23 0.33% 210 322 5,800 6,122 842 58 4.624% 5.260% 5,540,720 0.126% 0.015% 0.006% 0.001%
204 Ghana * 9,462 294 3.21% 22 44 2 4.76% 15 3,547 3,591 5,871 1 0.465% 1.225% 31,072,940 0.030% 0.019%
205 Germany * 185,696 258 0.14% 499 25 8,769 6 0.07% 1,013 168,900 177,669 8,027 105 4.722% 4.936% 83,783,942 0.222% 0.010% 0.010%
206 Gibraltar * 175 1 0.57% 121 155 155 20 33,691 0.519% 0.059%
207 Greece * 2,980 13 0.44% 159 180 1,374 1,554 1,426 17 6.040% 11.583% 10,423,054 0.029% 0.014% 0.002%
208 Greenland * 13 13 13 56,770 0.023%
209 Georgia * 808 3 0.37% 187 13 663 676 132 3 1.609% 1.923% 3,989,167 0.020% 0.003%
210 Gambia * 26 1 21 22 4 3.846% 4.545% 2,416,668 0.001%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 6,973,427 140,183 2.06% 34 31,863 402,049 4,198 1.06% 66 1,187 3,205,269 3,607,318 3,366,109 11,982 5.765% 11.145% 7,800,000,000 0.089% 0.043% 0.005%
211 France * 153,634 579 0.38% 184 29,142 31 0.11% 652 70,806 99,948 53,686 447 18.968% 29.157% 65,273,511 0.235% 0.082% 0.045% 0.001%
212 French... * 639 50 8.49% 9 1 348 349 290 3 0.156% 0.287% 298,682 0.214% 0.097% 0.001%
213 French... * 60 60 60 280,908 0.021%
214 Gabon * 3,101 146 4.94% 15 21 833 854 2,247 9 0.677% 2.459% 2,225,734 0.139% 0.101% 0.001%
215 Lebanon * 1,320 8 0.61% 115 29 1 3.57% 20 768 797 523 4 2.197% 3.639% 6,825,445 0.019% 0.008%
Running Time: 40.705 milliseconds, this hour: 4.


PHP Source Code


<?php
/*------------------------------------------------------------*/
class Corona extends Mcontroller {
    
/*------------------------------------------------------------*/
    
protected $coronaUtils;
    protected 
$Mmemcache;
    
/*------------------------------*/
    
private $startTime;
    private 
$ttl;
    
/*------------------------------------------------------------*/
    
public function __construct() {
        
parent::__construct();
        
$this->coronaUtils = new CoronaUtils;
        
$this->Mmemcache = new Mmemcache;
        
$this->ttl 300;
    }
    
/*------------------------------------------------------------*/
    /*------------------------------------------------------------*/
    
protected function before() {
        
$this->startTime microtime(true);
        
ini_set('max_execution_time'10);
        
ini_set("memory_limit""30M");

        
$this->coronaUtils->prior($this->controller$this->action);
        
$this->cacheQps();
        
$this->Mview->assign(array(
            
'controller' => $this->controller,
            
'action' => $this->action,
        ));
        
$this->Mview->showTpl("head.tpl");
        
$this->Mview->showTpl("header.tpl");
    }
    
/*------------------------------*/
    
protected function after() {
        
$endTime microtime(true);
        
$time $endTime $this->startTime ;
        
$millis $time 1000;
        
$millis round($millis3);
        
$qpsString $this->qpsString();

        
$this->Mview->msg("Running Time: $millis milliseconds$qpsString.");
        
$a '<br /><br /><a name="viewSource"><h4>PHP Source Code</h4></a><br />';
        
$this->Mview->pushOutput($a);
        
$src highlight_file(__FILE__true);
        
$this->Mview->pushOutput($src);
        
$this->Mview->showTpl("footer.tpl");
        
$this->Mview->showTpl("foot.tpl");
    }
    
/*------------------------------------------------------------*/
    /*------------------------------------------------------------*/
    
public function index() {
        
$this->showBy();
    }
    
/*------------------------------------------------------------*/
    
public function showBy() {
        
$by = @$_REQUEST['by'];
        if ( ! 
$by )
            
$by "cases";
        
$rows $this->getRows();
        if ( ! 
$rows ) {
            
$this->Mview->msg("No Rows");
            return;
        }
        
$ucfirst ucfirst($by);
        
usort($rows, array($this"by$ucfirst"));
        
$totals = array(
            
'country' => "World",
            
'cases' => Mutils::arraySum($rows"cases"),
            
'dbyCases' => Mutils::arraySum($rows"dbyCases"),
            
'yesterday' => Mutils::arraySum($rows"yesterday"),
            
'today' => Mutils::arraySum($rows"today"),
            
'deaths' => Mutils::arraySum($rows"deaths"),
            
'dbyDeaths' => Mutils::arraySum($rows"dbyDeaths"),
            
'deathsYesterday' => Mutils::arraySum($rows"deathsYesterday"),
            
'testsYesterday' => Mutils::arraySum($rows"testsYesterday"),
            
'deathsToday' => Mutils::arraySum($rows"deathsToday"),
            
'recovered' => Mutils::arraySum($rows"recovered"),
            
'tests' => Mutils::arraySum($rows"tests"),
            
'yActive' => Mutils::arraySum($rows"yActive"),
            
'activeDelta' => Mutils::arraySum($rows"activeDelta"),
        );
        
$this->ammendRow($totals);
        
$totals['growth'] = ($totals['yesterday']/$totals['dbyCases']) * 100;
        
$totals['doubles'] = $this->doubles($totals['growth']);
        
$totals['deathsGrowth'] = ($totals['deathsYesterday']/$totals['dbyDeaths']) * 100;
        
$totals['deathsDoubles'] = $this->doubles($totals['deathsGrowth']);
        
$this->Mview->showTpl("corona.tpl", array(
            
'rows' => $rows,
            
'totals' => $totals,
            
'by' => $by,
            
'myCountry' => @$_COOKIE['myCountry'],
        ));
    }
    
/*------------------------------------------------------------*/
    
public function legend() {
        
$this->Mview->showTpl("legend.tpl");
    }
    
/*------------------------------------------------------------*/
    
public function myCountry() {
        
$country $_REQUEST['country'];
        
$this->Mview->setCookie("myCountry"$country);
        
$this->redirect("/");
    }
    
/*------------------------------------------------------------*/
    /*------------------------------------------------------------*/
    
private function getRows() {
        
$date date("Y-m-d");
        
$mkey "getRows-$date";
        
$rows $this->Mmemcache->get($mkey);
        if ( 
$rows )
            return(
$rows);
        
$sql "select * from covid19 where date = '$date'";
        
$rows $this->Mmodel->getRows($sql$this->ttl);
        if ( ! 
$rows ) {
            return(
null);
        }
        
$this->ammendRows($rows);
        
$this->Mmemcache->set($mkey$rows$this->ttl);
        return(
$rows);
    }
    
/*------------------------------------------------------------*/
    
private function ammendRows(&$rows) {
        foreach ( 
$rows as $key => $row )
            
$this->ammendRow($rows[$key]);
    }
    
/*------------------------------*/
    
private function ammendRow(&$row) {
        
$dby date("Y-m-d"time() - 2*24*3600);
        
$yesterday date("Y-m-d"time() - 24*3600);
        
$country $row['country'];
        if ( 
$country != 'World' ) {
            
$row['dbyCases'] = $this->metric($country$dby'cases');
            
$row['yCases'] = $this->metric($country$yesterday'cases');
            
$row['yRecovered'] = $this->metric($country$yesterday'recovered');
            
$row['dbyRecovered'] = $this->metric($country$dby'recovered');
            
$row['dbyDeaths'] = $this->metric($country$dby'deaths');
            
$row['yDeaths']  = $this->metric($country$yesterday'deaths');
            
$row['yClosed'] = $row['yRecovered'] + $row['yDeaths'];
            
$row['dbyClosed'] = $row['dbyRecovered'] + $row['dbyDeaths'];
            
$row['dbyTests'] = $this->metric($country$dby'tests');
            
$row['yTests'] = $this->metric($country$yesterday'tests');

            
$row['yesterday'] = $row['yCases'] - $row['dbyCases'];
            
$row['growth'] = $row['dbyCases'] ? ($row['yesterday']/$row['dbyCases']) * 100 0;
            
$row['doubles'] = $this->doubles($row['growth']);
            
$row['today'] = $row['cases'] - $row['yCases'];
            
$row['closed'] = $row['recovered'] + $row['deaths'];
            
$row['active'] = $row['cases'] - $row['closed'];
            
$row['dbyActive'] = $row['dbyCases'] - $row['dbyClosed'];
            
$row['yActive'] = $row['yCases'] - $row['yClosed'];
            
$row['activeDelta'] = $row['yActive'] - $row['dbyActive'];
            
$row['deathsYesterday'] = $row['yDeaths']- $row['dbyDeaths'];
            
$row['testsYesterday'] = $row['yTests'] - $row['dbyTests'];
            
$row['deathsGrowth'] = $row['dbyDeaths'] ? ($row['deathsYesterday']/$row['dbyDeaths']) * 100 0;
            
$row['deathsDoubles'] = $this->doubles($row['deathsGrowth']);
            
$row['deathsToday'] = $row['deaths'] - $row['yDeaths'];
            
/*    Mview::print_r($row, "row", basename(__FILE__), __LINE__, null, false);    */
        
}

        
$row['closed'] = $row['recovered'] + $row['deaths'];
        
$row['active'] = $row['cases'] - $row['closed'];
        
$row['casesDeathRate'] =
            
$row['cases'] ?
                ( 
$row['deaths'] / $row['cases'] ) * 100
                
0;
        
$row['closedDeathRate'] =
            
$row['closed'] ?
                ( 
$row['deaths'] / $row['closed'] ) * 100
                
0;
        
$population $this->population($row['country']);
        if ( 
$population ) {
            
$row['population'] = $population ;
            
$row['casesRate'] = 
                ( 
$row['cases'] / $population ) * 100 ;
            
$row['activeRate'] = 
                ( 
$row['active'] / $population ) * 100 ;
            
$row['populationDeathRate'] =
                ( 
$row['deaths'] / $population ) * 100 ;
            
$row['testRate'] = 
                ( 
$row['tests'] / $population ) * 100 ;
        } else {
            
$row['population'] = ;
            
$row['populationDeathRate'] = 0;
            
$row['casesRate'] = 0;
            
$row['activeRate'] = 0;
            
$row['testRate'] = 0;
        }
    }
    
/*------------------------------------------------------------*/
    // sort functions = /showBy?by=funcName
    /*------------------------------*/
    
private function cmp($a$b) {
        return(
$a $b : ( $a $b ? -) );
    }
    
/*------------------------------*/
    /*------------------------------*/
    
private function byCases($b$a) {
        return(
$this->cmp($a['cases'], $b['cases']));
    }
    
/*------------------------------*/
    
private function byYesterday($b$a) {
        return(
$this->cmp($a['yesterday'], $b['yesterday']));
    }
    
/*------------------------------*/
    
private function byGrowth($b$a) {
        return(
$this->cmp($a['growth'], $b['growth']));
    }
    
/*------------------------------*/
    
private function byToday($b$a) {
        return(
$this->cmp($a['today'], $b['today']));
    }
    
/*------------------------------*/
    
private function byDeaths($b$a) {
        return(
$this->cmp($a['deaths'], $b['deaths']));
    }
    
/*------------------------------*/
    
private function byDeathsYesterday($b$a) {
        return(
$this->cmp($a['deathsYesterday'], $b['deathsYesterday']));
    }
    
/*------------------------------*/
    
private function byTestsYesterday($b$a) {
        return(
$this->cmp($a['testsYesterday'], $b['testsYesterday']));
    }
    
/*------------------------------*/
    
private function byDeathsGrowth($b$a) {
        return(
$this->cmp($a['deathsGrowth'], $b['deathsGrowth']));
    }
    
/*------------------------------*/
    
private function byDeathsToday($b$a) {
        return(
$this->cmp($a['deathsToday'], $b['deathsToday']));
    }
    
/*------------------------------*/
    
private function byRecovered($b$a) {
        return(
$this->cmp($a['recovered'], $b['recovered']));
    }
    
/*------------------------------*/
    
private function byActive($b$a) {
        return(
$this->cmp($a['active'], $b['active']));
    }
    
/*------------------------------*/
    
private function byActiveDelta($b$a) {
        return(
$this->cmp($a['activeDelta'], $b['activeDelta']));
    }
    
/*------------------------------*/
    
private function byYactive($b$a) {
        return(
$this->cmp($a['yActive'], $b['yActive']));
    }
    
/*------------------------------*/
    
private function byCasesRate($b$a) {
        return(
$this->cmp($a['casesRate'], $b['casesRate']));
    }
    
/*------------------------------*/
    
private function byActiveRate($b$a) {
        return(
$this->cmp($a['activeRate'], $b['activeRate']));
    }
    
/*------------------------------*/
    
private function byClosed($b$a) {
        return(
$this->cmp($a['closed'], $b['closed']));
    }
    
/*------------------------------*/
    
private function byPopulation($b$a) {
        return(
$this->cmp($a['population'], $b['population']));
    }
    
/*------------------------------*/
    
private function byCasesDeathRate($b$a) {
        return(
$this->cmp($a['casesDeathRate'], $b['casesDeathRate']));
    }
    
/*------------------------------*/
    
private function byClosedDeathRate($b$a) {
        return(
$this->cmp($a['closedDeathRate'], $b['closedDeathRate']));
    }
    
/*------------------------------*/
    
private function byTestRate($b$a) {
        return(
$this->cmp($a['testRate'], $b['testRate']));
    }
    
/*------------------------------*/
    
private function byTests($b$a) {
        return(
$this->cmp($a['tests'], $b['tests']));
    }
    
/*------------------------------*/
    
private function byPopulationDeathRate($b$a) {
        return(
$this->cmp($a['populationDeathRate'], $b['populationDeathRate']));
    }
    
/*------------------------------------------------------------*/
    
private function population($country) {
        if ( 
$country == 'World' )
            return(
$this->worldPopulation());
        
$sql "select population from populations where country = '$country'";
        
$population $this->Mmodel->getInt($sql$this->ttl);
        if ( ! 
$population ) {
            
error_log("population: missing: $country");
            return(
null);
        }
        return(
$population);
    }
    
/*------------------------------------------------------------*/
    
private function qpsKeys() {
        return(array(
            array(
                
'title' => 'this second',
                
'key' => "qps-".date("Y-m-d H:i:s"),
                
'ttl' => 3,
            ),
            array(
                
'title' => 'this minute',
                
'key' => "qpm-".date("Y-m-d H:i"),
                
'ttl' => 70,
            ),
            array(
                
'title' => 'this hour',
                
'key' => "qph-".date("Y-m-d H"),
                
'ttl' => 3700,
            ),
            array(
                
'title' => 'today',
                
'key' => "qpd-".date("Y-m-d"),
                
'ttl' => 25*3600,
            ),
        ));
    }
    
/*------------------------------*/
    
private function cacheQps() {
        foreach ( 
$this->qpsKeys() as $key )
            
$this->Mmemcache->increment($key['key'], $key['ttl']);
    }
    
/*------------------------------*/
    
private function qpsString() {
        
$min 3;
        foreach ( 
$this->qpsKeys() as $key ) {
            
$cnt $this->Mmemcache->rawGet($key['key']);
            if ( 
$cnt $min ) {
                
$title $key['title'];
                return(
", $title$cnt");
            }
        }
        return(
"");
    }
    
/*------------------------------------------------------------*/
    
private function worldPopulation() {
        
$key "worldPopulation";
        
$worldPopulation $this->Mmemcache->get($key);
        if ( 
$worldPopulation )
            return(
$worldPopulation);
        
$worldPopulation $this->scrapeWorldPopulation();
        
$this->Mmemcache->set($key$worldPopulation900);
        return(
$worldPopulation);
    }
    
/*------------------------------------------------------------*/
    
private function scrapeWorldPopulation() {
        return(
7.8*1000*1000*1000);
    }
    
/*------------------------------------------------------------*/
    
private function metric($country$date$metric) {
        static 
$cache = array();
        if ( ! @
$cache[$date] ) {
            
$sql "select * from covid19 where date = '$date'";
            
$rows $this->Mmodel->getRows($sql$this->ttl);
            
$indexed Mutils::reindexBy($rows'country');
            
$cache[$date] = $indexed;
        }
        
$metric = @$cache[$date][$country][$metric];
        if ( ! 
$metric ) {
            
/*    error_log("metric($country, $date, $metric) - missing");    */
            
return(0);
        }
        return(
$metric);
    }
    
/*------------------------------------------------------------*/
    
private function doubles($growth) {
        if ( 
$growth == )
            return(
0);
        if ( 
$growth 100 )
            return(
0);
        
$base $growth/100;
        if ( 
$base <= 1.0 )
            return(
0);
        
$numdays 1;
        
$double $base;
        while ( 
$double ) {
            
$double $double $base;
            
$numdays++;
        }
        return(
$numdays);
    }
    
/*------------------------------------------------------------*/
}


© Ohad Aloni 2020