jp_vaccination 0.1.0 → 1.2.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/.gitignore +1 -0
- data/Gemfile.lock +13 -13
- data/data/vaccinations.json +8 -2
- data/lib/jp_vaccination/version.rb +1 -1
- data/lib/jp_vaccination.rb +22 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23d87c7ac821f04458260a6f153d78b54c8ff3765b837f84de9618f7407b22ef
|
4
|
+
data.tar.gz: bfea4725ac403c7254b9eedf91368e968289a3b7509d465b3e741e7fa07871fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8a8b99bcd8068f752c0dc4f52b8a063989820af03e4bdaa8884d616744fd5d5260cb703b0c31f9a9ef0ee5c69f911a750ff474143bae09f079e437f248c408c
|
7
|
+
data.tar.gz: 8f573f0b2975dcbb4bb7999bd1d8335b0721d955b2e14acd62c9d5b34795f33af3943179017d2c191b4a5ff16cfa5c0d2781ad67450566e61f5d6cbc58b5dd2a
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jp_vaccination (
|
4
|
+
jp_vaccination (1.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activesupport (7.0.
|
9
|
+
activesupport (7.0.3)
|
10
10
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
11
|
i18n (>= 1.6, < 2)
|
12
12
|
minitest (>= 5.1)
|
13
13
|
tzinfo (~> 2.0)
|
14
14
|
ast (2.4.2)
|
15
|
-
concurrent-ruby (1.1.
|
15
|
+
concurrent-ruby (1.1.10)
|
16
16
|
i18n (1.10.0)
|
17
17
|
concurrent-ruby (~> 1.0)
|
18
18
|
minitest (5.15.0)
|
19
|
-
parallel (1.
|
20
|
-
parser (3.1.
|
19
|
+
parallel (1.22.1)
|
20
|
+
parser (3.1.2.0)
|
21
21
|
ast (~> 2.4.1)
|
22
22
|
rack (2.2.3)
|
23
23
|
rainbow (3.1.1)
|
24
24
|
rake (13.0.6)
|
25
|
-
regexp_parser (2.
|
25
|
+
regexp_parser (2.4.0)
|
26
26
|
rexml (3.2.5)
|
27
|
-
rubocop (1.
|
27
|
+
rubocop (1.29.0)
|
28
28
|
parallel (~> 1.10)
|
29
29
|
parser (>= 3.1.0.0)
|
30
30
|
rainbow (>= 2.2.2, < 4.0)
|
31
31
|
regexp_parser (>= 1.8, < 3.0)
|
32
|
-
rexml
|
33
|
-
rubocop-ast (>= 1.
|
32
|
+
rexml (>= 3.2.5, < 4.0)
|
33
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
34
34
|
ruby-progressbar (~> 1.7)
|
35
35
|
unicode-display_width (>= 1.4.0, < 3.0)
|
36
|
-
rubocop-ast (1.
|
36
|
+
rubocop-ast (1.17.0)
|
37
37
|
parser (>= 3.1.1.0)
|
38
38
|
rubocop-fjord (0.2.0)
|
39
39
|
rubocop (>= 1.0)
|
40
40
|
rubocop-performance
|
41
|
-
rubocop-minitest (0.
|
41
|
+
rubocop-minitest (0.19.1)
|
42
42
|
rubocop (>= 0.90, < 2.0)
|
43
43
|
rubocop-performance (1.13.3)
|
44
44
|
rubocop (>= 1.7.0, < 2.0)
|
45
45
|
rubocop-ast (>= 0.4.0)
|
46
|
-
rubocop-rails (2.
|
46
|
+
rubocop-rails (2.14.2)
|
47
47
|
activesupport (>= 4.2.0)
|
48
48
|
rack (>= 1.1)
|
49
49
|
rubocop (>= 1.7.0, < 2.0)
|
50
50
|
rubocop-rake (0.6.0)
|
51
51
|
rubocop (~> 1.0)
|
52
|
-
rubocop-rspec (2.
|
52
|
+
rubocop-rspec (2.10.0)
|
53
53
|
rubocop (~> 1.19)
|
54
54
|
ruby-progressbar (1.11.0)
|
55
55
|
tzinfo (2.0.4)
|
data/data/vaccinations.json
CHANGED
@@ -245,6 +245,12 @@
|
|
245
245
|
"start": 60,
|
246
246
|
"end": null,
|
247
247
|
"less_than": true
|
248
|
+
},
|
249
|
+
"birthday": {
|
250
|
+
"date_type": "month",
|
251
|
+
"start": 12,
|
252
|
+
"end": 15,
|
253
|
+
"less_than": true
|
248
254
|
}
|
249
255
|
},
|
250
256
|
"DPT_IPV_1": {
|
@@ -294,7 +300,7 @@
|
|
294
300
|
"period": "第1期 4回目",
|
295
301
|
"regular": true,
|
296
302
|
"recommended": {
|
297
|
-
"month":
|
303
|
+
"month": 17
|
298
304
|
},
|
299
305
|
"deadline": null,
|
300
306
|
"interval": {
|
@@ -453,7 +459,7 @@
|
|
453
459
|
"period": "第1期 3回目",
|
454
460
|
"regular": true,
|
455
461
|
"recommended": {
|
456
|
-
"
|
462
|
+
"month": 49
|
457
463
|
},
|
458
464
|
"deadline": {
|
459
465
|
"date_type": "year",
|
data/lib/jp_vaccination.rb
CHANGED
@@ -5,7 +5,7 @@ require 'json'
|
|
5
5
|
require_relative './jp_vaccination/vaccination'
|
6
6
|
require_relative './jp_vaccination/version'
|
7
7
|
|
8
|
-
module JpVaccination
|
8
|
+
module JpVaccination # rubocop:disable Metrics/ModuleLength
|
9
9
|
class << self
|
10
10
|
def vaccination_keys
|
11
11
|
vaccinations_json.map do |key, _value|
|
@@ -48,7 +48,7 @@ module JpVaccination
|
|
48
48
|
combined_name_and_date.each_key.group_by { |date| combined_name_and_date[date] }.each_value(&:sort!)
|
49
49
|
end
|
50
50
|
|
51
|
-
def next_day(vaccination_key, last_time)
|
51
|
+
def next_day(vaccination_key, last_time, birthday = nil)
|
52
52
|
next_day = {}
|
53
53
|
vaccinations_json.each do |key, vaccination|
|
54
54
|
next unless key == vaccination_key.to_sym
|
@@ -57,9 +57,13 @@ module JpVaccination
|
|
57
57
|
|
58
58
|
date = case vaccination[:interval]
|
59
59
|
when nil
|
60
|
-
|
60
|
+
nil_interval(vaccination, last_time)
|
61
61
|
else
|
62
|
-
|
62
|
+
if vaccination[:birthday]
|
63
|
+
pneumococcus_fourth(vaccination, last_time, birthday)
|
64
|
+
else
|
65
|
+
calc_date(period: vaccination[:interval], start_or_end: :start, date: last_time)
|
66
|
+
end
|
63
67
|
end
|
64
68
|
next_day[:name] = name
|
65
69
|
next_day[:date] = date
|
@@ -91,6 +95,20 @@ module JpVaccination
|
|
91
95
|
period[:less_than] ? date - 1 : date
|
92
96
|
end
|
93
97
|
|
98
|
+
def nil_interval(vaccination, last_time)
|
99
|
+
if vaccination[:deadline]
|
100
|
+
calc_date(period: vaccination[:deadline], start_or_end: :start, date: last_time)
|
101
|
+
else
|
102
|
+
vaccination[:recommended]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def pneumococcus_fourth(vaccination, last_time, birthday)
|
107
|
+
interval_date = calc_date(period: vaccination[:interval], start_or_end: :start, date: last_time)
|
108
|
+
birthday_date = Date.parse(birthday) >> vaccination[:birthday][:start]
|
109
|
+
interval_date < birthday_date ? birthday_date : interval_date
|
110
|
+
end
|
111
|
+
|
94
112
|
def pre_school_year(birthday, convert_to_strings = nil)
|
95
113
|
fifth_birthday = Date.parse(birthday) >> 12 * 5
|
96
114
|
year = case fifth_birthday.month
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jp_vaccination
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- napple29
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: We provide data extracted from the National Institute
|
14
14
|
of Infectious Diseases' immunization schedule for people
|