Skip to content

Conversation

@dustbuster
Copy link
Contributor

@dustbuster dustbuster commented Nov 28, 2025

I'm not gonna merge this yet, needs testing on ephemeral first.

Just wrapping up the unit tests... SO still kinda WIP but almost there.

Got a localstack UI Path Lambda working.
This takes a base64 encoded file and uses generative AI to abstract values

Screenshot 2025-12-08 at 13 53 05

@demos-git-service-account
Copy link
Contributor

demos-git-service-account commented Nov 28, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

This is untested, but it does run locally with npm run execute
@github-actions github-actions bot added spike Spike / research task. infra Relates to infrastructure or DevOps. labels Dec 1, 2025
Copy link
Contributor

@james-becwar-cms james-becwar-cms left a comment

Choose a reason for hiding this comment

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

Lets get this running on an ephemeral env before merge. Regarding the db and s3 stuff not sure if you wanted to do it now, or in a new ticket.


## Lambda usage
- Handler: `index.handler`
- Trigger: SQS message body must contain `{ "s3Key": "<path/to/file>" }`
Copy link
Contributor

Choose a reason for hiding this comment

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

the S3key will be make future quarries kind of weird, you would have to search the db's document table where the path is equal to the path in the sqs message. I would pass the PK, the document id. Once we have the questions and models, we will have to pull the file type, and application id, questions for that file type, and fields to update from the db.

}

export async function extractDoc(token: string, docId: string): Promise<string> {
const extractorGuid = getExtractorGuid(); // NOTE: Zoe might make her own. So we may need to query here to get the right GUID
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good idea. I think its going to be a different model based on the file type.

Comment on lines +33 to +40
const activeQuestionBlobs: ExtractionPrompt[] = [
{
id: "State",
question: "What state is this 1115 waver for?",
fieldType: "Text",
multiValued: false,
},
];
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future these will need to be pulled from the db based on file type.

const url = `${UIPATH_BASE_URL}/${UIPATH_TENANT}/du_/api/framework/projects/${projectId}/digitization/start`;
log.info({ url }, "Uploading document to UiPath");
const formData = new FormData();
formData.append("file", fs.createReadStream(fileName), fileName);
Copy link
Contributor

Choose a reason for hiding this comment

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

The file won't be local on the lambda, so I don't think this will work.

throw new Error("Missing s3Key in SQS message body.");
}

const status = await runDocumentUnderstanding(inputFile, {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be smart to pull the file from S3 before we started the DU stuff.

const {
token: providedToken,
pollIntervalMs = 3000,
maxAttempts = 500, // Just to put SOME kinda limit on it. DO not want it just running FOREVER!
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can remove this as AWS will kill the lambda at 15 minutes. (500 tries at 3 seconds > 15 minutes)

@github-actions github-actions bot added the client Relates to the client. label Dec 9, 2025
@dustbuster dustbuster dismissed james-becwar-cms’s stale review December 10, 2025 17:18

Not merging anyway yet.

@dustbuster dustbuster marked this pull request as draft December 10, 2025 17:18
@dustbuster
Copy link
Contributor Author

Made this a draft for the moment, want to get this on ephemeral.

@dustbuster dustbuster marked this pull request as ready for review December 11, 2025 16:45
@dustbuster
Copy link
Contributor Author

I made this ready for review. but really i just want to the pipes to run when i push.
But its not approved. so let's just leave un-approved for now. I really do not want to merge this without @cms-jesse looking at it.

@dustbuster dustbuster changed the title Demos 1197 initial UI path lambda Demos 1197 UI path lambda Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Relates to the client. DO NOT MERGE infra Relates to infrastructure or DevOps. lambda spike Spike / research task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants