kovid 0.6.15 โ 0.7.0
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/Gemfile.lock +8 -25
- data/README.md +0 -10
- data/kovid.gemspec +0 -20
- data/lib/kovid/constants.rb +58 -0
- data/lib/kovid/helpers.rb +1 -3
- data/lib/kovid/historians.rb +2 -2
- data/lib/kovid/request.rb +4 -4
- data/lib/kovid/version.rb +1 -1
- metadata +6 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: acb8468524e33ff58574c2910dd1af5682b2e6bdd8d0fe61c4d497156fe4ff17
|
|
4
|
+
data.tar.gz: 58f2430edf6b6cc104c815761205fa2b0532e7fe133af7fe114b6d7608651b69
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d91ac4ad0e990714c8fdd5ac8ced650abdb6c22525c8a61a9b8b089d027c7991cf4629dc03aff77f934d412db561065ed8cdc2dff4b7b86b9b07b38e523e7c11
|
|
7
|
+
data.tar.gz: b60f261d152aa46784ee6eacafacd59aeae8906637ccf76721e166e49632680c23aed6d61642487037295f49ea02adb4c8189aa08bf7b919b277caec35016d55
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
kovid (0.
|
|
5
|
-
carmen (~> 1.1.3)
|
|
4
|
+
kovid (0.7.0)
|
|
6
5
|
rainbow (~> 3.0)
|
|
7
6
|
terminal-table (~> 1.8)
|
|
8
7
|
thor (~> 1.0)
|
|
@@ -11,24 +10,12 @@ PATH
|
|
|
11
10
|
GEM
|
|
12
11
|
remote: https://rubygems.org/
|
|
13
12
|
specs:
|
|
14
|
-
activesupport (6.0.3.1)
|
|
15
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
16
|
-
i18n (>= 0.7, < 2)
|
|
17
|
-
minitest (~> 5.1)
|
|
18
|
-
tzinfo (~> 1.1)
|
|
19
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
|
20
|
-
carmen (1.1.3)
|
|
21
|
-
activesupport (>= 3.0.0)
|
|
22
|
-
concurrent-ruby (1.1.6)
|
|
23
13
|
diff-lcs (1.3)
|
|
24
14
|
docile (1.3.2)
|
|
25
|
-
ethon (0.
|
|
26
|
-
ffi (>= 1.
|
|
27
|
-
ffi (1.
|
|
28
|
-
|
|
29
|
-
concurrent-ruby (~> 1.0)
|
|
30
|
-
minitest (5.14.1)
|
|
31
|
-
rainbow (3.0.0)
|
|
15
|
+
ethon (0.15.0)
|
|
16
|
+
ffi (>= 1.15.0)
|
|
17
|
+
ffi (1.15.5)
|
|
18
|
+
rainbow (3.1.1)
|
|
32
19
|
rake (12.3.3)
|
|
33
20
|
rspec (3.9.0)
|
|
34
21
|
rspec-core (~> 3.9.0)
|
|
@@ -49,14 +36,10 @@ GEM
|
|
|
49
36
|
simplecov-html (0.12.2)
|
|
50
37
|
terminal-table (1.8.0)
|
|
51
38
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
52
|
-
thor (1.
|
|
53
|
-
thread_safe (0.3.6)
|
|
39
|
+
thor (1.2.1)
|
|
54
40
|
typhoeus (1.4.0)
|
|
55
41
|
ethon (>= 0.9.0)
|
|
56
|
-
|
|
57
|
-
thread_safe (~> 0.1)
|
|
58
|
-
unicode-display_width (1.7.0)
|
|
59
|
-
zeitwerk (2.3.0)
|
|
42
|
+
unicode-display_width (1.8.0)
|
|
60
43
|
|
|
61
44
|
PLATFORMS
|
|
62
45
|
ruby
|
|
@@ -68,4 +51,4 @@ DEPENDENCIES
|
|
|
68
51
|
simplecov (~> 0.18)
|
|
69
52
|
|
|
70
53
|
BUNDLED WITH
|
|
71
|
-
2.
|
|
54
|
+
2.3.9
|
data/README.md
CHANGED
|
@@ -85,10 +85,6 @@ ___
|
|
|
85
85
|
|
|
86
86
|
**NOTE:** If you find it irritating to have to type `kovid state STATE`, `covid state STATE` works as well.
|
|
87
87
|
|
|
88
|
-
#### Histogram (Experimental) ๐งช
|
|
89
|
-
|
|
90
|
-
`kovid histogram COUNTRY M.YY` (draws a histogram of cases in the given month `M` and years `YY`)
|
|
91
|
-
(If the histogram appears messy, you might want to resize your window.)
|
|
92
88
|
|
|
93
89
|
#### Commands Details
|
|
94
90
|
To fetch basic data on a country run:
|
|
@@ -171,12 +167,6 @@ To fetch more number of countries or US states you can pass N. eg:
|
|
|
171
167
|
|
|
172
168
|

|
|
173
169
|
|
|
174
|
-
## ๐ฉ๐พโ๐ฌ Experimental Feature
|
|
175
|
-
|
|
176
|
-
`kovid histogram italy 3.20` tries to build a histogram on number of cases. In the example here `3.20` is date in the format of `M.YY`. If you can please play with it and report issues on how this could be improved.
|
|
177
|
-
|
|
178
|
-

|
|
179
|
-
|
|
180
170
|
|
|
181
171
|
## Data Source
|
|
182
172
|
> [JHU CSSE GISand Data](https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6) and https://www.worldometers.info/coronavirus/ via [NovelCOVID/API](https://github.com/novelcovid/api)
|
data/kovid.gemspec
CHANGED
|
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.metadata['source_code_uri'] = 'https://github.com/siaw23/kovid'
|
|
23
23
|
spec.metadata['changelog_uri'] = 'https://github.com/siaw23/kovid'
|
|
24
24
|
|
|
25
|
-
spec.add_dependency 'carmen', '~> 1.1.3'
|
|
26
25
|
spec.add_dependency 'rainbow', '~> 3.0'
|
|
27
26
|
spec.add_dependency 'terminal-table', '~> 1.8'
|
|
28
27
|
spec.add_dependency 'thor', '~> 1.0'
|
|
@@ -40,23 +39,4 @@ Gem::Specification.new do |spec|
|
|
|
40
39
|
spec.bindir = 'exe'
|
|
41
40
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
42
41
|
spec.require_paths = ['lib']
|
|
43
|
-
|
|
44
|
-
spec.post_install_message = "
|
|
45
|
-
============================================================================
|
|
46
|
-
COVID-19 has devasted the world. While we're fighting
|
|
47
|
-
with the novel coronavirus, I think stats on the issue should be
|
|
48
|
-
accessible.
|
|
49
|
-
|
|
50
|
-
There isn't much we can do now besides following procedures and hoping
|
|
51
|
-
for the best.
|
|
52
|
-
|
|
53
|
-
Stay safe!
|
|
54
|
-
Emmanuel Hayford.
|
|
55
|
-
https://emmanuelhayford.com
|
|
56
|
-
|
|
57
|
-
PS: I'm in search of a Rails/Ruby job.
|
|
58
|
-
|
|
59
|
-
You can hire me (siawmensah@gmail.com).
|
|
60
|
-
============================================================================
|
|
61
|
-
"
|
|
62
42
|
end
|
data/lib/kovid/constants.rb
CHANGED
|
@@ -127,5 +127,63 @@ module Kovid
|
|
|
127
127
|
compare_us_states: [1, 2, 3, 4, 5],
|
|
128
128
|
compare_provinces: [1, 2, 3]
|
|
129
129
|
}.freeze
|
|
130
|
+
|
|
131
|
+
USA_ABBREVIATIONS = {
|
|
132
|
+
"al" => "Alabama",
|
|
133
|
+
"ak" => "Alaska",
|
|
134
|
+
"az" => "Arizona",
|
|
135
|
+
"ar" => "Arkansas",
|
|
136
|
+
"ca" => "California",
|
|
137
|
+
"cz" => "Canal Zone",
|
|
138
|
+
"co" => "Colorado",
|
|
139
|
+
"ct" => "Connecticut",
|
|
140
|
+
"de" => "Delaware",
|
|
141
|
+
"dc" => "District of Columbia",
|
|
142
|
+
"fl" => "Florida",
|
|
143
|
+
"ga" => "Georgia",
|
|
144
|
+
"gu" => "Guam",
|
|
145
|
+
"hi" => "Hawaii",
|
|
146
|
+
"id" => "Idaho",
|
|
147
|
+
"il" => "Illinois",
|
|
148
|
+
"in" => "Indiana",
|
|
149
|
+
"ia" => "Iowa",
|
|
150
|
+
"ks" => "Kansas",
|
|
151
|
+
"ky" => "Kentucky",
|
|
152
|
+
"la" => "Louisiana",
|
|
153
|
+
"me" => "Maine",
|
|
154
|
+
"md" => "Maryland",
|
|
155
|
+
"ma" => "Massachusetts",
|
|
156
|
+
"mi" => "Michigan",
|
|
157
|
+
"mn" => "Minnesota",
|
|
158
|
+
"ms" => "Mississippi",
|
|
159
|
+
"mo" => "Missouri",
|
|
160
|
+
"mt" => "Montana",
|
|
161
|
+
"ne" => "Nebraska",
|
|
162
|
+
"nv" => "Nevada",
|
|
163
|
+
"nh" => "New Hampshire",
|
|
164
|
+
"nj" => "New Jersey",
|
|
165
|
+
"nm" => "New Mexico",
|
|
166
|
+
"ny" => "New York",
|
|
167
|
+
"nc" => "North Carolina",
|
|
168
|
+
"nd" => "North Dakota",
|
|
169
|
+
"oh" => "Ohio",
|
|
170
|
+
"ok" => "Oklahoma",
|
|
171
|
+
"or" => "Oregon",
|
|
172
|
+
"pa" => "Pennsylvania",
|
|
173
|
+
"pr" => "Puerto Rico",
|
|
174
|
+
"ri" => "Rhode Island",
|
|
175
|
+
"sc" => "South Carolina",
|
|
176
|
+
"sd" => "South Dakota",
|
|
177
|
+
"tn" => "Tennessee",
|
|
178
|
+
"tx" => "Texas",
|
|
179
|
+
"ut" => "Utah",
|
|
180
|
+
"vt" => "Vermont",
|
|
181
|
+
"vi" => "Virgin Islands",
|
|
182
|
+
"va" => "Virginia",
|
|
183
|
+
"wa" => "Washington",
|
|
184
|
+
"wv" => "West Virginia",
|
|
185
|
+
"wi" => "Wisconsin",
|
|
186
|
+
"wy" => "Wyoming"
|
|
187
|
+
}
|
|
130
188
|
end
|
|
131
189
|
end
|
data/lib/kovid/helpers.rb
CHANGED
|
@@ -26,8 +26,6 @@ module Kovid
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def lookup_us_state(state)
|
|
29
|
-
|
|
30
|
-
lookup = us.subregions.coded(state) || us.subregions.named(state)
|
|
31
|
-
lookup ? lookup.name : state
|
|
29
|
+
Kovid::Constants::USA_ABBREVIATIONS.fetch(state.downcase, state)
|
|
32
30
|
end
|
|
33
31
|
end
|
data/lib/kovid/historians.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Kovid
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
Terminal::Table.new(
|
|
17
|
-
title: data['country']
|
|
17
|
+
title: data['country']&.upcase,
|
|
18
18
|
headings: DATE_CASES_DEATHS_RECOVERED,
|
|
19
19
|
rows: rows
|
|
20
20
|
)
|
|
@@ -29,7 +29,7 @@ module Kovid
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
Terminal::Table.new(
|
|
32
|
-
title: data['state']
|
|
32
|
+
title: data['state']&.upcase,
|
|
33
33
|
headings: DATE_CASES_DEATHS,
|
|
34
34
|
rows: rows
|
|
35
35
|
)
|
data/lib/kovid/request.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
|
-
require '
|
|
4
|
+
require 'erb'
|
|
5
5
|
require_relative 'tablelize'
|
|
6
6
|
require_relative 'cache'
|
|
7
7
|
require_relative 'uri_builder'
|
|
@@ -266,7 +266,7 @@ module Kovid
|
|
|
266
266
|
def fetch_country(country_name)
|
|
267
267
|
# TODO: Match ISOs to full country names
|
|
268
268
|
country_name = 'nl' if country_name == 'netherlands'
|
|
269
|
-
country_url = COUNTRIES_PATH + "/#{country_name}"
|
|
269
|
+
country_url = COUNTRIES_PATH + "/#{ERB::Util.url_encode(country_name)}"
|
|
270
270
|
|
|
271
271
|
JSON.parse(Typhoeus.get(country_url, cache_ttl: 900).response_body)
|
|
272
272
|
end
|
|
@@ -301,7 +301,7 @@ module Kovid
|
|
|
301
301
|
def fetch_history(country)
|
|
302
302
|
JSON.parse(
|
|
303
303
|
Typhoeus.get(
|
|
304
|
-
HISTORICAL_URL + "/#{country}", cache_ttl: 900
|
|
304
|
+
HISTORICAL_URL + "/#{ERB::Util.url_encode(country)}", cache_ttl: 900
|
|
305
305
|
).response_body
|
|
306
306
|
)
|
|
307
307
|
end
|
|
@@ -309,7 +309,7 @@ module Kovid
|
|
|
309
309
|
def fetch_us_history(state)
|
|
310
310
|
JSON.parse(
|
|
311
311
|
Typhoeus.get(
|
|
312
|
-
HISTORICAL_US_URL + "/#{state}", cache_ttl: 900
|
|
312
|
+
HISTORICAL_US_URL + "/#{ERB::Util.url_encode(state)}", cache_ttl: 900
|
|
313
313
|
).response_body
|
|
314
314
|
)
|
|
315
315
|
end
|
data/lib/kovid/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kovid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Emmanuel Hayford
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-03-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: carmen
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.1.3
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.1.3
|
|
27
13
|
- !ruby/object:Gem::Dependency
|
|
28
14
|
name: rainbow
|
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -140,14 +126,7 @@ metadata:
|
|
|
140
126
|
homepage_uri: https://github.com/siaw23/kovid
|
|
141
127
|
source_code_uri: https://github.com/siaw23/kovid
|
|
142
128
|
changelog_uri: https://github.com/siaw23/kovid
|
|
143
|
-
post_install_message:
|
|
144
|
-
\ COVID-19 has devasted the world. While we're fighting\n with the novel
|
|
145
|
-
coronavirus, I think stats on the issue should be\n accessible.\n\n There
|
|
146
|
-
isn't much we can do now besides following procedures and hoping\n for the
|
|
147
|
-
best.\n\n Stay safe!\n Emmanuel Hayford.\n https://emmanuelhayford.com\n\n
|
|
148
|
-
\ PS: I'm in search of a Rails/Ruby job.\n\n You can hire me (siawmensah@gmail.com).\n
|
|
149
|
-
\ ============================================================================\n
|
|
150
|
-
\ "
|
|
129
|
+
post_install_message:
|
|
151
130
|
rdoc_options: []
|
|
152
131
|
require_paths:
|
|
153
132
|
- lib
|
|
@@ -162,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
162
141
|
- !ruby/object:Gem::Version
|
|
163
142
|
version: '0'
|
|
164
143
|
requirements: []
|
|
165
|
-
rubygems_version: 3.
|
|
166
|
-
signing_key:
|
|
144
|
+
rubygems_version: 3.0.9
|
|
145
|
+
signing_key:
|
|
167
146
|
specification_version: 4
|
|
168
147
|
summary: A CLI to fetch and compare the 2019 coronavirus pandemic statistics.
|
|
169
148
|
test_files: []
|