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

SIMS to SFAS Bridge File - Initial Setup (Students only) #3738

Closed
18 tasks done
andrewsignori-aot opened this issue Sep 24, 2024 · 3 comments
Closed
18 tasks done

SIMS to SFAS Bridge File - Initial Setup (Students only) #3738

andrewsignori-aot opened this issue Sep 24, 2024 · 3 comments

Comments

@andrewsignori-aot
Copy link
Collaborator

andrewsignori-aot commented Sep 24, 2024

Story Description

As an SFAS system administrator, I want to receive data from SIMS to correlate with the data in SFAS. This requires creating a bridge file to communicate SIMS data to SFAS so that SFAS can enforce rules and limits in its own system.
This ticket's goal is to enable the boilerplate around schedules and initial file creation exporting only the students.

Acceptance Criteria

File Specification

  • Create a file to send to SFAS that aligns with the layout (see Business Context) in the file.
  • Each file will have the following naming structure, which will allow for multiple files per day if needed.
    • “SIMS-TO-SFAS-YYYYMMDD-HHMMSS.TXT”
      • YYYY = year of extract date
      • MM = month of extract date
      • DD = day of extract date
      • HH = hour of extract date
      • MM = minute of extract date
      • SS = second of extract date
    • Eg: “SIMS-TO-SFAS-20240205-153236.TXT”
  • The destination of the file will be on the SIMS SFTP server, in the /OUT folder.
  • The bridge file will be a flat text file encoded in ASCII.
  • The job will be run from a queue every 4 hours, schedule should be modifiable, time starting at midnight.
  • Field formatting:
    • Dates: All dates will use the format yyyymmdd
    • Dollars: All dollar amounts will but 10 digits long with the last 2 digits representing cents, e.g. “0000080000” for $800.00
  • Do not include MSFAA Number or Signed date (PT or FT) - leave fields blank for now.
  • When there are NO records to send, do not send the bridge file and wait until next scheduled time to send.

Records to Include

  • Include student as a record on this file if one of below conditions are met since the last execution of this file:
    • Only send after student submits application AND any time a new record is inserted or an existing record is updated in any of the table that contain the fields in the bridge file.

Business Context

Full File Specifications and Ongoing Comments https://bcgov.sharepoint.com/:w:/r/teams/00371/Shared%20Documents/General/b)%20Development%20and%20Testing/SIMS%20Business%20Requirements/Under%20Development%20Requirements/SIMS%20to%20SFAS%20Data%20Bridge.docx?d=w588bf9022725400f998ea8cce1c27448&csf=1&web=1&e=JvpAU1

Technical

  • Enable the new file integration under libs\integrations\src\sfas-integration.
    • There is already a file to read SFAS files from the SFTP (sfas-integration.processing.service.ts), create a new processing service dedicated to generating the file.
  • Create a new scheduler to generate the new files.
  • Query the data for students records. The data will use at least the below tables.
    • sims.users;
    • sims.students;
    • sims.sin_validations;
    • sims.cas_suppliers;
    • sims.msfaa_numbers (one record for Part-time and one for Full-time if present);
    • sims.disbursement_overawards.....
  • Persist the timestamp of the last time a file was generated to retrieve only the delta changes.
    • A new table can be created.
      • Name: sims.sfas_bridge_log
        • reference_date (timestamp): date of the file generation.
        • generated_file: generated file name.
  • Do "best effort" to map all the required data in the documentation. The ones not possible should receive blank characters for now. A field is considered "not possible to be mapped" when the Team is not able to find it.
    • Add comments to the document on every field that will not be mapped due to some unknown.
  • Final E2E tests are not part of this effort but it would be acceptable to some sort of automation that would make it easier for the development.
@andrewsignori-aot andrewsignori-aot changed the title Copy of SIMS to SFAS Bridge File SIMS to SFAS Bridge File - Initial Setup (Students only) Sep 24, 2024
@andrewsignori-aot andrewsignori-aot removed the Dev & Architecture Development and Architecture label Sep 26, 2024
@CarlyCotton CarlyCotton self-assigned this Oct 2, 2024
@dheepak-aot dheepak-aot self-assigned this Oct 4, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 11, 2024
# SIMS To SFAS Bridge DB Migrations and Scheduler Setup

## DB Migration
- DB Migration to create new table `sims.sfas_bridge_logs` (Table name
modified to plural and the column for file name little different in
comparison with technical AC).
- The table `sims.sfas_bridge_logs` has only creation respective audit
columns as it is never expected to receive update.
- DB migration to add the new scheduler `sims-to-sfas-integration`. It
is scheduled to run at `12:00 AM 4:00 AM 8:00 AM 12:00 PM 12:00 AM 4:00
PM 8:00 AM` with cron expression `0 0,4,8,12,16,20 * * *`
- Added Enum and other dependencies to enable the scheduler.

## Rollback Evidence


![image](https://github.com/user-attachments/assets/22100671-009e-4039-9e8a-a22c507d2347)


![image](https://github.com/user-attachments/assets/78fe1f23-fb45-491c-b5af-3c439c6f0b05)
@CarlyCotton
Copy link
Collaborator

@dheepak-aot Based on our conversation and the confirmation I have received from SFAS team, I have added an AC:

  • Do not include MSFAA Number or Signed date (PT or FT) - leave fields blank for now.

@CarlyCotton
Copy link
Collaborator

@dheepak-aot Based on our conversation, I have added an AC to clarify the expectation for when we have 0 records to send when it's scheduled. The expectation is that we WONT send a file if there are no records to send. (Confirmed with HJ confirmed via email 2024-10-22 that this is fine.

github-merge-queue bot pushed a commit that referenced this issue Oct 28, 2024
# SIMS TO SFAS - INTEGRATION IMPLEMENTATION FOR STUDENT DATA RECORDS

## ENV

- [x] Added a new env variable `SFAS_SEND_FOLDER`. Declared it as github
env, not as secret.

## PROCESS
- [x] File generated with following name structure
`SIMS-TO-SFAS-YYYYMMDD-HHMMSS.TXT`

![image](https://github.com/user-attachments/assets/39411500-a070-4bf4-a0dc-d312a3e450e0)

- [x] Student data is retrieved to build the file for all students who
has one or more of the following updates since last run date.
    - Student or User data
    - Sin validation data
    - Cas supplier data
    - Overawards data

- [x] Students with at least one submitted application are considered to
extract the data. As submitted applications can be cancelled and also
the Draft applications can be cancelled, application status NOT Draft
could be tricky. So used the condition of application with current
assessment NOT NULL to identify a submitted application.
- [x] When one or more students with updates are present, then a file is
produced and sent to SFAS SFTP location.
**Summary:**

![image](https://github.com/user-attachments/assets/11b9ff5d-3dbf-44ca-9989-c7899ba104c9)

**Process Logs:**

![image](https://github.com/user-attachments/assets/7ec7ef8a-0ddf-41e9-a767-5003637864c3)

- [x] When no students with updates are present, then no file is
produced.

**Summary:**

![image](https://github.com/user-attachments/assets/4a43e594-a262-4841-ae4e-5dbd7d46f75d)

**Process Logs:**
 

![image](https://github.com/user-attachments/assets/326c2561-e17d-484c-a3cc-c61a608fe73c)

## TECHNICAL CONTEXT

- STEPS involved in creation of the bridge data file

```
STEP 1 [Implemented]: Get the reference date of last bridge file sent. If there is no bridge file sent, it is null.

STEP 2 [Implemented]: Get all the student ids of students who has one or more student data related change since last bridge file date.

STEP 3 [TODO]: Get all the student ids and application details of students who has one or more application data related change since last bridge file date.

STEP 4 [TODO]: Get all the student ids and restriction details of students who has one or more restriction data related change since last bridge file date.

STEP 5 [Partially Implemented]: Consolidate all the studentIds produced in STEPS 2,3 and 4. 

STEP 6 [Partially Implemented]: Get student details of students who has one or more student data related change using consolidated studentIds.

STEP 7 [Implemented]: Build header, footer and student records for file lines.

STEP 8 [TODO]: Build application records and restriction records for file lines.

STEP 9[Implemented]: Upload the file to SFTP and create bridge file log.

```

- For future implementations and areas, search for `TODO: SIMS to SFAS`
in the code.
github-merge-queue bot pushed a commit that referenced this issue Oct 29, 2024
# SIMS TO SFAS E2E TESTS

## TEST SCENARIOS

- [x] Created a test to validate the file generation when there is a
student data update, between the most recent bridge file date and
current bridge execution date.
- [x] Created a test to validate no generation of bridge file, when
there is an update on student data but the student does not have any
submitted application.


![image](https://github.com/user-attachments/assets/3f7fa224-b7c4-4f37-a1d9-9407987e4840)


## New Library for mocking the current date retuned by the code

- To mock the current date(`new Date()`) returned, a new library
[mockdate](https://www.npmjs.com/package/mockdate) has been added.
@dheepak-aot
Copy link
Collaborator

dheepak-aot commented Oct 29, 2024

To Support QA:

Records Validation

Header Length: 61

Student Data Record Length: 164

Footer Length: 12


Index position Student Data:

Record Type: 1-4

Student ID: 4-14

Student Given Name: 14-29

Student Last Name: 29-54

Student Birth Date: 54-62

Student SIN: 62-71

Student PD Status: 71-72

PD Effective Date: 72-80

Student PPD Status: 80-81

PPD Effective Date: 81-89

--- Blank Fields ----

FT MSFAA Number: 89-99

FT MSFAA Signed Date: 99-107

PT MSFAA Number: 107-117

PT MSFAA Signed Date: 117-125

----- end Blank fields ---

CAS Supplier Number: 125-132

CAS Supplier Site Number: 132-135

FT CSL Overaward: 135-145

FT BCSL Overaward: 145-155

---Blank Field-----
Grant Overaward - 155-165

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants