jp_vaccination 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4db65f5550a96efe19e92b8401da3a6e8bbd327cc2398e33714253b7dc99bd0
4
- data.tar.gz: 9c20166769728687f7c9d6e68419986fe8460b084e9fe32dd1e4347e8e22726a
3
+ metadata.gz: 69fcf954fa33dd67d0d3ee9f8a9af452ce3a14ebdf26d4c29cf3d8b757cee61e
4
+ data.tar.gz: b8b100ebda4f0c986d80f1e9e87eac158acc53e2e5f1d364e8a4d1f4cd70b2de
5
5
  SHA512:
6
- metadata.gz: 738d8f344f7afa4c0347d4adbf0a0a63439834800c2fb74c3dbcaf60ec881fd27cdc39fc5ca6631d338662be3e00f11dd61e67b9c6522db4433efa2ce497b4a7
7
- data.tar.gz: fbe6e5503c027730f52f6cc9481c7abae3c69001d057fef15f709d8db598539293f63c2fd14cfb23fc1cee9e1a39592cad5a7101ade6a5bc647064acaa1762f8
6
+ metadata.gz: e2f8178a7cd61e8b6a9f3450fcc4e8b5e768d0bf83e0a324f08fbe6aeb7041e8d4c2e621179fe7489969af916bc502f174be9eff11f20f6c5b1eadafffd605b9
7
+ data.tar.gz: 6013350deff880d77b30ce888355a55f8a8da72ea21a4dc0829239c7f86ae1c573aa555634c7474294d3c9cebb676db3f90fd39a0a222567657711e3e790e457
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.0.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": {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JpVaccination
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.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.1.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-10 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