pacing 2.2.1 → 2.2.2
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/lib/pacing/normalizer.rb +1 -1
- data/lib/pacing/pacer.rb +5 -0
- data/lib/pacing/version.rb +1 -1
- data/spec/pacing_spec.rb +123 -0
- 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: 6f948a51add0c5150a0dda83d7b6a79a32960e56515eb53a1b5d12125acc588e
|
|
4
|
+
data.tar.gz: 898d82a836b500617d374de1b839cb971ec735520b9ccce52e5f996c3d234d4f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '08894da6f407faec67661548741343b11c0535d798954c4ab9939a75c4eaf37e119f6ca38e5731d3572595a5e33257ad5ec873a1d16e0cd8a3ce6003061f218c'
|
|
7
|
+
data.tar.gz: 187f83e5990d63bca4cfd26dd449b85a52d9bfdb093aa515b2873ace42c6cdfd79f498a532bb7eb32c0752702003a2072fdda285b890d7919b5d6ddbc0ee60a8
|
data/lib/pacing/normalizer.rb
CHANGED
|
@@ -165,7 +165,7 @@ module Pacing
|
|
|
165
165
|
return services if same_interval(services)
|
|
166
166
|
|
|
167
167
|
services.map do |service|
|
|
168
|
-
if !(service[:interval] == "monthly")
|
|
168
|
+
if !(service[:interval] == "monthly") && interval_average_days.key?(service[:interval])
|
|
169
169
|
# weekly(5 days) = frequency # weekly
|
|
170
170
|
# monthly(20 days) = frequency * monthly
|
|
171
171
|
# yearly(200 days)
|
data/lib/pacing/pacer.rb
CHANGED
|
@@ -4,6 +4,7 @@ require 'holidays'
|
|
|
4
4
|
module Pacing
|
|
5
5
|
class Pacer
|
|
6
6
|
COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
|
7
|
+
SUPPORTED_INTERVALS = %w[monthly per\ month weekly per\ week yearly per\ year].freeze
|
|
7
8
|
attr_reader :school_plan, :date, :non_business_days, :state, :mode, :interval, :summer_holidays, :show_frequency
|
|
8
9
|
|
|
9
10
|
def initialize(school_plan:, date:, non_business_days:, state: :us_tn, mode: :liberal, summer_holidays: [], show_frequency: false)
|
|
@@ -22,6 +23,8 @@ module Pacing
|
|
|
22
23
|
def interval
|
|
23
24
|
# filter out services that haven't started or whose time is passed
|
|
24
25
|
services = @school_plan[:school_plan_services].filter do |school_plan_service|
|
|
26
|
+
next false unless SUPPORTED_INTERVALS.include?(school_plan_service[:interval])
|
|
27
|
+
|
|
25
28
|
within = true
|
|
26
29
|
if !(parse_date(school_plan_service[:start_date]) <= parse_date(@date) && parse_date(@date) <= parse_date(school_plan_service[:end_date]))
|
|
27
30
|
within = false
|
|
@@ -55,6 +58,8 @@ module Pacing
|
|
|
55
58
|
# filter out services that haven't started or whose time is passed
|
|
56
59
|
school_plan_services = Pacing::Normalizer.new(@school_plan[:school_plan_services], @date).normalize
|
|
57
60
|
services = school_plan_services[:school_plan_services].filter do |school_plan_service|
|
|
61
|
+
next false unless SUPPORTED_INTERVALS.include?(school_plan_service[:interval])
|
|
62
|
+
|
|
58
63
|
within = true
|
|
59
64
|
if !(parse_date(school_plan_service[:start_date]) <= parse_date(@date) && parse_date(@date) <= parse_date(school_plan_service[:end_date]))
|
|
60
65
|
within = false
|
data/lib/pacing/version.rb
CHANGED
data/spec/pacing_spec.rb
CHANGED
|
@@ -192,6 +192,42 @@ RSpec.describe Pacing::Pacer do
|
|
|
192
192
|
}
|
|
193
193
|
])
|
|
194
194
|
end
|
|
195
|
+
|
|
196
|
+
it "return some the current interval #5" do
|
|
197
|
+
school_plan = {
|
|
198
|
+
school_plan_services: [
|
|
199
|
+
{
|
|
200
|
+
school_plan_type: 'IEP',
|
|
201
|
+
start_date: '04-01-2022',
|
|
202
|
+
end_date: '04-01-2023',
|
|
203
|
+
type_of_service: 'Language Therapy',
|
|
204
|
+
frequency: 6,
|
|
205
|
+
interval: 'per reporting period',
|
|
206
|
+
time_per_session_in_minutes: 30,
|
|
207
|
+
completed_visits_for_current_interval: 7,
|
|
208
|
+
extra_sessions_allowable: 1,
|
|
209
|
+
interval_for_extra_sessions_allowable: 'monthly'
|
|
210
|
+
}, {
|
|
211
|
+
school_plan_type: 'IEP',
|
|
212
|
+
start_date: '04-01-2022',
|
|
213
|
+
end_date: '04-01-2023',
|
|
214
|
+
type_of_service: 'Physical Therapy',
|
|
215
|
+
frequency: 2,
|
|
216
|
+
interval: 'per reporting period',
|
|
217
|
+
time_per_session_in_minutes: 30,
|
|
218
|
+
completed_visits_for_current_interval: 2,
|
|
219
|
+
extra_sessions_allowable: 1,
|
|
220
|
+
interval_for_extra_sessions_allowable: 'weekly'
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
date = '05-19-2022'
|
|
226
|
+
non_business_days = ['04-25-2022']
|
|
227
|
+
results = Pacing::Pacer.new(school_plan: school_plan, date: date, non_business_days: non_business_days, mode: :liberal).interval
|
|
228
|
+
|
|
229
|
+
expect(results).to eq([])
|
|
230
|
+
end
|
|
195
231
|
end
|
|
196
232
|
|
|
197
233
|
describe "#calculate" do
|
|
@@ -5259,3 +5295,90 @@ describe "should calculate pacing correctly when interval starts with 'per month
|
|
|
5259
5295
|
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
5296
|
end
|
|
5261
5297
|
end
|
|
5298
|
+
|
|
5299
|
+
describe "should skip services with unsupported intervals" do
|
|
5300
|
+
it "should return an empty array when all services have unsupported intervals" do
|
|
5301
|
+
school_plan = {
|
|
5302
|
+
school_plan_services: [
|
|
5303
|
+
{
|
|
5304
|
+
school_plan_type: 'IEP',
|
|
5305
|
+
start_date: '04-01-2022',
|
|
5306
|
+
end_date: '04-01-2023',
|
|
5307
|
+
type_of_service: 'Language Therapy',
|
|
5308
|
+
frequency: 6,
|
|
5309
|
+
interval: 'daily',
|
|
5310
|
+
time_per_session_in_minutes: 30,
|
|
5311
|
+
completed_visits_for_current_interval: 7,
|
|
5312
|
+
extra_sessions_allowable: 1,
|
|
5313
|
+
interval_for_extra_sessions_allowable: 'monthly'
|
|
5314
|
+
}
|
|
5315
|
+
]
|
|
5316
|
+
}
|
|
5317
|
+
|
|
5318
|
+
date = '05-19-2022'
|
|
5319
|
+
non_business_days = []
|
|
5320
|
+
results = Pacing::Pacer.new(school_plan: school_plan, date: date, non_business_days: non_business_days).calculate
|
|
5321
|
+
expect(results).to eq([])
|
|
5322
|
+
end
|
|
5323
|
+
|
|
5324
|
+
it "should return an empty array for per reporting period interval" do
|
|
5325
|
+
school_plan = {
|
|
5326
|
+
school_plan_services: [
|
|
5327
|
+
{
|
|
5328
|
+
school_plan_type: 'IEP',
|
|
5329
|
+
start_date: '04-01-2022',
|
|
5330
|
+
end_date: '04-01-2023',
|
|
5331
|
+
type_of_service: 'Speech Therapy',
|
|
5332
|
+
frequency: 6,
|
|
5333
|
+
interval: 'per reporting period',
|
|
5334
|
+
time_per_session_in_minutes: 30,
|
|
5335
|
+
completed_visits_for_current_interval: 3,
|
|
5336
|
+
extra_sessions_allowable: 0,
|
|
5337
|
+
interval_for_extra_sessions_allowable: 'monthly'
|
|
5338
|
+
}
|
|
5339
|
+
]
|
|
5340
|
+
}
|
|
5341
|
+
|
|
5342
|
+
date = '05-19-2022'
|
|
5343
|
+
non_business_days = []
|
|
5344
|
+
results = Pacing::Pacer.new(school_plan: school_plan, date: date, non_business_days: non_business_days).calculate
|
|
5345
|
+
expect(results).to eq([])
|
|
5346
|
+
end
|
|
5347
|
+
|
|
5348
|
+
it "should only return results for services with supported intervals" do
|
|
5349
|
+
school_plan = {
|
|
5350
|
+
school_plan_services: [
|
|
5351
|
+
{
|
|
5352
|
+
school_plan_type: 'IEP',
|
|
5353
|
+
start_date: '04-01-2022',
|
|
5354
|
+
end_date: '04-01-2023',
|
|
5355
|
+
type_of_service: 'Language Therapy',
|
|
5356
|
+
frequency: 6,
|
|
5357
|
+
interval: 'daily',
|
|
5358
|
+
time_per_session_in_minutes: 30,
|
|
5359
|
+
completed_visits_for_current_interval: 7,
|
|
5360
|
+
extra_sessions_allowable: 1,
|
|
5361
|
+
interval_for_extra_sessions_allowable: 'monthly'
|
|
5362
|
+
},
|
|
5363
|
+
{
|
|
5364
|
+
school_plan_type: 'IEP',
|
|
5365
|
+
start_date: '04-01-2022',
|
|
5366
|
+
end_date: '04-01-2023',
|
|
5367
|
+
type_of_service: 'Physical Therapy',
|
|
5368
|
+
frequency: 6,
|
|
5369
|
+
interval: 'monthly',
|
|
5370
|
+
time_per_session_in_minutes: 30,
|
|
5371
|
+
completed_visits_for_current_interval: 2,
|
|
5372
|
+
extra_sessions_allowable: 1,
|
|
5373
|
+
interval_for_extra_sessions_allowable: 'monthly'
|
|
5374
|
+
}
|
|
5375
|
+
]
|
|
5376
|
+
}
|
|
5377
|
+
|
|
5378
|
+
date = '05-19-2022'
|
|
5379
|
+
non_business_days = []
|
|
5380
|
+
results = Pacing::Pacer.new(school_plan: school_plan, date: date, non_business_days: non_business_days).calculate
|
|
5381
|
+
expect(results.length).to eq(1)
|
|
5382
|
+
expect(results[0][:discipline]).to eq('Physical Therapy')
|
|
5383
|
+
end
|
|
5384
|
+
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.2.
|
|
4
|
+
version: 2.2.2
|
|
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:
|
|
13
|
+
date: 2026-04-03 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rspec
|