covid19 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/VERSION.txt +1 -1
- data/exe/covid19 +26 -3
- data/lib/covid19/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '07796add8d36511f373a1ed6268fa95cc164577d9fb19726e592f6f4b33ecb2c'
|
4
|
+
data.tar.gz: eee233d00944280fd37ae88c06f78f7be419225e102d135107ad9ecae4aee355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e9f6750488e1a05e7c9ff620497c7c7e4376412c6da31acf6d6afce8d559b0b0de032eeae6d1f1b72e156a7de57581186e42fa1b769c0b0acd4e0eba78e5802
|
7
|
+
data.tar.gz: 5c0408ad61b9c7bf48c664aa301be11c7bd998be2ea82ba303371cb8ef09325e672b73b866144ef1d00147d4e1ea167c168a169dc1a87335785884b74cede305
|
data/CHANGELOG.md
CHANGED
@@ -5,9 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
|
6
6
|
This changelog was automatically generated using [Caretaker](https://github.com/WolfAtheneum/covid19) by [Wolf Software](https://github.com/WolfSoftware)
|
7
7
|
|
8
|
-
### [
|
8
|
+
### [v0.1.2](https://github.com/WolfAtheneum/covid19/compare/v0.1.0...v0.1.2)
|
9
9
|
|
10
|
-
|
10
|
+
> Released on March, 23rd 2020
|
11
|
+
|
12
|
+
- Add the new code to the binary as it was only added to the testing binary [`[e99c9ec]`](https://github.com/WolfAtheneum/covid19/commit/e99c9ec9a37d38b05ec1b632f0cb07e68788a19a) [`[TGWolf]`](https://github.com/TGWolf)
|
13
|
+
|
14
|
+
- Add a death rate as a percentage of confirmed cases [`[348efbf]`](https://github.com/WolfAtheneum/covid19/commit/348efbf2c1ca5bdffbd369595c670acc7cadeaf8) [`[TGWolf]`](https://github.com/TGWolf)
|
11
15
|
|
12
16
|
### [v0.1.0](https://github.com/WolfAtheneum/covid19/releases/v0.1.0)
|
13
17
|
|
data/VERSION.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/exe/covid19
CHANGED
@@ -17,6 +17,14 @@ def format_latest_stats(results)
|
|
17
17
|
results['latest'].each do |key, value|
|
18
18
|
formatted << [key, value]
|
19
19
|
end
|
20
|
+
|
21
|
+
confirmed = results['latest']['confirmed']
|
22
|
+
deaths = results['latest']['deaths']
|
23
|
+
|
24
|
+
percentage = ((deaths.to_f / confirmed) * 100).round(2).to_s + ' %'
|
25
|
+
|
26
|
+
formatted << ['death rate', percentage]
|
27
|
+
|
20
28
|
puts Terminal::Table.new :title => 'Latest Global Statistics', :rows => formatted, :style => { :width => 80 }
|
21
29
|
end
|
22
30
|
|
@@ -40,7 +48,11 @@ def format_latest_country_stats(results, options = {})
|
|
40
48
|
deaths = item['latest']['deaths']
|
41
49
|
recovered = item['latest']['recovered']
|
42
50
|
end
|
43
|
-
|
51
|
+
percentage = ((deaths.to_f / confirmed) * 100).round(2)
|
52
|
+
|
53
|
+
percentage = 0 if percentage.nil?
|
54
|
+
|
55
|
+
processed[country_code] = { 'country' => item['country'], 'country_code' => country_code, 'id' => item['id'], 'confirmed' => confirmed, 'deaths' => deaths, 'recovered' => recovered, 'death_rate' => percentage }
|
44
56
|
end
|
45
57
|
|
46
58
|
sorted = []
|
@@ -52,13 +64,14 @@ def format_latest_country_stats(results, options = {})
|
|
52
64
|
sorted = sorted.sort_by { |k| k['confirmed'] }.reverse if options[:confirmed]
|
53
65
|
sorted = sorted.sort_by { |k| k['deaths'] }.reverse if options[:deaths]
|
54
66
|
sorted = sorted.sort_by { |k| k['recovered'] }.reverse if options[:recovered]
|
67
|
+
sorted = sorted.sort_by { |k| k['death_rate'] }.reverse if options[:percentage]
|
55
68
|
|
56
69
|
formatted = []
|
57
70
|
sorted.each do |item|
|
58
|
-
formatted << [item['country'], item['country_code'], item['id'], item['confirmed'], item['deaths'], item['recovered']]
|
71
|
+
formatted << [item['country'], item['country_code'], item['id'], item['confirmed'], item['deaths'], item['recovered'], item['death_rate'].to_s + ' %']
|
59
72
|
end
|
60
73
|
|
61
|
-
table = Terminal::Table.new :title => 'Latest Statistics by Country', :headings => ['Country', 'Code', 'ID', 'Confirmed', 'Deaths', 'Recovered'], :rows => formatted, :style => { :padding_left => 2, :padding_right => 2 }
|
74
|
+
table = Terminal::Table.new :title => 'Latest Statistics by Country', :headings => ['Country', 'Code', 'ID', 'Confirmed', 'Deaths', 'Recovered', 'Death Rate'], :rows => formatted, :style => { :padding_left => 2, :padding_right => 2 }
|
62
75
|
table.align_column(1, :center)
|
63
76
|
table.align_column(2, :right)
|
64
77
|
table.align_column(3, :right)
|
@@ -114,18 +127,28 @@ def process_arguments
|
|
114
127
|
opts.on('-c', '--confirmed', 'Order results by confirmed cases') do
|
115
128
|
options[:confirmed] = true
|
116
129
|
options[:deaths] = false
|
130
|
+
options[:percentage] = false
|
117
131
|
options[:recovered] = false
|
118
132
|
end
|
119
133
|
|
120
134
|
opts.on('-d', '--deaths', 'Order results by deaths') do
|
121
135
|
options[:confirmed] = false
|
122
136
|
options[:deaths] = true
|
137
|
+
options[:percentage] = false
|
138
|
+
options[:recovered] = false
|
139
|
+
end
|
140
|
+
|
141
|
+
opts.on('-p', '--death-rate', 'Order results by percentage of deaths (death rate)') do
|
142
|
+
options[:confirmed] = false
|
143
|
+
options[:deaths] = false
|
144
|
+
options[:percentage] = true
|
123
145
|
options[:recovered] = false
|
124
146
|
end
|
125
147
|
|
126
148
|
opts.on('-r', '--recovered', 'Order results by recovered numbers') do
|
127
149
|
options[:confirmed] = false
|
128
150
|
options[:deaths] = false
|
151
|
+
options[:percentage] = false
|
129
152
|
options[:recovered] = true
|
130
153
|
end
|
131
154
|
end
|
data/lib/covid19/version.rb
CHANGED