Skip to content

Commit

Permalink
Merge pull request #694 from bcgov/feature/GRAD2-2761
Browse files Browse the repository at this point in the history
GRAD2-2761: initial commit to utilize the school clob data from institute RedisCache in grad-trax-api.
  • Loading branch information
infstar authored Nov 4, 2024
2 parents 0302eff + 592de63 commit d76a1e1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@
public class School {

private String minCode;
private String schoolId;
private String schoolName;
private String districtName;
private String transcriptEligibility;
private String certificateEligibility;
private String independentDesignation;
private String mailerType;
private String address1;
private String address1;
private String address2;
private String city;
private String provCode;
private String provinceName;
private String countryCode;
private String countryName;
private String countryCode;
private String postal;
private String independentAffiliation;
private String openFlag;
private String signatureDistrict;
private String schoolCategoryCode;
private String schoolCategoryCodeInstitute;

public String getSchoolName() {
return schoolName != null ? schoolName.trim(): null;
Expand All @@ -45,26 +42,17 @@ public String getAddress2() {
public String getCity() {
return city != null ? city.trim(): null;
}

public String getProvinceName() {
return provinceName != null ? provinceName.trim(): null;
}

public String getCountryName() {
return countryName != null ? countryName.trim(): null;
}

public String getPostal() {
return postal != null ? postal.trim(): null;
}

@Override
public String toString() {
return "School [minCode=" + minCode + ", schoolName=" + schoolName + ", districtName=" + districtName
+ ", transcriptEligibility=" + transcriptEligibility + ", certificateEligibility="
+ certificateEligibility + ", independentDesignation=" + independentDesignation + ", mailerType="
+ mailerType + ", address1=" + address1 + ", address2=" + address2 + ", city=" + city + ", provCode="
+ provCode + ", provinceName=" + provinceName + ", countryCode=" + countryCode + ", countryName="
+ countryName + ", postal=" + postal + ", independentAffiliation=" + independentAffiliation +"]";
}
return "School [minCode=" + minCode + ", schoolId=" + schoolId + ", schoolCategoryCode=" + schoolCategoryCode + ", schoolCategoryCodeInstitute=" + schoolCategoryCodeInstitute
+ ", schoolName=" + schoolName + ", districtName=" + districtName + ", transcriptEligibility=" + transcriptEligibility + ", certificateEligibility=" + certificateEligibility
+ ", address1=" + address1 + ", address2=" + address2 + ", city=" + city + ", provCode=" + provCode + ", countryCode=" + countryCode + ", postal=" + postal + ", openFlag=" + openFlag
+ "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ private GradSearchStudent populateGradStudent(GradSearchStudent gradStu, String
.retrieve().bodyToMono(School.class).block();
if (school != null) {
gradStu.setSchoolOfRecordName(school.getSchoolName());
gradStu.setSchoolOfRecordindependentAffiliation(school.getIndependentAffiliation());
}
return gradStu;
}
Expand All @@ -346,7 +345,6 @@ private GradSearchStudent populateGradSearchStudent(Student student, String acce
gradStu.setTranscriptEligibility(school.getTranscriptEligibility());
gradStu.setCertificateEligibility(school.getCertificateEligibility());
gradStu.setSchoolOfRecordName(school.getSchoolName());
gradStu.setSchoolOfRecordindependentAffiliation(school.getIndependentAffiliation());
}
}
return gradStu;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,6 @@ public StudentDemographic getStudentDemographics(String pen, String accessToken)
}
}

CommonSchool commonSchool = getCommonSchool(accessToken, gradSearchStudent.getSchoolOfRecord());
if(commonSchool == null) {
validation.addErrorAndStop("Common School with mincode %s not found", gradSearchStudent.getMincode());
}

School school = getSchool(gradSearchStudent.getSchoolOfRecord(), accessToken);
if(school == null) {
validation.addErrorAndStop("School with mincode %s not found", gradSearchStudent.getMincode());
Expand Down Expand Up @@ -478,7 +473,6 @@ public StudentDemographic getStudentDemographics(String pen, String accessToken)
break;
}
}
assert commonSchool != null;
assert school != null;
return StudentDemographic.builder()
.studentID(gradSearchStudent.getStudentID())
Expand Down Expand Up @@ -510,8 +504,8 @@ public StudentDemographic getStudentDemographics(String pen, String accessToken)
.sccDate(sccDate)
.transcriptEligibility(gradSearchStudent.getTranscriptEligibility())
.mincode(school.getMinCode())
.schoolCategory(commonSchool.getSchoolCategoryCode())
.schoolType("02".equalsIgnoreCase(commonSchool.getSchoolCategoryCode()) ? "02" : "")
.schoolCategory(school.getSchoolCategoryCode())
.schoolType("02".equalsIgnoreCase(school.getSchoolCategoryCode()) ? "02" : "")
.schoolName(school.getSchoolName())
.formerStudent(formerStudent)
.build();
Expand All @@ -537,15 +531,6 @@ public List<CommonSchool> getSchools(String accessToken) {
}).block();
}

public CommonSchool getCommonSchool(String accessToken, String mincode) {
return webClient.get().uri(String.format(constants.getSchoolByMincodeSchoolApiUrl(), mincode))
.headers(h -> {
h.setBearerAuth(accessToken);
h.set(EducGradStudentApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID());
})
.retrieve().bodyToMono(CommonSchool.class).block();
}

private School getSchool(String minCode, String accessToken) {
return webClient.get()
.uri(String.format(constants.getSchoolByMincodeUrl(), minCode))
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ endpoint:
all-commonschools:
url: ${GRAD_TRAX_API}api/v1/trax/school/common
school-by-min-code:
url: ${GRAD_TRAX_API}api/v1/trax/school/%s
url: ${GRAD_TRAX_API}api/v2/trax/school-clob/%s
district-by-district-code:
url: ${GRAD_TRAX_API}api/v1/trax/district/%s
url: ${GRAD_TRAX_API}api/v2/trax/district/%s
commonschool-by-mincode:
url: ${GRAD_TRAX_API}api/v1/trax/school/common/%s

Expand Down
4 changes: 2 additions & 2 deletions api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ endpoint:
all-commonschools:
url: http://test
school-by-min-code:
url: http://test
url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/school-clob/%s
district-by-district-code:
url: http://test
url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/district/%s
commonschool-by-mincode:
url: http://test
grad-program-api:
Expand Down

0 comments on commit d76a1e1

Please sign in to comment.