jp_vaccination 1.0.0 → 1.3.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: f4db65f5550a96efe19e92b8401da3a6e8bbd327cc2398e33714253b7dc99bd0
4
- data.tar.gz: 9c20166769728687f7c9d6e68419986fe8460b084e9fe32dd1e4347e8e22726a
3
+ metadata.gz: c4cf6a5862f8cd66bc5b4816c99d2db02e2c11aed1649d2071eb2ecfacbe2bf6
4
+ data.tar.gz: fc9d5f76685ca44773a3e98f51c1a59e10c5e5f31f0948a19e75db698d16e1f2
5
5
  SHA512:
6
- metadata.gz: 738d8f344f7afa4c0347d4adbf0a0a63439834800c2fb74c3dbcaf60ec881fd27cdc39fc5ca6631d338662be3e00f11dd61e67b9c6522db4433efa2ce497b4a7
7
- data.tar.gz: fbe6e5503c027730f52f6cc9481c7abae3c69001d057fef15f709d8db598539293f63c2fd14cfb23fc1cee9e1a39592cad5a7101ade6a5bc647064acaa1762f8
6
+ metadata.gz: 3c59c8c2afc461b776f3298d39b6e23ce18e3d199326e245ee0d4ae7e5d63900b3e4c90a3fafbc8acbba5c89e974ac70af3d046b606b3d86af07a286af634570
7
+ data.tar.gz: 0ac5a667a00ff91319d3e60611477da0b6ca53bc05137ef34b8fd9583007db441cf7c5d88b713b9f9cdeb9f3907c98f24b8f52a60a1350efb6a3eda128c9f53b
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.3.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": {
@@ -354,9 +360,7 @@
354
360
  "type": "生ワクチン",
355
361
  "regular": true,
356
362
  "recommended": "小学校入学前1年間",
357
- "deadline": {
358
- "date_type": "小学校入学前1年間"
359
- }
363
+ "deadline": null
360
364
  },
361
365
  "chickenpox_1": {
362
366
  "name": "水痘",
@@ -453,7 +457,7 @@
453
457
  "period": "第1期 3回目",
454
458
  "regular": true,
455
459
  "recommended": {
456
- "year": 4
460
+ "month": 49
457
461
  },
458
462
  "deadline": {
459
463
  "date_type": "year",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JpVaccination
4
- VERSION = '1.0.0'
4
+ VERSION = '1.3.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,13 +57,13 @@ module JpVaccination
57
57
 
58
58
  date = case vaccination[:interval]
59
59
  when nil
60
- if vaccination[:deadline]
61
- calc_date(period: vaccination[:deadline], start_or_end: :start, date: last_time)
60
+ nil_interval(vaccination, last_time)
61
+ else
62
+ if vaccination[:birthday]
63
+ pneumococcus_fourth(vaccination, last_time, birthday)
62
64
  else
63
- vaccination[:recommended]
65
+ calc_date(period: vaccination[:interval], start_or_end: :start, date: last_time)
64
66
  end
65
- else
66
- calc_date(period: vaccination[:interval], start_or_end: :start, date: last_time)
67
67
  end
68
68
  next_day[:name] = name
69
69
  next_day[:date] = date
@@ -95,6 +95,20 @@ module JpVaccination
95
95
  period[:less_than] ? date - 1 : date
96
96
  end
97
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
+
98
112
  def pre_school_year(birthday, convert_to_strings = nil)
99
113
  fifth_birthday = Date.parse(birthday) >> 12 * 5
100
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: 1.0.0
4
+ version: 1.3.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-05-09 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