Skip to content

Commit

Permalink
Merge pull request #1492 from bcgov/feature/febReports
Browse files Browse the repository at this point in the history
Changes for feb versions of special ed headcount reports
  • Loading branch information
SodhiA1 authored Jan 13, 2025
2 parents 112ecef + 8914629 commit 95bf722
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,46 @@ AND SSCS.enrolledGradeCode NOT IN ('08', '09')
"ORDER BY s.sdcSchoolCollection.schoolID")
List<IndySpecialEdAdultHeadcountResult> getSpecialEdCategoryForIndiesAndOffshoreByCollectionId(UUID collectionID);

@Query("SELECT " +
"s.sdcSchoolCollection.schoolID AS schoolID, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('A', 'B') THEN 1 END) AS levelOnes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('C', 'D', 'E', 'F', 'G') THEN 1 END) AS levelTwos, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('H') THEN 1 END) AS levelThrees, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('K', 'P', 'Q', 'R') THEN 1 END) AS otherLevels, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'A' THEN 1 END) AS specialEdACodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'A' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdA, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'B' THEN 1 END) AS specialEdBCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'B' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdB, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'C' THEN 1 END) AS specialEdCCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'C' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdC, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'D' THEN 1 END) AS specialEdDCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'D' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdD, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'E' THEN 1 END) AS specialEdECodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'E' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdE, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'F' THEN 1 END) AS specialEdFCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'F' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdF, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'G' THEN 1 END) AS specialEdGCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'G' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdG, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'H' THEN 1 END) AS specialEdHCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'H' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdH, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'K' THEN 1 END) AS specialEdKCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'K' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdK, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'P' THEN 1 END) AS specialEdPCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'P' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdP, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'Q' THEN 1 END) AS specialEdQCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'Q' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdQ, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'R' THEN 1 END) AS specialEdRCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'R' AND s.isAdult = true THEN 1 END) > 0 AS adultsInSpecialEdR, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'K', 'P', 'Q', 'R') THEN 1 END) AS allLevels " +
"FROM SdcSchoolCollectionStudentEntity s " +
"WHERE s.sdcSchoolCollection.collectionEntity.collectionID = :collectionID " +
"AND s.sdcSchoolCollection.sdcDistrictCollectionID is null " +
"AND s.sdcSchoolCollectionStudentStatusCode NOT IN ('ERROR', 'DELETED') " +
"AND s.specialEducationNonEligReasonCode IS NULL " +
"GROUP BY s.sdcSchoolCollection.schoolID " +
"ORDER BY s.sdcSchoolCollection.schoolID")
List<IndySpecialEdAdultHeadcountResult> getSpecialEdCategoryForIndiesAndOffshoreFebruaryByCollectionId(UUID collectionID);

@Query("SELECT " +
"s.sdcSchoolCollection.schoolID AS schoolID, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('A', 'B') AND s.fte > 0 THEN 1 END) AS levelOnes, " +
Expand Down Expand Up @@ -1209,6 +1249,34 @@ AND SSCS.enrolledGradeCode NOT IN ('08', '09')
"ORDER BY s.sdcSchoolCollection.schoolID")
List<SpecialEdHeadcountResult> getSpecialEdHeadcountsByCollectionId(@Param("collectionID") UUID collectionID);

@Query("SELECT " +
"s.sdcSchoolCollection.schoolID AS schoolID, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('A', 'B') THEN 1 END) AS levelOnes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'A' THEN 1 END) AS specialEdACodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'B' THEN 1 END) AS specialEdBCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('C', 'D', 'E', 'F', 'G') THEN 1 END) AS levelTwos, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'C' THEN 1 END) AS specialEdCCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'D' THEN 1 END) AS specialEdDCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'E' THEN 1 END) AS specialEdECodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'F' THEN 1 END) AS specialEdFCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'G' THEN 1 END) AS specialEdGCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('H') THEN 1 END) AS levelThrees, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'H' THEN 1 END) AS specialEdHCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('K', 'P', 'Q', 'R') THEN 1 END) AS otherLevels, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'K' THEN 1 END) AS specialEdKCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'P' THEN 1 END) AS specialEdPCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'Q' THEN 1 END) AS specialEdQCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode = 'R' THEN 1 END) AS specialEdRCodes, " +
"COUNT(CASE WHEN s.specialEducationCategoryCode IN ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'K', 'P', 'Q', 'R') THEN 1 END) AS allLevels " +
"FROM SdcSchoolCollectionStudentEntity s " +
"WHERE s.sdcSchoolCollection.collectionEntity.collectionID = :collectionID " +
"AND s.sdcSchoolCollectionStudentStatusCode NOT IN ('ERROR', 'DELETED') " +
"AND s.sdcSchoolCollection.sdcDistrictCollectionID is null " +
"AND s.specialEducationNonEligReasonCode IS NULL " +
"GROUP BY s.sdcSchoolCollection.schoolID " +
"ORDER BY s.sdcSchoolCollection.schoolID")
List<SpecialEdHeadcountResult> getSpecialEdHeadcountsFebruaryByCollectionId(@Param("collectionID") UUID collectionID);

@Query(value = """
SELECT sscs.sdcSchoolCollection.schoolID as schoolID,
sscs.homeLanguageSpokenCode as spokenLanguageCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,19 @@ private DownloadableReportResponse generateSeptFsaCsv(UUID collectionID) {

// Independent School Inclusive Education Headcounts report
public DownloadableReportResponse generateIndySpecialEducationHeadcounts(UUID collectionID) {
List<IndySpecialEdAdultHeadcountResult> results = sdcSchoolCollectionStudentRepository.getSpecialEdCategoryForIndiesAndOffshoreByCollectionId(collectionID);
var collectionOpt = collectionRepository.findById(collectionID);
if(collectionOpt.isEmpty()){
throw new EntityNotFoundException(Collection.class, COLLECTION_ID, collectionID.toString());
}

List<IndySpecialEdAdultHeadcountResult> results;

if(Objects.equals(collectionOpt.get().getCollectionTypeCode(), CollectionTypeCodes.FEBRUARY.getTypeCode())){
results = sdcSchoolCollectionStudentRepository.getSpecialEdCategoryForIndiesAndOffshoreFebruaryByCollectionId(collectionID);
} else {
results = sdcSchoolCollectionStudentRepository.getSpecialEdCategoryForIndiesAndOffshoreByCollectionId(collectionID);
}

CSVFormat csvFormat = CSVFormat.DEFAULT.builder()
.setHeader(
IndySpecialEducationHeadcountHeader.AUTHORITY_NUMBER.getCode(), IndySpecialEducationHeadcountHeader.AUTHORITY_NAME.getCode(),
Expand Down Expand Up @@ -464,7 +471,7 @@ public DownloadableReportResponse generateIndySpecialEducationHeadcounts(UUID co

// Independent School Inclusive Education Funding Headcounts report
public DownloadableReportResponse generateIndySpecialEducationFundingHeadcounts(UUID collectionID) {
List<SpecialEdHeadcountResult> collectionRawData = sdcSchoolCollectionStudentRepository.getSpecialEdHeadcountsByCollectionId(collectionID);
List<SpecialEdHeadcountResult> collectionRawData = sdcSchoolCollectionStudentRepository.getSpecialEdHeadcountsFebruaryByCollectionId(collectionID);
var mappedSeptData = getLastSeptCollectionSchoolMap(collectionID);

CSVFormat csvFormat = CSVFormat.DEFAULT.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,19 @@ public SimpleHeadcountResultsTable getIndySchoolsEnrollmentHeadcounts(UUID colle

// Independent School Inclusive Education Headcounts report
public SimpleHeadcountResultsTable getSpecialEducationHeadcountsForIndependentsByCollectionID(UUID collectionID) {
List<IndySpecialEdAdultHeadcountResult> collectionRawData = sdcSchoolCollectionStudentRepository.getSpecialEdCategoryForIndiesAndOffshoreByCollectionId(collectionID);
Optional<CollectionEntity> collectionOpt = collectionRepository.findById(collectionID);
if(collectionOpt.isEmpty()) {
throw new EntityNotFoundException(CollectionEntity.class, COLLECTION_ID, collectionID.toString());
}

List<IndySpecialEdAdultHeadcountResult> collectionRawData;

if(Objects.equals(collectionOpt.get().getCollectionTypeCode(), CollectionTypeCodes.FEBRUARY.getTypeCode())){
collectionRawData = sdcSchoolCollectionStudentRepository.getSpecialEdCategoryForIndiesAndOffshoreFebruaryByCollectionId(collectionID);
} else {
collectionRawData = sdcSchoolCollectionStudentRepository.getSpecialEdCategoryForIndiesAndOffshoreByCollectionId(collectionID);
}

SimpleHeadcountResultsTable resultsTable = new SimpleHeadcountResultsTable();
var headerList = new ArrayList<String>();
for (IndySpecialEducationHeadcountHeader header : IndySpecialEducationHeadcountHeader.values()) {
Expand Down Expand Up @@ -215,7 +227,7 @@ public SimpleHeadcountResultsTable getSpecialEducationHeadcountsForIndependentsB

// Independent School Inclusive Education Funding Headcounts report
public SimpleHeadcountResultsTable getSpecialEducationFundingHeadcountsForIndependentsByCollectionID(UUID collectionID) {
List<SpecialEdHeadcountResult> collectionRawData = sdcSchoolCollectionStudentRepository.getSpecialEdHeadcountsByCollectionId(collectionID);
List<SpecialEdHeadcountResult> collectionRawData = sdcSchoolCollectionStudentRepository.getSpecialEdHeadcountsFebruaryByCollectionId(collectionID);
var mappedSeptData = getLastSeptCollectionSchoolMap(collectionID);

SimpleHeadcountResultsTable resultsTable = new SimpleHeadcountResultsTable();
Expand Down

0 comments on commit 95bf722

Please sign in to comment.