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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b24ce38db45a0d195c2343c3c64366601e3a178f2225e335d60c0d613bf210a6
4
- data.tar.gz: a63b2fa69cff42d13fc3ee2c21a351875ad08f27ee8939296f26137efd9ef39a
3
+ metadata.gz: 23d87c7ac821f04458260a6f153d78b54c8ff3765b837f84de9618f7407b22ef
4
+ data.tar.gz: bfea4725ac403c7254b9eedf91368e968289a3b7509d465b3e741e7fa07871fa
5
5
  SHA512:
6
- metadata.gz: 261d6f73f91adf69ba637bf11a055da9887f43d45764ccdfaad30c97a2b1de2ca932b2ca748084660e6a34205c66171a1578a37951e0df15f6aa9ea3c3898f8b
7
- data.tar.gz: fbef6b69d109ef7820e181b7287f00f98524d5fcd18e1ae152ee9c0020d6c61e68aadfe1ddfd0264831d03859aedce47f980dd7692c94951f5957ecee3de8a38
6
+ metadata.gz: e8a8b99bcd8068f752c0dc4f52b8a063989820af03e4bdaa8884d616744fd5d5260cb703b0c31f9a9ef0ee5c69f911a750ff474143bae09f079e437f248c408c
7
+ data.tar.gz: 8f573f0b2975dcbb4bb7999bd1d8335b0721d955b2e14acd62c9d5b34795f33af3943179017d2c191b4a5ff16cfa5c0d2781ad67450566e61f5d6cbc58b5dd2a
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /vendor/
9
10
 
10
11
  Gemfile.lock
11
12
  .gem/
data/Gemfile.lock CHANGED
@@ -1,55 +1,55 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jp_vaccination (0.1.0)
4
+ jp_vaccination (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activesupport (7.0.2.2)
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.9)
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.21.0)
20
- parser (3.1.1.0)
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.2.1)
25
+ regexp_parser (2.4.0)
26
26
  rexml (3.2.5)
27
- rubocop (1.25.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.15.1, < 2.0)
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.16.0)
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.17.2)
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.13.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.9.0)
52
+ rubocop-rspec (2.10.0)
53
53
  rubocop (~> 1.19)
54
54
  ruby-progressbar (1.11.0)
55
55
  tzinfo (2.0.4)
@@ -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": 12
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
- "year": 4
462
+ "month": 49
457
463
  },
458
464
  "deadline": {
459
465
  "date_type": "year",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JpVaccination
4
- VERSION = '0.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -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
- calc_date(period: vaccination[:deadline], start_or_end: :start, date: last_time)
60
+ nil_interval(vaccination, last_time)
61
61
  else
62
- calc_date(period: vaccination[:interval], start_or_end: :start, date: last_time)
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: 0.1.0
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-03-27 00:00:00.000000000 Z
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