Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LAHI Student sync filter not working as designed #118

Open
himeshr opened this issue Jan 24, 2024 · 0 comments
Open

LAHI Student sync filter not working as designed #118

himeshr opened this issue Jan 24, 2024 · 0 comments
Labels
bug Something isn't working LAHI

Comments

@himeshr
Copy link

himeshr commented Jan 24, 2024

LAHI Student sync filter to avoid update of previously synced Students to Avni is not working as designed.

As part of LAHI Student sync from Glific to Avni, we are required to filter out update of Students that have been previously synced to Avni based on FirstName, LastName, Gender, DOB, Father'sName and PhoneNumber criteria.

We achieve this through AvniStudentRepository.findMatchingStudents(), which seems to always return 0 (zero) matches. Resulting in system going ahead and attempting save of the student. We need to fix this filter.

    public List<Subject> findMatchingStudents(Subject subject) {
        LinkedHashMap<String, Object> subjectSearchCriteria = new LinkedHashMap<>();
        subjectSearchCriteria.put(CONTACT_PHONE_NUMBER, subject.getObservation(CONTACT_PHONE_NUMBER));
        Subject[] subjects = avniSubjectRepository.getSubjects(STUDENT_SUBJECT_TYPE, subjectSearchCriteria);
        return Arrays.stream(subjects).filter(x -> ObjectUtil.nullSafeEqualsIgnoreCase(x.getFirstName(), subject.getFirstName())
                && ObjectUtil.nullSafeEqualsIgnoreCase(x.getLastName(), subject.getLastName())
                && ObjectUtil.nullSafeEqualsIgnoreCase(x.getGender(), subject.getGender())
                && ObjectUtil.nullSafeEqualsIgnoreCase(x.getDateOfBirth(), subject.getDateOfBirth())
                && ObjectUtil.nullSafeEqualsIgnoreCase(x.getObservation(FATHERS_NAME_CONCEPT), subject.getObservation(FATHERS_NAME_CONCEPT))

        ).collect(Collectors.toList());
    }

Integration-service logs:

2024-01-24 05:50:00,000 INFO  SpringTaskScheduler-17 [lahi.job.AvniLahiMainJob] Lahi Main Job Started
2024-01-24 05:50:00,461 INFO  SpringTaskScheduler-17 [lahi.service.LahiStudentService] Getting students since 2024-01-20 13:05:19.0
2024-01-24 05:50:02,965 DEBUG SpringTaskScheduler-17 [avni.client.AvniHttpClient] GET https://app.avniproject.org/api/subjects?lastModifiedDateTime=1900-01-01T00:00:00.000Z&concepts=%7B%22Student%20contact%20number%22:%229766801808%22%7D&subjectType=Student
2024-01-24 05:50:02,973 DEBUG SpringTaskScheduler-17 [avni.client.AvniHttpClient] Getting cognito details
2024-01-24 05:50:14,689 INFO  SpringTaskScheduler-17 [avni.client.AvniHttpClient] POST: /api/subject
2024-01-24 05:50:14,689 DEBUG SpringTaskScheduler-17 [avni.client.AvniHttpClient] POST https://app.avniproject.org/api/subject
2024-01-24 05:50:16,508 INFO  SpringTaskScheduler-17 [lahi.service.LahiIntegrationDataService] Updating integrating_entity_status with Sat Jan 20 13:05:19 UTC 2024 date
2024-01-24 05:50:16,508 INFO  SpringTaskScheduler-17 [avni_integration_service.util.HealthCheckService] Health check ping for slug:lahi status: SUCCESS
2024-01-24 05:50:16,641 INFO  SpringTaskScheduler-17 [lahi.job.AvniLahiMainJob] Lahi Main Job Ended
@himeshr himeshr added the bug Something isn't working label Jan 24, 2024
@github-project-automation github-project-automation bot moved this to New Issues in Avni Product Jan 24, 2024
@himeshr himeshr added the LAHI label Jan 24, 2024
@himeshr himeshr moved this from New Issues to Analysis Complete in Avni Product Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LAHI
Projects
Status: Analysis Complete
Development

No branches or pull requests

1 participant