pacing 2.1.0 → 2.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: bbc2189e33671c8a34eccd7aa71ec4f93d48fe0228e4931655bda84c519cc1d8
4
- data.tar.gz: a1808e5be13be267c73b2720fabafbfe9e379029a209a86f5b19921c515497f5
3
+ metadata.gz: 11132b13902786c1b44efc9c3dc217f0e56675de6e9c90ee7f9e86ed8b8c297d
4
+ data.tar.gz: 5ecf36d92525e32a963cc1ec0739535c23085679fb40edb64ed4e354f2661dd7
5
5
  SHA512:
6
- metadata.gz: f320cddb2b0a54b1f834c4a8a98fb496f6d7348c848525c26fdd52e22eaec8312f083df2b9378ca0bb2794480f6d6c3e8b65239221bdd27cf5463ac5bb8f2080
7
- data.tar.gz: 7a6d01438e8ab61f2bec040cd2ddbdd14fda5b832d93324678ce0852fb10e34cd9a8d608b4c58fc89987d974c40a9251abbc4b9a25bb6c50b0c46a68e6688055
6
+ metadata.gz: b8ba5d05efddeb02e010e036073b12faf2a9bc5ecf0ee9eabcae2004aa132388babdd07f7d11a290c84f8a389ddbe1ff9a7b809d3e70dc100937963557c7f877
7
+ data.tar.gz: b37f58965f1f2aac5f78c56b5e1b8144dc9f993387103bd28a51fc6f241d81ebd7bd4edef7cd002e9df0f29075db8a22a1a17218f7fb3e260ad7138e1bf755eb
data/lib/pacing/error.rb CHANGED
@@ -53,7 +53,7 @@ module Pacing
53
53
 
54
54
  begin
55
55
  @school_plan[:school_plan_services].each do |school_plan_service|
56
- if (parse_date(school_plan_service[:start_date]) < parse_date(@date) && parse_date(@date) < parse_date(school_plan_service[:end_date]))
56
+ if (parse_date(school_plan_service[:start_date]) <= parse_date(@date) && parse_date(@date) <= parse_date(school_plan_service[:end_date]))
57
57
  valid_range_or_exceptions = true
58
58
  end
59
59
  end
@@ -72,4 +72,3 @@ module Pacing
72
72
  end
73
73
  end
74
74
  end
75
-
@@ -32,7 +32,7 @@ module Pacing
32
32
  discipline_services = services.filter do |service|
33
33
  ["pragmatic language", "speech and language", "language", "speech", "language therapy", "speech therapy", "speech and language therapy", "speech language therapy"].include?(service[:type_of_service].downcase)
34
34
  end
35
-
35
+
36
36
  return {} if discipline_services.empty?
37
37
 
38
38
  discipline_services = normalize_to_monthly_frequency(discipline_services)
@@ -57,7 +57,7 @@ module Pacing
57
57
  discipline_services = services.filter do |service|
58
58
  ["occupation therapy", "occupational therapy", "occupation"].include?(service[:type_of_service].downcase)
59
59
  end
60
-
60
+
61
61
  return {} if discipline_services.empty?
62
62
 
63
63
  discipline_services = normalize_to_monthly_frequency(discipline_services)
@@ -82,7 +82,7 @@ module Pacing
82
82
  discipline_services = services.filter do |service|
83
83
  ["physical therapy", "physical"].include?(service[:type_of_service].downcase)
84
84
  end
85
-
85
+
86
86
  return {} if discipline_services.empty?
87
87
 
88
88
  discipline_services = normalize_to_monthly_frequency(discipline_services)
@@ -107,7 +107,7 @@ module Pacing
107
107
  discipline_services = services.filter do |service|
108
108
  ["feeding therapy", "feeding"].include?(service[:type_of_service].downcase)
109
109
  end
110
-
110
+
111
111
  return {} if discipline_services.empty?
112
112
 
113
113
  discipline_services = normalize_to_monthly_frequency(discipline_services)
@@ -155,8 +155,11 @@ module Pacing
155
155
  # average business days for each interval
156
156
  interval_average_days = {
157
157
  "weekly" => 5,
158
+ "per week" => 5,
158
159
  "monthly" => 22,
159
- "yearly" => 210 # take away average holidays period with is 2.5 months
160
+ "per month" => 22,
161
+ "yearly" => 210,
162
+ "per year" => 210 # take away average holidays period with is 2.5 months
160
163
  }
161
164
 
162
165
  return services if same_interval(services)
@@ -164,7 +167,7 @@ module Pacing
164
167
  services.map do |service|
165
168
  if !(service[:interval] == "monthly")
166
169
  # weekly(5 days) = frequency # weekly
167
- # monthly(20 days) = frequency * monthly
170
+ # monthly(20 days) = frequency * monthly
168
171
  # yearly(200 days)
169
172
 
170
173
  f = service[:frequency]
@@ -207,4 +210,3 @@ module Pacing
207
210
  end
208
211
  end
209
212
  end
210
-
data/lib/pacing/pacer.rb CHANGED
@@ -101,7 +101,7 @@ module Pacing
101
101
 
102
102
  # discipline iep frequency
103
103
  def discipline_frequency(service)
104
- service[:frequency].to_s + service[:interval][0].gsub(/(per)|p/i, "").strip.upcase + "x" + service[:time_per_session_in_minutes].to_s + service[:type_of_service][0].upcase + "T"
104
+ service[:frequency].to_s + service[:interval].gsub(/(per)|p/i, "").strip[0].upcase + "x" + service[:time_per_session_in_minutes].to_s + service[:type_of_service][0].upcase + "T"
105
105
  end
106
106
 
107
107
  # get a spreadout of visit dates over an interval by using simple proportion.
@@ -348,6 +348,6 @@ module Pacing
348
348
  holidays_start += 1 until holidays_start.wday == 1
349
349
 
350
350
  [holidays_start, holidays_end]
351
- end
351
+ end
352
352
  end
353
353
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pacing
4
- VERSION = "2.1.0"
4
+ VERSION = "2.2.0"
5
5
  end
data/spec/pacing_spec.rb CHANGED
@@ -5232,4 +5232,30 @@ describe "should include frequency in the output if show frequency is true" do
5232
5232
  results = Pacing::Pacer.new(school_plan: school_plan, date: date, non_business_days: non_business_days, show_frequency: true).calculate
5233
5233
  expect(results).to eq([{:discipline=>"Speech Therapy", :remaining_visits=>1, :used_visits=>0, :pace=>0, :pace_indicator=>"😁", :pace_suggestion=>"once a week", :expected_visits_at_date=>0, :reset_date=>"10-24-2022", :frequency=>"1Wx20ST"}])
5234
5234
  end
5235
+
5236
+ it "should correctly parse the pacing for patient 4564 when start_date is same as date" do
5237
+ school_plan = {:school_plan_services=>[{:school_plan_type=>"IEP", :start_date=>"01-09-2023", :end_date=>"03-30-2023", :type_of_service=>"Speech Therapy", :frequency=>1, :interval=>"weekly", :time_per_session_in_minutes=>20, :completed_visits_for_current_interval=>0, :extra_sessions_allowable=>0, :interval_for_extra_sessions_allowable=>"weekly"}]}
5238
+ date = "01-09-2023"
5239
+ non_business_days = []
5240
+ results = Pacing::Pacer.new(school_plan: school_plan, date: date, non_business_days: non_business_days, show_frequency: true).calculate
5241
+ expect(results).to eq([{:discipline=>"Speech Therapy", :remaining_visits=>1, :used_visits=>0, :pace=>0, :pace_indicator=>"😁", :pace_suggestion=>"once a week", :expected_visits_at_date=>0, :reset_date=>"01-16-2023", :frequency=>"1Wx20ST"}])
5242
+ end
5243
+ end
5244
+
5245
+ describe "should calculate pacing correctly when interval starts with 'per month, per week, and per year'" do
5246
+ it "should correctly parse the pacing for patient 4565" do
5247
+ school_plan = {:school_plan_services=>[{:school_plan_type=>"IEP", :start_date=>"02-23-2022", :end_date=>"02-23-2023", :type_of_service=>"Speech Therapy", :frequency=>12, :interval=>"per month", :time_per_session_in_minutes=>20, :completed_visits_for_current_interval=>3, :extra_sessions_allowable=>0, :interval_for_extra_sessions_allowable=>"per month"}, {:school_plan_type=>"IEP", :start_date=>"05-19-2022", :end_date=>"11-01-2022", :type_of_service=>"Language Therapy", :frequency=>3, :interval=>"per week", :time_per_session_in_minutes=>20, :completed_visits_for_current_interval=>0, :extra_sessions_allowable=>0, :interval_for_extra_sessions_allowable=>"per week"}]}
5248
+ date = "10-17-2022"
5249
+ non_business_days = []
5250
+ results = Pacing::Pacer.new(school_plan: school_plan, date: date, non_business_days: non_business_days, show_frequency: true).calculate
5251
+ expect(results).to eq([{:discipline=>"Speech Therapy", :remaining_visits=>22, :used_visits=>3, :pace=>-10, :pace_indicator=>"🐢", :pace_suggestion=>"once a day", :expected_visits_at_date=>13, :reset_date=>"11-01-2022", :frequency=>"25Mx20ST"}])
5252
+ end
5253
+
5254
+ it "should correctly parse the pacing for patient 4566" do
5255
+ school_plan = {:school_plan_services=>[{:school_plan_type=>"IEP", :start_date=>"09-27-2022", :end_date=>"09-27-2023", :type_of_service=>"Language Therapy", :frequency=>30, :interval=>"per year", :time_per_session_in_minutes=>20, :completed_visits_for_current_interval=>4, :extra_sessions_allowable=>0, :interval_for_extra_sessions_allowable=>"per year"}]}
5256
+ date = "10-17-2022"
5257
+ non_business_days = []
5258
+ results = Pacing::Pacer.new(school_plan: school_plan, date: date, non_business_days: non_business_days, show_frequency: true).calculate
5259
+ expect(results).to eq([{:discipline=>"Speech Therapy", :remaining_visits=>26, :used_visits=>4, :pace=>2, :pace_indicator=>"🐇", :pace_suggestion=>"less than once per week", :expected_visits_at_date=>2, :reset_date=>"09-27-2023", :frequency=>"30Yx20ST"}])
5260
+ end
5235
5261
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pacing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin S. Dias
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-12-07 00:00:00.000000000 Z
13
+ date: 2023-01-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec