Skip to content

Commit

Permalink
New program eligibility rule
Browse files Browse the repository at this point in the history
  • Loading branch information
SodhiA1 committed Jan 13, 2025
1 parent 57dc139 commit f85516c
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum ProgramEligibilityIssueCode {
NOT_ENROLLED_SPECIAL_ED("NTENRSPED", "The student was not reported in any inclusive education programs."),
NON_ELIG_SPECIAL_EDUCATION("NELISPED", "Student must be school-aged or a non-graduated adult reported in a grade other than GA."),
FEB_ONLINE_WITH_HISTORICAL_FUNDING("FEBSPEDERR", "Student has already been funded in September collection."),
INDP_FIRST_NATION_SPED("FUND20SPED", "Student with Funding code 20 will not be funded for inclusive education programs."),
INDIGENOUS_ADULT("ISADULTAGE", "Student must be school-aged and self-identify as having Indigenous Ancestry to be eligible for funding for Indigenous Support Programs."),
YEARS_IN_ELL("ELL5ORLESS", "Student must be school-aged and have been reported in ELL for 5 years or less."),
NOT_ENROLLED_ELL("NTENRELL", "The student is not enrolled in the ELL program."),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ca.bc.gov.educ.studentdatacollection.api.rules.programelegibility.impl;

import ca.bc.gov.educ.studentdatacollection.api.calculator.FteCalculatorUtils;
import ca.bc.gov.educ.studentdatacollection.api.constants.v1.CollectionTypeCodes;
import ca.bc.gov.educ.studentdatacollection.api.constants.v1.FacilityTypeCodes;
import ca.bc.gov.educ.studentdatacollection.api.constants.v1.ProgramEligibilityIssueCode;
import ca.bc.gov.educ.studentdatacollection.api.constants.v1.SchoolGradeCodes;
import ca.bc.gov.educ.studentdatacollection.api.constants.v1.*;
import ca.bc.gov.educ.studentdatacollection.api.rules.ProgramEligibilityBaseRule;
import ca.bc.gov.educ.studentdatacollection.api.service.v1.ValidationRulesService;
import ca.bc.gov.educ.studentdatacollection.api.struct.StudentRuleData;
Expand Down Expand Up @@ -64,6 +61,11 @@ public List<ProgramEligibilityIssueCode> executeValidation(StudentRuleData stude
} else if (Boolean.FALSE.equals(isSchoolAged) && (isGraduated || (isAdult && isGA))) {
log.debug("ProgramEligibilityBaseRule - SpecialEducationProgramsRule: Is school aged - {}, Is non graduated adult - {}, for sdcSchoolCollectionStudentID :: {}", student.getIsSchoolAged(), student.getIsGraduated(), studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollectionStudentID());
errors.add(ProgramEligibilityIssueCode.NON_ELIG_SPECIAL_EDUCATION);
} else if(SchoolCategoryCodes.INDEPENDENTS.contains(studentRuleData.getSchool().getSchoolCategoryCode())
&& StringUtils.isNotEmpty(student.getSchoolFundingCode())
&& SchoolFundingCodes.STATUS_FIRST_NATION.getCode().equals(student.getSchoolFundingCode())) {
log.debug("ProgramEligibilityBaseRule - SpecialEducationProgramsRule: SchoolCategoryCode - {}, SchoolFundingCode - {}, for sdcSchoolCollectionStudentID :: {}", studentRuleData.getSchool().getSchoolCategoryCode(), student.getSchoolFundingCode(), studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollectionStudentID());
errors.add(ProgramEligibilityIssueCode.INDP_FIRST_NATION_SPED);
} else if(collectionType.equalsIgnoreCase(CollectionTypeCodes.FEBRUARY.getTypeCode()) && onlineFacilityCodes.contains(facilityType) &&
historicalStudents.stream().anyMatch(stu -> stu.getFte().compareTo(BigDecimal.ZERO) > 0 && stu.getSpecialEducationNonEligReasonCode() == null)) {
log.debug("ProgramEligibilityBaseRule - SpecialEducationProgramsRule: CollectionTypeCodes - {}, facilityType - {}, for sdcSchoolCollectionStudentID :: {}", collectionType, facilityType, studentRuleData.getSdcSchoolCollectionStudentEntity().getSdcSchoolCollectionStudentID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,82 @@ void testSpecialEdStudentSchoolAgedAdultGANotEligible() {
)).isTrue();
}

@Test
void testSpecialEdEligibility_INDPSchools_WithFundingCode20() {
UUID assignedStudentID = UUID.randomUUID();

var mockCollection = createMockCollectionEntity();
mockCollection.setCollectionTypeCode(CollectionTypeCodes.FEBRUARY.getTypeCode());
mockCollection.setCloseDate(LocalDateTime.now().plusDays(2));
CollectionEntity collection = collectionRepository.save(mockCollection);

SchoolTombstone school = createMockSchool();
school.setSchoolCategoryCode(SchoolCategoryCodes.INDEPEND.getCode());
UUID schoolId = UUID.fromString(school.getSchoolId());
doReturn(Optional.of(school)).when(restUtils).getSchoolBySchoolID(schoolId.toString());

var sdcSchoolCollectionEntity = createMockSdcSchoolCollectionEntity(collection, schoolId);
sdcSchoolCollectionRepository.save(sdcSchoolCollectionEntity);

val entity = this.createMockSchoolStudentEntity(sdcSchoolCollectionEntity);
entity.setAssignedStudentId(assignedStudentID);
entity.setEnrolledGradeCode("08");
entity.setSchoolFundingCode("20");

PenMatchResult penMatchResult = getPenMatchResult();
penMatchResult.getMatchingRecords().get(0).setStudentID(String.valueOf(assignedStudentID));
when(this.restUtils.getPenMatchResult(any(),any(), anyString())).thenReturn(penMatchResult);

List<ProgramEligibilityIssueCode> listWithoutEnrollmentError = rulesProcessor.processRules(
createMockStudentRuleData(
entity,
school
)
);

assertThat(listWithoutEnrollmentError.stream().anyMatch(e ->
e.equals(ProgramEligibilityIssueCode.INDP_FIRST_NATION_SPED)
)).isTrue();
}

@Test
void testSpecialEdEligibility_INDPSchools_WithFundingCode16() {
UUID assignedStudentID = UUID.randomUUID();

var mockCollection = createMockCollectionEntity();
mockCollection.setCollectionTypeCode(CollectionTypeCodes.FEBRUARY.getTypeCode());
mockCollection.setCloseDate(LocalDateTime.now().plusDays(2));
CollectionEntity collection = collectionRepository.save(mockCollection);

SchoolTombstone school = createMockSchool();
school.setSchoolCategoryCode(SchoolCategoryCodes.INDEPEND.getCode());
UUID schoolId = UUID.fromString(school.getSchoolId());
doReturn(Optional.of(school)).when(restUtils).getSchoolBySchoolID(schoolId.toString());

var sdcSchoolCollectionEntity = createMockSdcSchoolCollectionEntity(collection, schoolId);
sdcSchoolCollectionRepository.save(sdcSchoolCollectionEntity);

val entity = this.createMockSchoolStudentEntity(sdcSchoolCollectionEntity);
entity.setAssignedStudentId(assignedStudentID);
entity.setEnrolledGradeCode("08");
entity.setSchoolFundingCode("16");

PenMatchResult penMatchResult = getPenMatchResult();
penMatchResult.getMatchingRecords().get(0).setStudentID(String.valueOf(assignedStudentID));
when(this.restUtils.getPenMatchResult(any(),any(), anyString())).thenReturn(penMatchResult);

List<ProgramEligibilityIssueCode> listWithoutEnrollmentError = rulesProcessor.processRules(
createMockStudentRuleData(
entity,
school
)
);

assertThat(listWithoutEnrollmentError.stream().anyMatch(e ->
e.equals(ProgramEligibilityIssueCode.INDP_FIRST_NATION_SPED)
)).isFalse();
}

@Test
void testSpecialEdEligibilityInFebCollection() {
UUID assignedStudentID = UUID.randomUUID();
Expand Down

0 comments on commit f85516c

Please sign in to comment.