# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
1 Malawi * 203 102 100.99% 4 37 41 162 3,372 1.970% 9.756% 19,129,952 0.001% 0.001% 0.018%
2 St.... * 25 7 38.89% 3 14 14 11 216 110,940 0.023% 0.010% 0.195%
3 Mauritania * 346 54 18.49% 5 19 3 18.75% 5 15 34 312 2,583 5.491% 55.882% 4,649,658 0.007% 0.007% 0.056%
4 Nepal * 1,042 156 17.61% 5 5 1 25.00% 4 187 192 850 162,730 0.480% 2.604% 29,136,808 0.004% 0.003% 0.559%
5 Ethiopia * 831 100 13.68% 6 7 1 16.67% 5 191 198 633 96,566 0.842% 3.535% 114,963,588 0.001% 0.001% 0.084%
6 Haiti * 1,320 146 12.44% 6 34 1 3.03% 24 22 56 1,264 3,475 2.576% 60.714% 11,402,528 0.012% 0.011% 0.030%
7 Bhutan * 31 3 10.71% 7 6 6 25 15,862 771,608 0.004% 0.003% 2.056%
8 Kenya * 1,618 147 9.99% 8 58 3 5.45% 14 421 479 1,139 70,172 3.585% 12.109% 53,771,296 0.003% 0.002% 0.131%
9 Suriname * 12 1 9.09% 8 1 9 10 2 782 8.333% 10.000% 586,632 0.002% 0.133%
10 Bolivia * 7,768 632 8.86% 9 280 6 2.19% 32 689 969 6,799 22,294 3.605% 28.896% 11,673,021 0.067% 0.058% 0.002% 0.191%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
11 Mongolia * 161 13 8.78% 9 43 43 118 13,225 3,278,290 0.005% 0.004% 0.403%
12 Yemen * 278 22 8.59% 9 57 4 7.55% 10 11 68 210 120 20.504% 83.824% 29,825,964 0.001% 0.001%
13 Guinea * 3,553 278 8.49% 9 22 2 10.00% 8 1,950 1,972 1,581 14,407 0.619% 1.116% 13,132,795 0.027% 0.012% 0.110%
14 Djibouti * 2,914 217 8.05% 9 20 2 11.11% 7 1,241 1,261 1,653 25,257 0.686% 1.586% 988,000 0.295% 0.167% 0.002% 2.556%
15 Oman * 9,009 636 7.60% 10 40 1 2.56% 28 2,177 2,217 6,792 72,000 0.444% 1.804% 5,106,626 0.176% 0.133% 0.001% 1.410%
16 Madagascar * 656 44 7.19% 10 2 154 156 500 9,848 0.305% 1.282% 27,691,018 0.002% 0.002% 0.036%
17 Mali * 1,194 78 6.99% 11 72 2 2.86% 25 652 724 470 3,483 6.030% 9.945% 20,250,833 0.006% 0.002% 0.017%
18 Togo * 422 27 6.84% 11 13 197 210 212 18,696 3.081% 6.190% 8,278,724 0.005% 0.003% 0.226%
19 Iraq * 5,457 322 6.27% 12 179 4 2.29% 31 2,971 3,150 2,307 211,485 3.280% 5.683% 40,222,493 0.014% 0.006% 0.526%
20 Libya * 105 6 6.06% 12 5 1 25.00% 4 40 45 60 5,154 4.762% 11.111% 6,871,292 0.002% 0.001% 0.075%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
21 Egypt * 20,793 1,127 5.73% 13 845 29 3.55% 20 5,359 6,204 14,589 135,000 4.064% 13.620% 102,334,404 0.020% 0.014% 0.001% 0.132%
22 French... * 406 22 5.73% 13 1 150 151 255 0.246% 0.662% 298,682 0.136% 0.085%
23 Armenia * 8,216 442 5.69% 13 113 15 15.31% 5 3,287 3,400 4,816 54,931 1.375% 3.324% 2,963,243 0.277% 0.163% 0.004% 1.854%
24 Chile * 86,943 4,654 5.66% 13 890 49 5.83% 13 36,150 37,040 49,903 530,173 1.024% 2.403% 19,116,201 0.455% 0.261% 0.005% 2.773%
25 Somalia * 1,828 97 5.60% 13 72 5 7.46% 10 310 382 1,446 3.939% 18.848% 15,893,222 0.012% 0.009%
26 New... * 19 1 5.56% 13 18 18 1 6,416 285,498 0.007% 2.247%
27 Honduras * 4,640 239 5.43% 14 194 6 3.19% 23 506 700 3,940 14,790 4.181% 27.714% 9,904,607 0.047% 0.040% 0.002% 0.149%
28 Argentina * 13,933 705 5.33% 14 501 9 1.83% 39 4,617 5,118 8,815 145,081 3.596% 9.789% 45,195,774 0.031% 0.020% 0.001% 0.321%
29 Bangladesh * 40,321 2,029 5.30% 14 559 15 2.76% 26 8,425 8,984 31,337 275,776 1.386% 6.222% 164,689,383 0.024% 0.019% 0.167%
30 Brazil * 419,340 19,708 4.93% 15 25,945 910 3.63% 20 192,302 218,247 201,093 871,839 6.187% 11.888% 212,559,417 0.197% 0.095% 0.012% 0.410%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
31 Kyrgyzstan * 1,594 74 4.87% 15 16 1,066 1,082 512 109,521 1.004% 1.479% 6,524,195 0.024% 0.008% 1.679%
32 Guatemala * 4,145 191 4.83% 15 68 5 7.94% 10 493 561 3,584 31,427 1.641% 12.121% 17,915,568 0.023% 0.020% 0.175%
33 Sudan * 4,346 200 4.82% 15 195 11 5.98% 12 749 944 3,402 401 4.487% 20.657% 43,849,260 0.010% 0.008% 0.001%
34 Colombia * 24,104 1,101 4.79% 15 803 27 3.48% 21 6,111 6,914 17,190 283,346 3.331% 11.614% 50,882,891 0.047% 0.034% 0.002% 0.557%
35 Peru * 135,905 6,154 4.74% 15 3,983 195 5.15% 14 56,169 60,152 75,753 905,278 2.931% 6.622% 32,971,854 0.412% 0.230% 0.012% 2.746%
36 Nigeria * 8,733 389 4.66% 16 254 5 2.01% 35 2,501 2,755 5,978 44,458 2.909% 9.220% 206,139,589 0.004% 0.003% 0.022%
37 Afghanistan * 13,036 580 4.66% 16 235 8 3.52% 21 1,209 1,444 11,592 34,903 1.803% 16.274% 38,928,346 0.033% 0.030% 0.001% 0.090%
38 Mexico * 78,023 3,463 4.64% 16 8,597 463 5.69% 13 54,383 62,980 15,043 244,858 11.019% 13.650% 128,932,753 0.061% 0.012% 0.007% 0.190%
39 India * 165,386 7,300 4.62% 16 4,711 177 3.90% 19 70,920 75,631 89,755 3,362,136 2.848% 6.229% 1,380,004,385 0.012% 0.007% 0.244%
40 DRC * 2,660 114 4.48% 16 69 1 1.47% 48 381 450 2,210 2.594% 15.333% 89,561,403 0.003% 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 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
41 Angola * 74 3 4.23% 17 4 18 22 52 10,000 5.405% 18.182% 32,866,272 0.030%
42 Azerbaijan * 4,759 191 4.18% 17 56 2 3.70% 20 3,022 3,078 1,681 284,669 1.177% 1.819% 10,139,177 0.047% 0.017% 0.001% 2.808%
43 Sri Lanka * 1,530 61 4.15% 18 10 745 755 775 59,165 0.654% 1.325% 21,413,249 0.007% 0.004% 0.276%
44 Tajikistan * 3,563 139 4.06% 18 47 1,674 1,721 1,842 1.319% 2.731% 9,537,645 0.037% 0.019%
45 El Salvador * 2,194 85 4.03% 18 39 2 5.41% 14 1,002 1,041 1,153 82,243 1.778% 3.746% 6,486,205 0.034% 0.018% 0.001% 1.268%
46 Qatar * 50,914 1,967 4.02% 18 33 3 10.00% 8 15,399 15,432 35,482 207,033 0.065% 0.214% 2,881,053 1.767% 1.232% 0.001% 7.186%
47 Maldives * 1,513 56 3.84% 19 5 197 202 1,311 11,775 0.330% 2.475% 540,544 0.280% 0.243% 0.001% 2.178%
48 Sierra Leone * 812 30 3.84% 19 45 361 406 406 5.542% 11.084% 7,976,983 0.010% 0.005% 0.001%
49 Bahrain * 10,052 360 3.71% 20 15 5,419 5,434 4,618 297,873 0.149% 0.276% 1,701,575 0.591% 0.271% 0.001% 17.506%
50 Kuwait * 24,112 845 3.63% 20 185 10 5.71% 13 8,698 8,883 15,229 282,341 0.767% 2.083% 4,270,571 0.565% 0.357% 0.004% 6.611%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
51 Gabon * 2,319 81 3.62% 20 14 631 645 1,674 12,060 0.604% 2.171% 2,225,734 0.104% 0.075% 0.001% 0.542%
52 Philippines 15,588 539 3.58% 20 921 17 1.88% 38 3,598 4,519 11,069 323,819 5.908% 20.381% 109,581,078 0.014% 0.010% 0.001% 0.296%
53 Pakistan * 61,227 2,076 3.51% 21 1,260 35 2.86% 25 20,231 21,491 39,736 508,086 2.058% 5.863% 220,892,340 0.028% 0.018% 0.001% 0.230%
54 Sao Tome... * 458 15 3.39% 21 12 68 80 378 175 2.620% 15.000% 219,159 0.209% 0.172% 0.005% 0.080%
55 Ivory Coast * 2,641 85 3.33% 22 32 1 3.23% 22 1,326 1,358 1,283 26,021 1.212% 2.356% 26,378,274 0.010% 0.005% 0.099%
56 Kazakhstan * 9,576 272 2.92% 25 37 4,900 4,937 4,639 735,273 0.386% 0.749% 18,776,707 0.051% 0.025% 3.916%
57 Senegal * 3,348 95 2.92% 25 39 1 2.63% 27 1,686 1,725 1,623 38,508 1.165% 2.261% 16,743,927 0.020% 0.010% 0.230%
58 Indonesia * 24,538 687 2.88% 25 1,496 23 1.56% 45 6,240 7,736 16,802 289,906 6.097% 19.338% 273,523,615 0.009% 0.006% 0.001% 0.106%
59 Venezuela * 1,245 34 2.81% 26 11 302 313 932 897,695 0.884% 3.514% 28,435,940 0.004% 0.003% 3.157%
60 Palestine * 446 12 2.76% 26 3 368 371 75 44,876 0.673% 0.809% 5,101,414 0.009% 0.001% 0.880%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
61 Mozambique * 233 6 2.64% 27 2 1 100.00% 1 82 84 149 9,036 0.858% 2.381% 31,255,435 0.001% 0.029%
62 Ghana * 7,303 186 2.61% 27 34 2,412 2,446 4,857 205,890 0.466% 1.390% 31,072,940 0.024% 0.016% 0.663%
63 Eswatini * 279 7 2.57% 28 2 168 170 109 4,994 0.717% 1.176% 1,160,164 0.024% 0.009% 0.430%
64 Moldova * 7,725 188 2.49% 29 282 8 2.92% 25 4,123 4,405 3,320 40,565 3.650% 6.402% 4,033,963 0.191% 0.082% 0.007% 1.006%
65 Albania * 1,076 26 2.48% 29 33 823 856 220 13,993 3.067% 3.855% 2,877,797 0.037% 0.008% 0.001% 0.486%
66 Panama * 11,728 281 2.45% 29 315 2 0.64% 109 7,379 7,694 4,034 61,895 2.686% 4.094% 4,314,767 0.272% 0.093% 0.007% 1.434%
67 Belarus * 39,858 902 2.32% 31 219 5 2.34% 31 16,660 16,879 22,979 499,249 0.549% 1.297% 9,449,323 0.422% 0.243% 0.002% 5.283%
68 Russia * 379,051 8,371 2.26% 32 4,142 174 4.39% 17 150,993 155,135 223,916 9,701,280 1.093% 2.670% 145,934,462 0.260% 0.153% 0.003% 6.648%
69 Uzbekistan * 3,444 75 2.23% 32 14 2,694 2,708 736 460,000 0.407% 0.517% 33,469,203 0.010% 0.002% 1.374%
70 Dominican... * 16,068 345 2.19% 32 485 11 2.32% 31 8,952 9,437 6,631 74,612 3.018% 5.139% 10,847,910 0.148% 0.061% 0.004% 0.688%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
71 Cayman... * 140 3 2.19% 32 1 67 68 72 10,466 0.714% 1.471% 65,722 0.213% 0.110% 0.002% 15.925%
72 Ukraine * 22,382 477 2.18% 33 669 11 1.67% 42 8,439 9,108 13,274 322,746 2.989% 7.345% 43,733,762 0.051% 0.030% 0.002% 0.738%
73 Saudi Arabia * 80,185 1,644 2.09% 34 441 16 3.76% 19 54,553 54,994 25,191 770,696 0.550% 0.802% 34,813,871 0.230% 0.072% 0.001% 2.214%
74 North... * 2,077 38 1.86% 38 121 2 1.68% 42 1,486 1,607 470 27,023 5.826% 7.530% 2,083,374 0.100% 0.023% 0.006% 1.297%
75 Sweden * 35,727 639 1.82% 39 4,266 46 1.09% 64 4,971 9,237 26,490 238,800 11.941% 46.184% 10,099,265 0.354% 0.262% 0.042% 2.365%
76 France * 186,238 3,325 1.82% 39 28,662 66 0.23% 301 67,191 95,853 90,385 1,384,633 15.390% 29.902% 65,273,511 0.285% 0.138% 0.044% 2.121%
77 Paraguay * 900 16 1.81% 39 11 402 413 487 27,425 1.222% 2.663% 7,132,538 0.013% 0.007% 0.385%
78 Uruguay * 803 14 1.77% 40 22 650 672 131 40,229 2.740% 3.274% 3,473,730 0.023% 0.004% 0.001% 1.158%
79 UAE * 32,532 563 1.76% 40 258 3 1.18% 60 16,685 16,943 15,589 2,110,493 0.793% 1.523% 9,890,402 0.329% 0.158% 0.003% 21.339%
80 Costa Rica * 1,000 16 1.63% 43 10 646 656 344 24,897 1.000% 1.524% 5,094,118 0.020% 0.007% 0.489%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
81 Tunisia * 1,068 17 1.62% 44 48 938 986 82 49,951 4.494% 4.868% 11,818,619 0.009% 0.001% 0.423%
82 Iran * 143,849 2,258 1.59% 44 7,627 63 0.83% 84 112,988 120,615 23,234 876,492 5.302% 6.323% 83,992,949 0.171% 0.028% 0.009% 1.044%
83 Algeria * 8,997 140 1.58% 45 630 7 1.12% 63 5,277 5,907 3,090 7.002% 10.665% 43,851,044 0.021% 0.007% 0.001%
84 Poland * 22,825 352 1.57% 45 1,038 10 0.97% 72 10,560 11,598 11,227 846,732 4.548% 8.950% 37,846,611 0.060% 0.030% 0.003% 2.237%
85 Chad * 726 11 1.54% 46 65 1 1.56% 45 413 478 248 8.953% 13.598% 16,425,864 0.004% 0.002%
86 Mayotte * 1,670 25 1.52% 46 21 1 5.00% 15 1,315 1,336 334 5,200 1.257% 1.572% 272,815 0.612% 0.122% 0.008% 1.906%
87 USA * 1,765,249 24,034 1.38% 51 521 103,229 1,428 1.40% 50 40 497,285 600,514 1,164,735 16,270,324 5.848% 17.190% 331,002,651 0.533% 0.352% 0.031% 4.915%
88 Canada * 88,475 994 1.14% 62 6,873 113 1.67% 42 46,777 53,650 34,825 1,559,280 7.768% 12.811% 37,742,154 0.234% 0.092% 0.018% 4.131%
89 Singapore * 33,249 373 1.13% 62 23 18,294 18,317 14,932 334,691 0.069% 0.126% 5,850,342 0.568% 0.255% 5.721%
90 Liberia * 269 3 1.13% 62 27 144 171 98 10.037% 15.789% 5,057,681 0.005% 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 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
91 Jordan * 728 8 1.11% 63 9 497 506 222 177,092 1.236% 1.779% 10,203,134 0.007% 0.002% 1.736%
92 Bosnia... * 2,462 27 1.11% 63 153 2 1.32% 53 1,781 1,934 528 62,567 6.214% 7.911% 3,280,819 0.075% 0.016% 0.005% 1.907%
93 Ré... * 465 5 1.09% 65 1 411 412 53 17,200 0.215% 0.243% 895,312 0.052% 0.006% 1.921%
94 Romania * 18,791 197 1.06% 66 1,235 8 0.65% 107 12,629 13,864 4,927 410,000 6.572% 8.908% 19,237,691 0.098% 0.026% 0.006% 2.131%
95 Portugal * 31,596 304 0.97% 72 1,369 13 0.96% 73 18,637 20,006 11,590 778,698 4.333% 6.843% 10,196,709 0.310% 0.114% 0.013% 7.637%
96 Ecuador * 38,471 368 0.97% 73 3,313 38 1.16% 61 18,425 21,738 16,733 110,812 8.612% 15.241% 17,643,054 0.218% 0.095% 0.019% 0.628%
97 Jamaica * 569 5 0.89% 79 9 279 288 281 11,259 1.582% 3.125% 2,961,167 0.019% 0.009% 0.380%
98 Rwanda * 349 3 0.87% 81 245 245 104 64,268 12,952,218 0.003% 0.001% 0.496%
99 Syria * 122 1 0.83% 85 4 43 47 75 3.279% 8.511% 17,500,658 0.001%
100 Finland * 6,743 51 0.76% 92 313 5,500 5,813 930 176,650 4.642% 5.384% 5,540,720 0.122% 0.017% 0.006% 3.188%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
101 Turkey * 160,979 1,182 0.74% 95 4,461 30 0.68% 103 124,369 128,830 32,149 1,928,209 2.771% 3.463% 84,339,067 0.191% 0.038% 0.005% 2.286%
102 Czechia * 9,134 65 0.72% 98 318 1 0.32% 221 6,457 6,775 2,359 424,423 3.481% 4.694% 10,708,981 0.085% 0.022% 0.003% 3.963%
103 UK * 269,127 1,887 0.71% 99 37,837 377 1.01% 70 37,837 231,290 3,918,079 14.059% 100.000% 67,886,011 0.396% 0.341% 0.056% 5.772%
104 S. Korea * 11,344 79 0.70% 100 269 10,340 10,609 735 868,666 2.371% 2.536% 51,269,185 0.022% 0.001% 0.001% 1.694%
105 Bulgaria * 2,477 17 0.69% 101 134 1 0.75% 93 965 1,099 1,378 77,664 5.410% 12.193% 6,948,445 0.036% 0.020% 0.002% 1.118%
106 Malta * 616 4 0.65% 107 7 501 508 108 65,471 1.136% 1.378% 441,543 0.140% 0.024% 0.002% 14.828%
107 Gibraltar * 158 1 0.64% 110 147 147 11 7,073 33,691 0.469% 0.033% 20.994%
108 Hungary * 3,816 23 0.61% 115 509 4 0.79% 88 1,996 2,505 1,311 174,011 13.339% 20.319% 9,660,351 0.040% 0.014% 0.005% 1.801%
109 Lebanon * 1,168 7 0.60% 116 26 699 725 443 78,947 2.226% 3.586% 6,825,445 0.017% 0.006% 1.157%
110 Estonia * 1,851 11 0.60% 117 66 1,574 1,640 211 80,724 3.566% 4.024% 1,326,535 0.140% 0.016% 0.005% 6.085%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
111 Morocco * 7,643 42 0.55% 126 202 5,195 5,397 2,246 180,189 2.643% 3.743% 36,910,560 0.021% 0.006% 0.001% 0.488%
112 Lithuania * 1,656 9 0.55% 128 68 2 3.03% 24 1,193 1,261 395 287,982 4.106% 5.393% 2,722,289 0.061% 0.015% 0.002% 10.579%
113 Israel 16,872 79 0.47% 148 284 3 1.07% 66 14,679 14,963 1,909 558,516 1.683% 1.898% 8,655,535 0.195% 0.022% 0.003% 6.453%
114 Cuba * 1,983 9 0.46% 153 82 1,734 1,816 167 99,745 4.135% 4.515% 11,326,616 0.018% 0.001% 0.001% 0.881%
115 San Marino * 670 3 0.45% 155 42 322 364 306 4,303 6.269% 11.538% 33,931 1.975% 0.902% 0.124% 12.682%
116 Belgium * 57,849 257 0.45% 156 9,388 24 0.26% 271 15,572 24,960 32,889 818,807 16.228% 37.612% 11,589,623 0.499% 0.284% 0.081% 7.065%
117 Georgia * 738 3 0.41% 171 12 573 585 153 52,117 1.626% 2.051% 3,989,167 0.019% 0.004% 1.306%
118 Spain * 284,986 1,137 0.40% 174 27,119 1 18,798 196,958 224,077 60,909 3,556,567 9.516% 12.103% 46,754,778 0.610% 0.130% 0.058% 7.607%
119 Netherlands * 45,950 182 0.40% 175 5,903 32 0.55% 128 5,903 40,047 342,681 12.847% 100.000% 17,134,872 0.268% 0.234% 0.034% 2.000%
120 Latvia * 1,061 4 0.38% 184 24 1 4.35% 17 741 765 296 105,504 2.262% 3.137% 1,886,198 0.056% 0.016% 0.001% 5.593%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
121 Thailand * 3,065 11 0.36% 193 57 2,945 3,002 63 375,453 1.860% 1.899% 69,799,978 0.004% 0.538%
122 Slovakia * 1,520 5 0.33% 211 28 1,332 1,360 160 165,714 1.842% 2.059% 5,459,642 0.028% 0.003% 0.001% 3.035%
123 Niger * 955 3 0.32% 221 64 1 1.59% 45 803 867 88 6,020 6.702% 7.382% 24,206,644 0.004% 0.025%
124 Germany * 182,452 557 0.31% 227 8,570 37 0.43% 161 163,200 171,770 10,682 3,952,971 4.697% 4.989% 83,783,942 0.218% 0.013% 0.010% 4.718%
125 Denmark * 11,512 32 0.28% 250 568 3 0.53% 131 10,180 10,748 764 583,052 4.934% 5.285% 5,792,202 0.199% 0.013% 0.010% 10.066%
126 Italy * 231,732 593 0.26% 271 33,142 70 0.21% 328 150,604 183,746 47,986 3,683,144 14.302% 18.037% 60,461,826 0.383% 0.079% 0.055% 6.092%
127 Burkina Faso * 847 2 0.24% 294 53 719 772 75 6.257% 6.865% 20,903,273 0.004%
128 Austria * 16,628 37 0.22% 312 668 23 3.57% 20 15,286 15,954 674 427,372 4.017% 4.187% 9,006,398 0.185% 0.007% 0.007% 4.745%
129 Serbia * 11,300 25 0.22% 313 241 1 0.42% 167 6,438 6,679 4,621 234,019 2.133% 3.608% 8,737,371 0.129% 0.053% 0.003% 2.678%
130 Cyprus * 941 2 0.21% 326 17 784 801 140 111,270 1.807% 2.122% 1,207,359 0.078% 0.012% 0.001% 9.216%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
131 Norway * 8,406 15 0.18% 389 236 1 0.43% 164 7,727 7,963 443 239,864 2.808% 2.964% 5,421,241 0.155% 0.008% 0.004% 4.425%
132 Luxembourg * 4,008 7 0.17% 397 110 3,803 3,913 95 71,098 2.745% 2.811% 625,978 0.640% 0.015% 0.018% 11.358%
133 Japan * 16,651 28 0.17% 412 858 12 1.42% 50 13,973 14,831 1,820 278,642 5.153% 5.785% 126,476,461 0.013% 0.001% 0.001% 0.220%
134 Australia * 7,150 11 0.15% 451 103 6,580 6,683 467 1,367,444 1.441% 1.541% 25,499,884 0.028% 0.002% 5.363%
135 Ireland * 24,841 38 0.15% 453 1,639 8 0.49% 142 22,089 23,728 1,113 325,795 6.598% 6.907% 4,937,786 0.503% 0.023% 0.033% 6.598%
136 Slovenia * 1,473 2 0.14% 511 108 1,356 1,464 9 78,578 7.332% 7.377% 2,078,938 0.071% 0.005% 3.780%
137 Malaysia * 7,629 10 0.13% 529 115 6,169 6,284 1,345 519,944 1.507% 1.830% 32,365,999 0.024% 0.004% 1.606%
138 Greece * 2,906 3 0.10% 672 175 2 1.16% 61 1,374 1,549 1,357 170,467 6.022% 11.298% 10,423,054 0.028% 0.013% 0.002% 1.635%
139 Switzerland * 30,796 20 0.06% 1,067 1,919 2 0.10% 665 28,300 30,219 577 385,822 6.231% 6.350% 8,654,622 0.356% 0.007% 0.022% 4.458%
140 Croatia * 2,245 1 0.04% 1,556 102 1 0.99% 71 2,051 2,153 92 65,094 4.543% 4.738% 4,105,267 0.055% 0.002% 0.002% 1.586%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
141 China * 82,995 2 28,764 4,634 78,288 82,922 73 5.583% 5.588% 1,439,323,776 0.006%
142 Turks and... * 12 1 10 11 1 129 8.333% 9.091% 38,717 0.031% 0.003% 0.003% 0.333%
143 Trinidad... * 116 8 108 116 3,091 6.897% 6.897% 1,399,488 0.008% 0.001% 0.221%
144 Saint... * 15 15 15 394 53,199 0.028% 0.741%
145 Zimbabwe * 132 4 25 29 103 37,039 3.030% 13.793% 14,862,924 0.001% 0.001% 0.249%
146 Zambia * 1,057 7 779 786 271 24,275 0.662% 0.891% 18,383,955 0.006% 0.001% 0.132%
147 Uganda * 281 69 69 212 90,832 45,741,007 0.001% 0.199%
148 Timor-Leste * 24 24 24 1,290 1,318,445 0.002% 0.098%
149 Vatican City * 12 2 2 10 825 1.455% 1.212%
150 Western... * 9 1 6 7 2 11.111% 14.286% 597,339 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 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
151 Vietnam * 327 278 278 49 275,000 97,338,579 0.283%
152 Saint Lucia * 18 18 18 965 183,627 0.010% 0.526%
153 South Sudan * 994 10 6 16 978 3,356 1.006% 62.500% 11,193,725 0.009% 0.009% 0.030%
154 South Africa * 25,937 552 13,451 14,003 11,934 634,996 2.128% 3.942% 59,308,690 0.044% 0.020% 0.001% 1.071%
155 Anguilla * 3 3 3 30 15,003 0.020% 0.200%
156 Sint Maarten * 77 15 60 75 2 438 19.481% 20.000% 42,876 0.180% 0.005% 0.035% 1.022%
157 Saint... * 1 1 1 5,794 0.017%
158 Saint Martin * 40 3 33 36 4 553 7.500% 8.333% 38,666 0.103% 0.010% 0.008% 1.430%
159 Seychelles * 11 11 11 98,347 0.011%
160 Taiwan * 441 7 420 427 14 71,581 1.587% 1.639% 23,816,775 0.002% 0.301%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
161 Andorra * 763 51 681 732 31 3,750 6.684% 6.967% 77,265 0.988% 0.040% 0.066% 4.853%
162 St. Barth * 6 6 6 137 9,877 0.061% 1.387%
163 Tanzania * 509 21 183 204 305 4.126% 10.294% 59,734,218 0.001% 0.001%
164 Bahamas * 100 11 46 57 43 2,043 11.000% 19.298% 393,244 0.025% 0.011% 0.003% 0.520%
165 Falkland... * 13 13 13 503 3,480 0.374% 14.454%
166 Fiji * 18 15 15 3 2,431 896,445 0.002% 0.271%
167 Faeroe... * 187 187 187 9,386 48,863 0.383% 19.209%
168 British... * 8 1 7 8 167 12.500% 12.500% 30,231 0.026% 0.003% 0.552%
169 Eritrea * 39 39 39 3,546,421 0.001%
170 Botswana * 35 1 20 21 14 17,991 2.857% 4.762% 2,351,627 0.001% 0.001% 0.765%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
171 French... * 60 60 60 4,006 280,908 0.021% 1.426%
172 Guadeloupe * 161 14 115 129 32 3,573 8.696% 10.853% 400,124 0.040% 0.008% 0.003% 0.893%
173 Grenada * 23 18 18 5 3,007 112,523 0.020% 0.004% 2.672%
174 Greenland * 13 11 11 2 2,030 56,770 0.023% 0.004% 3.576%
175 Gambia * 25 1 19 20 5 1,730 4.000% 5.000% 2,416,668 0.001% 0.072%
176 Equatoria... * 1,043 12 165 177 866 854 1.151% 6.780% 1,402,985 0.074% 0.062% 0.001% 0.061%
177 Brunei * 141 2 138 140 1 18,707 1.418% 1.429% 437,479 0.032% 4.276%
178 CAR * 702 1 23 24 678 11,570 0.142% 4.167% 4,829,767 0.015% 0.014% 0.240%
179 Caribbean... * 6 6 6 424 26,223 0.023% 1.617%
180 Cameroon * 5,436 175 1,996 2,171 3,265 3.219% 8.061% 26,545,863 0.020% 0.012% 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 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
181 Cambodia * 124 122 122 2 18,392 16,718,965 0.001% 0.110%
182 Cabo Verde * 390 4 155 159 231 1,307 1.026% 2.516% 555,987 0.070% 0.042% 0.001% 0.235%
183 Channel... * 560 45 512 557 3 10,255 8.036% 8.079% 173,863 0.322% 0.002% 0.026% 5.898%
184 Comoros * 87 2 24 26 61 2.299% 7.692% 869,601 0.010% 0.007%
185 Dominica * 16 16 16 433 71,986 0.022% 0.602%
186 Diamond... * 712 13 651 664 48 1.826% 1.958% 3,711 19.186% 1.293% 0.350%
187 Cura&cced... * 18 1 14 15 3 572 5.556% 6.667% 164,093 0.011% 0.002% 0.001% 0.349%
188 Congo * 571 19 161 180 391 3.327% 10.556% 5,518,087 0.010% 0.007%
189 Guinea-Bi... * 1,195 8 1 14.29% 6 42 50 1,145 1,500 0.669% 16.000% 1,968,001 0.061% 0.058% 0.076%
190 Guyana * 139 11 67 78 61 1,500 7.914% 14.103% 786,552 0.018% 0.008% 0.001% 0.191%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
191 Montserrat * 11 1 10 11 36 9.091% 9.091% 4,992 0.220% 0.020% 0.721%
192 MS Zaandam * 9 2 2 7 22.222% 100.000% 1,243 0.724% 0.563% 0.161%
193 Montenegro * 324 9 315 324 10,167 2.778% 2.778% 628,066 0.052% 0.001% 1.619%
194 Monaco * 98 4 90 94 4 4.082% 4.255% 39,242 0.250% 0.010% 0.010%
195 Mauritius * 334 10 322 332 2 111,358 2.994% 3.012% 1,271,768 0.026% 0.001% 8.756%
196 Myanmar * 206 6 126 132 74 21,593 2.913% 4.545% 54,409,800 0.040%
197 Namibia * 22 14 14 8 3,370 2,540,905 0.001% 0.133%
198 Antigua... * 25 3 19 22 3 183 12.000% 13.636% 97,929 0.026% 0.003% 0.003% 0.187%
199 Nicaragua * 759 35 370 405 354 4.611% 8.642% 6,624,554 0.011% 0.005% 0.001%
200 New Zealand * 1,504 22 1 4.76% 15 1,474 1,496 8 271,690 1.463% 1.471% 4,822,233 0.031% 5.634%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
201 Aruba * 101 3 97 100 1 2,105 2.970% 3.000% 106,766 0.095% 0.001% 0.003% 1.972%
202 Martinique * 197 14 91 105 92 7.107% 13.333% 375,265 0.052% 0.025% 0.004%
203 Burundi * 42 1 20 21 21 284 2.381% 4.762% 11,890,784 0.002%
204 Iceland * 1,805 10 1,792 1,802 3 60,141 0.554% 0.555% 341,243 0.529% 0.001% 0.003% 17.624%
205 Belize * 18 2 16 18 1,517 11.111% 11.111% 397,628 0.005% 0.001% 0.382%
206 Hong Kong * 1,067 4 1,035 1,039 28 202,930 0.375% 0.385% 7,496,981 0.014% 2.707%
207 Benin * 210 3 134 137 73 28,179 1.429% 2.190% 12,123,200 0.002% 0.001% 0.232%
208 Bermuda * 139 9 91 100 39 6,826 6.475% 9.000% 62,278 0.223% 0.063% 0.014% 10.961%
209 Isle of Man * 336 24 306 330 6 4,732 7.143% 7.273% 85,033 0.395% 0.007% 0.028% 5.565%
210 Laos * 19 16 16 3 6,066 7,275,560 0.083%
# Legend cases yesterday growth dt today deaths yesterday growth ddt today recovered closed active tests death% Cdeath% population casesRate activeRate Pdeath% testRate
* World 5,867,839 111,917 1.94% 36 521 360,438 4,723 1.33% 53 40 2,569,202 2,929,640 2,938,199 78,365,358 6.143% 12.303% 7,800,000,000 0.075% 0.038% 0.005% 1.005%
211 Barbados * 92 7 76 83 9 5,201 7.609% 8.434% 287,375 0.032% 0.003% 0.002% 1.810%
212 Macao * 45 45 45 649,335 0.007%
213 Liechtens... * 82 1 55 56 26 900 1.220% 1.786% 38,128 0.215% 0.068% 0.003% 2.360%
214 Lesotho * 2 1 1 1 283 2,142,249 0.013%
215 Papua New... * 8 8 8 2,402 8,947,024 0.027%
Running Time: 42.317 milliseconds, this hour: 13.


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