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

#2001 - Changes to handle PD PPD Part 2 #2121

Merged
merged 7 commits into from
Jul 21, 2023

Conversation

dheepak-aot
Copy link
Collaborator

@dheepak-aot dheepak-aot commented Jul 20, 2023

Handle PD PPD requests Part 2

  • Renamed PD status to disability in all possible occurrence
  • Updated ATBC service and ATBC Response processing service as per the new ATBC response API
  • As of now we are not sure on how to read the declined status and hence we are not updating the declined status for student who applied for disability. Updated the same to the ticket.
  • Created E2E tests.

image

  • After cleaning up the local database with data seed cleanup script, migrations fail to run due to pg_trgm package already exists. Hence in data seed cleanup added a script to remove the package during delete database.

@dheepak-aot dheepak-aot self-assigned this Jul 20, 2023
@dheepak-aot dheepak-aot marked this pull request as ready for review July 20, 2023 17:32
expect(ppdReceivedStudent.disabilityStatus).toBe(DisabilityStatus.PPD);
expect(
formatDate(ppdReceivedStudent.studentPDUpdateAt, ATBC_DATE_FORMAT),
).toBe(ppdResponse.D8Y_DTE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done 👍

@@ -8,5 +8,6 @@ export class CleanDatabase {
async cleanDatabase(): Promise<void> {
// Drops the database and all its data.It will erase all your database tables and their data.
await this.dataSource.dropDatabase();
await this.dataSource.query("DROP EXTENSION pg_trgm");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have something like this below ? to avoid errors if the extension is not exists?
await dataSource.query("DROP EXTENSION IF EXISTS pg_trgm");

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get your point @guru-aot . But we devs recently decided to stop using the IF EXISTS and ID NOT EXISTS to be aware of the side effects and handle them. That was the reason why I avoided.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that @dheepak-aot, I am not going to stress on this but for this exceptional scenario, I was validating if we need it or not

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a decision to stop using the IF EXISTS for migrations because it is a controlled script execution where the up/down must be precise and if it is changing something the changed item (column/index/whatever) should be there.
For this situation, the same may not be applied, for instance, if executing the clean database twice will make the second execution fail.

lastName: string;
birthDate: Date;
disabilityStatus: DisabilityStatus;
disabilityStatusUpdatedDate: Date;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asking this again for clarification, the disabilityStatusUpdatedDate is an replacement of both created and updated date right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. The disabilityStatusUpdatedDate is the property which is intended to update the pd_date_update eventually.
Both created and updated date still exist and we are not removing them now as a part of the ticket.

@@ -8,5 +8,6 @@ export class CleanDatabase {
async cleanDatabase(): Promise<void> {
// Drops the database and all its data.It will erase all your database tables and their data.
await this.dataSource.dropDatabase();
await this.dataSource.query("DROP EXTENSION pg_trgm");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}));
let updatedDisabilityStatusCount = 0;
this.logger.log(
`Processing disability status requests for ${studentsToUpdate.length} students`,
Copy link
Collaborator

@guru-aot guru-aot Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a suggestion, not a show stopper or part of your PR, to handle, both the variety of logs generated below:

Processing disability status requests for 1 student

Processing disability status requests for 2 students

It would be better to have the student(s) in the logger.

id: number;
sin: string;
}
export const ATBC_DATE_FORMAT = "YYYY/MM/DD";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain, why we are not having the ATBC_DATE_FORMAT const in the backend/libs/utilities/src/date-utils.ts? Is there a reason, that it is created here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we never store the integration/external application specific date formats in date-utils.

for e.g. ECE integration model

image

* @param birthDate birth date.
* @returns student.
*/
async getStudentBySINAndLastNameAndBirthDate(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO just a suggestion, the method name can be called as findStudentByPersonalInfo or getStudentByPersonalInfo. seems to be a big method name with 2 ANDs

export function createFakeStudent(user?: User): Student {
export function createFakeStudent(
user?: User,
options?: { initialValue: Partial<Student> },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great to see the methods createFakeStudent and saveFakeStudent are enhancing like anything with the functionalities we create.

Copy link
Collaborator

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with review, very minor comments and doubts. Please have a look.

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work @dheepak-aot. added some comments

@@ -37,17 +36,11 @@ export class ATBCResponseIntegrationScheduler extends BaseScheduler<void> {
appLogger: this.logger,
jobLogger: job,
});
await summary.info("Processing PD status for students.");
await summary.info("Processing disability status for students.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@ann-aot ann-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing the changes @dheepak-aot 👍 Looks good to me

@github-actions
Copy link

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 17.87% ( 2134 / 11940 )
Methods: 8.29% ( 126 / 1520 )
Lines: 20.67% ( 1870 / 9047 )
Branches: 10.05% ( 138 / 1373 )

@github-actions
Copy link

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 49.81% ( 267 / 536 )
Methods: 41.56% ( 32 / 77 )
Lines: 55.33% ( 218 / 394 )
Branches: 26.15% ( 17 / 65 )

@github-actions
Copy link

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 72.5% ( 406 / 560 )
Methods: 63.38% ( 45 / 71 )
Lines: 74.53% ( 357 / 479 )
Branches: 40% ( 4 / 10 )

@github-actions
Copy link

E2E SIMS API Coverage Report

Totals Coverage
Statements: 52.23% ( 3716 / 7115 )
Methods: 48.59% ( 448 / 922 )
Lines: 57.36% ( 3045 / 5309 )
Branches: 25.23% ( 223 / 884 )

Copy link
Collaborator

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work @dheepak-aot

@dheepak-aot dheepak-aot merged commit 66403ce into main Jul 21, 2023
@dheepak-aot dheepak-aot temporarily deployed to DEV July 21, 2023 19:32 — with GitHub Actions Inactive
@dheepak-aot dheepak-aot temporarily deployed to DEV July 21, 2023 19:34 — with GitHub Actions Inactive
@dheepak-aot dheepak-aot temporarily deployed to DEV July 21, 2023 19:34 — with GitHub Actions Inactive
@dheepak-aot dheepak-aot temporarily deployed to DEV July 21, 2023 19:34 — with GitHub Actions Inactive
@dheepak-aot dheepak-aot temporarily deployed to DEV July 21, 2023 19:34 — with GitHub Actions Inactive
@dheepak-aot dheepak-aot temporarily deployed to DEV July 21, 2023 19:35 — with GitHub Actions Inactive
@dheepak-aot dheepak-aot temporarily deployed to DEV July 21, 2023 19:35 — with GitHub Actions Inactive
@dheepak-aot dheepak-aot deleted the enhancement/#2001-pd-ppd-changes-part-2 branch August 1, 2023 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants