Skip to content

Commit f906d55

Browse files
authored
Merge pull request #7988 from espoon-voltti/transition-period-preschool-assistance-level-for-vammainen2
Lisätään esiopetuksen tuen taso siirtymäkaudella myös vaikeavammaisille
2 parents d8cd151 + e266522 commit f906d55

File tree

10 files changed

+76
-10
lines changed

10 files changed

+76
-10
lines changed

frontend/src/employee-frontend/components/child-information/assistance/PreschoolAssistanceForm.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export const levelConfigs: Record<PreschoolAssistanceLevel, LevelConfig> = {
6262
minStartDate: LocalDate.of(2025, 8, 1),
6363
maxEndDate: LocalDate.of(2026, 7, 31)
6464
},
65+
CHILD_SUPPORT_2_AND_OLD_EXTENDED_COMPULSORY_EDUCATION: {
66+
minStartDate: LocalDate.of(2025, 8, 1),
67+
maxEndDate: LocalDate.of(2026, 7, 31)
68+
},
6569
GROUP_SUPPORT: { minStartDate: LocalDate.of(2025, 8, 1) }
6670
}
6771

frontend/src/employee-frontend/components/reports/AssistanceNeedsAndActions.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ const emptyGroupingDataByGroup = (
201201
CHILD_SUPPORT: 0,
202202
CHILD_SUPPORT_AND_EXTENDED_COMPULSORY_EDUCATION: 0,
203203
CHILD_SUPPORT_AND_OLD_EXTENDED_COMPULSORY_EDUCATION: 0,
204+
CHILD_SUPPORT_2_AND_OLD_EXTENDED_COMPULSORY_EDUCATION: 0,
204205
GROUP_SUPPORT: 0
205206
},
206207
otherAssistanceMeasureCounts: {
@@ -252,6 +253,7 @@ const emptyGroupingDataByChild = (name: string): GroupingDataByChild => ({
252253
CHILD_SUPPORT: 0,
253254
CHILD_SUPPORT_AND_EXTENDED_COMPULSORY_EDUCATION: 0,
254255
CHILD_SUPPORT_AND_OLD_EXTENDED_COMPULSORY_EDUCATION: 0,
256+
CHILD_SUPPORT_2_AND_OLD_EXTENDED_COMPULSORY_EDUCATION: 0,
255257
GROUP_SUPPORT: 0
256258
},
257259
otherAssistanceMeasureCounts: {

frontend/src/lib-common/generated/api-types/assistance.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export const preschoolAssistanceLevels = [
161161
'CHILD_SUPPORT',
162162
'CHILD_SUPPORT_AND_EXTENDED_COMPULSORY_EDUCATION',
163163
'CHILD_SUPPORT_AND_OLD_EXTENDED_COMPULSORY_EDUCATION',
164+
'CHILD_SUPPORT_2_AND_OLD_EXTENDED_COMPULSORY_EDUCATION',
164165
'GROUP_SUPPORT'
165166
] as const
166167

frontend/src/lib-customizations/defaults/employee/i18n/fi.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,11 @@ export const fi = {
817817
CHILD_SUPPORT:
818818
'Lapsikohtainen tuki ilman varhennettua oppivelvollisuutta (Koskeen)',
819819
CHILD_SUPPORT_AND_EXTENDED_COMPULSORY_EDUCATION:
820-
'Lapsikohtainen tuki ja varhennettu oppivelvollisuus (Koskeen, älä käytä ennen 1.10.2025)',
820+
'Lapsikohtainen tuki ja varhennettu oppivelvollisuus (Koskeen)',
821821
CHILD_SUPPORT_AND_OLD_EXTENDED_COMPULSORY_EDUCATION:
822-
'Lapsikohtainen tuki ja vanhan mallinen pidennetty ov - muu kuin vaikeimmin kehitysvammainen (Koskeen, käytössä siirtymäkautena 1.8.2025 - 31.7.2026)',
822+
'Lapsikohtainen tuki ja vanhan mallinen pidennetty ov - muu (Koskeen, käytössä siirtymäkautena 1.8.2025 - 31.7.2026)',
823+
CHILD_SUPPORT_2_AND_OLD_EXTENDED_COMPULSORY_EDUCATION:
824+
'Lapsikohtainen tuki ja vanhan mallinen pidennetty ov - kehitysvamma 2 (Koskeen, käytössä siirtymäkautena 1.8.2025 - 31.7.2026)',
823825
GROUP_SUPPORT: 'Ryhmäkohtaiset tukimuodot'
824826
},
825827
otherAssistanceMeasureType: {

service/src/integrationTest/kotlin/fi/espoo/evaka/koski/KoskiIntegrationTest.kt

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ class KoskiIntegrationTest : FullApplicationTest(resetDbBeforeEach = true) {
469469
}
470470

471471
@Test
472-
fun `transition period preschool assistance info is converted to Koski extra information`() {
472+
fun `transition period preschool assistance info (vammainen) is converted to Koski extra information`() {
473473
val assistance =
474474
DevPreschoolAssistance(
475475
modifiedBy = testDecisionMaker_1.toEvakaUser(),
@@ -497,6 +497,36 @@ class KoskiIntegrationTest : FullApplicationTest(resetDbBeforeEach = true) {
497497
)
498498
}
499499

500+
@Test
501+
fun `transition period preschool assistance info (vaikeasti vammainen) is converted to Koski extra information`() {
502+
val assistance =
503+
DevPreschoolAssistance(
504+
modifiedBy = testDecisionMaker_1.toEvakaUser(),
505+
childId = testChild_1.id,
506+
validDuring = testPeriod(0L to 1L),
507+
level =
508+
PreschoolAssistanceLevel.CHILD_SUPPORT_2_AND_OLD_EXTENDED_COMPULSORY_EDUCATION,
509+
)
510+
511+
insertPlacement(testChild_1)
512+
db.transaction { tx -> tx.insert(assistance) }
513+
514+
koskiTester.triggerUploads(today = preschoolTerm2019.end.plusDays(1))
515+
516+
assertEquals(
517+
Lisätiedot(
518+
vammainen = null,
519+
vaikeastiVammainen = listOf(Aikajakso.from(assistance.validDuring)),
520+
pidennettyOppivelvollisuus = Aikajakso.from(assistance.validDuring),
521+
varhennetunOppivelvollisuudenJaksot = null,
522+
kuljetusetu = null,
523+
erityisenTuenPäätökset = null,
524+
tuenPäätöksenJaksot = listOf(Tukijakso.from(assistance.validDuring)),
525+
),
526+
koskiEndpoint.getStudyRights().values.single().opiskeluoikeus.lisätiedot,
527+
)
528+
}
529+
500530
@Test
501531
fun `post-2026 preschool assistance info is converted to Koski extra information`() {
502532
data class TestCase(val period: FiniteDateRange, val level: PreschoolAssistanceLevel)

service/src/main/kotlin/fi/espoo/evaka/assistance/Assistance.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ enum class PreschoolAssistanceLevel(
7474
minStartDate = LocalDate.of(2025, 8, 1),
7575
maxEndDate = LocalDate.of(2026, 7, 31),
7676
),
77+
// deprecated, only available during the transition year
78+
CHILD_SUPPORT_2_AND_OLD_EXTENDED_COMPULSORY_EDUCATION(
79+
minStartDate = LocalDate.of(2025, 8, 1),
80+
maxEndDate = LocalDate.of(2026, 7, 31),
81+
),
7782
GROUP_SUPPORT(minStartDate = LocalDate.of(2025, 8, 1));
7883

7984
override val sqlType: String = "preschool_assistance_level"

service/src/main/kotlin/fi/espoo/evaka/koski/KoskiData.kt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ data class KoskiActivePreschoolDataRaw(
280280
val childSupport: DateSet,
281281
val childSupportAndExtendedCompulsoryEducation: DateSet,
282282
val childSupportAndOldExtendedCompulsoryEducation: DateSet,
283+
val childSupport2AndOldExtendedCompulsoryEducation: DateSet,
283284
) : KoskiActiveDataRaw(OpiskeluoikeudenTyyppiKoodi.PRESCHOOL) {
284285
override fun getHolidayDates(): DateSet = DateSet.of()
285286

@@ -314,6 +315,8 @@ data class KoskiActivePreschoolDataRaw(
314315
// used only during the transition year
315316
val childSupportWithOldEce =
316317
childSupportAndOldExtendedCompulsoryEducation.intersection(listOf(placementSpan))
318+
val childSupport2WithOldEce =
319+
childSupport2AndOldExtendedCompulsoryEducation.intersection(listOf(placementSpan))
317320

318321
// these are deprecated after about 1.8.2026
319322
val specialSupportWithoutEce = specialSupport.intersection(listOf(placementSpan))
@@ -324,17 +327,23 @@ data class KoskiActivePreschoolDataRaw(
324327

325328
// Koski only accepts one range of old pidennetty oppivelvollisuus
326329
val longestOldEce =
327-
level1.addAll(level2).addAll(childSupportWithOldEce).ranges().maxByOrNull {
328-
it.durationInDays()
329-
}
330+
level1
331+
.addAll(level2)
332+
.addAll(childSupportWithOldEce)
333+
.addAll(childSupport2WithOldEce)
334+
.ranges()
335+
.maxByOrNull { it.durationInDays() }
330336

331337
// these replacements are introduced around 1.8.2026
332338
val childSupportWithoutEce = childSupport.intersection(listOf(placementSpan))
333339
val childSupportWithNewEce =
334340
childSupportAndExtendedCompulsoryEducation.intersection(listOf(placementSpan))
335341

336342
val allChildSupport =
337-
childSupportWithoutEce.addAll(childSupportWithNewEce).addAll(childSupportWithOldEce)
343+
childSupportWithoutEce
344+
.addAll(childSupportWithNewEce)
345+
.addAll(childSupportWithOldEce)
346+
.addAll(childSupport2WithOldEce)
338347

339348
// Koski only accepts one range
340349
val longestTransportBenefit =
@@ -351,7 +360,12 @@ data class KoskiActivePreschoolDataRaw(
351360
.takeIf { it.isNotEmpty() },
352361
// deprecated
353362
vaikeastiVammainen =
354-
level2.ranges().map { Aikajakso.from(it) }.toList().takeIf { it.isNotEmpty() },
363+
level2
364+
.addAll(childSupport2WithOldEce)
365+
.ranges()
366+
.map { Aikajakso.from(it) }
367+
.toList()
368+
.takeIf { it.isNotEmpty() },
355369
// deprecated
356370
pidennettyOppivelvollisuus = longestOldEce?.let { Aikajakso.from(it) },
357371
varhennetunOppivelvollisuudenJaksot =

service/src/main/resources/db/migration/R__koski_views.sql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ BEGIN ATOMIC
8080
coalesce(transport_benefit, '{}'),
8181
coalesce(child_support, '{}'),
8282
coalesce(child_support_and_extended_compulsory_education, '{}'),
83-
coalesce(child_support_and_old_extended_compulsory_education, '{}')
83+
coalesce(child_support_and_old_extended_compulsory_education, '{}'),
84+
coalesce(child_support_2_and_old_extended_compulsory_education, '{}')
8485
) AS input_data
8586
FROM koski_placement(today, sync_range_start) p
8687
JOIN koski_unit d ON p.unit_id = d.id
@@ -110,7 +111,10 @@ BEGIN ATOMIC
110111
) AS child_support_and_extended_compulsory_education,
111112
range_agg(valid_during) FILTER (
112113
WHERE level = 'CHILD_SUPPORT_AND_OLD_EXTENDED_COMPULSORY_EDUCATION'
113-
) AS child_support_and_old_extended_compulsory_education
114+
) AS child_support_and_old_extended_compulsory_education,
115+
range_agg(valid_during) FILTER (
116+
WHERE level = 'CHILD_SUPPORT_2_AND_OLD_EXTENDED_COMPULSORY_EDUCATION'
117+
) AS child_support_2_and_old_extended_compulsory_education
114118
FROM preschool_assistance pa
115119
WHERE pa.child_id = p.child_id
116120
AND pa.valid_during && range_merge(placements)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TYPE preschool_assistance_level ADD VALUE 'CHILD_SUPPORT_2_AND_OLD_EXTENDED_COMPULSORY_EDUCATION';
2+
3+
ALTER TYPE koski_preschool_input_data ADD ATTRIBUTE child_support_2_and_old_extended_compulsory_education datemultirange;

service/src/main/resources/migrations.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,3 +561,4 @@ V562__calendar_event_nekku_unordered_meals.sql
561561
V563__staff_attendance_realtime_constraint_change.sql
562562
V564__add_nekku_order_time.sql
563563
V565__placement_draft_start_date.sql
564+
V566__new_preschool_assistance_levels_v3.sql

0 commit comments

Comments
 (0)