Skip to content

#5841 - Update Federal Restriction Process - POC#5940

Draft
andrewsignori-aot wants to merge 3 commits intomainfrom
feature/fed-restrictions-poc
Draft

#5841 - Update Federal Restriction Process - POC#5940
andrewsignori-aot wants to merge 3 commits intomainfrom
feature/fed-restrictions-poc

Conversation

@andrewsignori-aot
Copy link
Copy Markdown
Collaborator

@andrewsignori-aot andrewsignori-aot commented Mar 21, 2026

Initial analysis to improve the memory consumption for federal restrictions processing.

TL;DR;

  • Changed the federal-restrictions-integration to stream the data from STFP, while unzipping it and saving directly into sims.federal_restrictions.
  • Main method for this POC: SFTPIntegrationBase.streamResponseFileLines.

Local Tests

  • Changed queue-consumers locally to execute only federal-restrictions-integration queue.
  • Executed the current process and measured until the moment the file was downloaded, unzipped, and parsed (no records inserted).
  • Adapted a new process as follows.
    • Changed the method reading the file from the SFTP to create a readable stream.
    • Changed the zip lib to another with stream capabilities. Did not invest much time looking for alternatives, just used the first one that I found for now.
    • Used the native node lib readline to read each line of the stream.
    • Once a line is read, allow a callback to be invoked, allowing "a code" to process the read line.
    • Created a callback to insert the parsed record directly into the table, delaying some processes, for instance, the creation of missing restriction codes.

Current PROD Process (downloaded, unzipped, and parsed with no records inserted)

image

New proposed process (downloaded, unzipped, parsed, and inserted)

image

@andrewsignori-aot andrewsignori-aot self-assigned this Mar 21, 2026
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 20.12% ( 4581 / 22765 )
Methods: 9.47% ( 262 / 2768 )
Lines: 24.5% ( 3933 / 16053 )
Branches: 9.79% ( 386 / 3944 )

@github-actions
Copy link
Copy Markdown

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 47.94% ( 2716 / 5666 )
Methods: 38.1% ( 285 / 748 )
Lines: 54.7% ( 2053 / 3753 )
Branches: 32.45% ( 378 / 1165 )

@github-actions
Copy link
Copy Markdown

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 79.21% ( 9158 / 11561 )
Methods: 78.42% ( 1181 / 1506 )
Lines: 82.6% ( 6884 / 8334 )
Branches: 63.51% ( 1093 / 1721 )

@github-actions
Copy link
Copy Markdown

E2E SIMS API Coverage Report

Totals Coverage
Statements: 65.51% ( 12999 / 19842 )
Methods: 62.3% ( 1527 / 2451 )
Lines: 69.13% ( 9435 / 13648 )
Branches: 54.42% ( 2037 / 3743 )

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant