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

Main Readme #47

Merged
merged 5 commits into from
Mar 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 71 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,78 @@
[![MegaLinter](https://github.com/flexion/document-extractor-poc/actions/workflows/megalinter.yml/badge.svg)](https://github.com/flexion/document-extractor-poc/actions/workflows/megalinter.yml)
<!--
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/flexion/document-extractor-poc/badge)](https://scorecard.dev/viewer/?uri=github.com/flexion/document-extractor-poc)
-->

# Document Extractor Proof of Concept

![document_uploader_poc drawio](docs/document_uploader_poc.drawio.png)
Public Benefits Studio's Document Extractor to automate document data extraction with AI and OCR.

## Using and Running

Using your browser of choice, navigate to the CloudFront distribution URL to start using.

## Development

### Requirements to Deploy

The requirements needed to deploy are...

- [Python](https://docs.python-guide.org/starting/installation/).
- [uv](https://docs.astral.sh/uv/).
- [Terraform](https://www.terraform.io).
- [Node.js](https://nodejs.org).
- An [AWS](https://aws.amazon.com/) account.

### Deploying

You can mimic the steps in our [Continuous Delivery GitHub Action](.github/workflows/cd.yml).

The basic steps to accomplish this are...
1. Build the backend.
2. Build the frontend.
3. Deploy using the Infrastructure as Code (IaC).

### Building

#### Backend

To build the backend, execute...

```shell
cd ./backend/
uv sync
uv run build.py
```

The built artifact is `backend/dist/lambda.zip`.

#### Frontend

To build the frontend, execute...

```shell
cd ./ui/
npm ci
npm run build
```

The built artifact is in `ui/dist/`.

### Additional Requirements to Develop

The additional requirements needed to contribute towards development are...

- [Pre-Commit](https://pre-commit.com).

### Running Locally

[source](https://drive.google.com/file/d/1Ev9UzL8j8pEjpyM0r93MwGahs8yXCajJ/view?usp=drive_link) in [Draw.io](https://draw.io/)
_To be implemented_.

### Pre-Commit Hooks

## Testing `uploadFileForTextExtractor` in AWS Console
We use [`pre-commit`](https://pre-commit.com) to run [some hooks](.pre-commit-config.yaml) on every commit. These
hooks do linting to ensure things are in a good spot before a commit is made. Please install `pre-commit` and then
install the hooks.

1. **Open AWS Lambda** → Select **`uploadFileForTextExtractor`**.
2. **Go to Test Tab** → Click **Create new test event**.
3. **Enter Event Name** → Use `"TestUploadFile"`.
4. **Paste JSON Payload**:
```shell
pre-commit install
```

```
{
"body": "{\"file_content\": \"<base64-encoded-content>\", \"file_name\": \"test-file.txt\"}"
}
```
5. Save & Run Test → Click Test
Most of the time any errors encountered by pre-commit are automatically fixed. Run `git status` to see the fixed files,
run `git add .` to add the fixes, and rerun the commit. You will need to manually fix any errors that are not
automatically fixed.
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "package.json",
"version": "1.0.0",
"description": "[![MegaLinter](https://github.com/flexion/document-extractor-poc/actions/workflows/megalinter.yml/badge.svg)](https://github.com/flexion/document-extractor-poc/actions/workflows/megalinter.yml) <!-- [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/flexion/document-extractor-poc/badge)](https://scorecard.dev/viewer/?uri=github.com/flexion/document-extractor-poc) -->",
"description": "Public Benefits Studio's Document Extractor to automate document data extraction with AI and OCR.",
"directories": {
"doc": "docs"
},