Skip to content

Commit

Permalink
Tweak parsing API constant and removed cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnaab committed Apr 5, 2024
1 parent beb5c0f commit e4364e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1,191 deletions.
4 changes: 2 additions & 2 deletions packages/forms/src/documents/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { InputPattern } from '../patterns/input';
import { SequencePattern } from '../patterns/sequence';
import { PDFDocument, getDocumentFieldData } from './pdf';
import { getSuggestedPatternsFromCache } from './suggestions';
import { getSuggestedPatterns } from './suggestions';
import { DocumentFieldMap } from './types';

export type DocumentTemplate = PDFDocument;
Expand All @@ -22,7 +22,7 @@ export const addDocument = async (
}
) => {
const fields = await getDocumentFieldData(fileDetails.data);
const cachedPdf = await getSuggestedPatternsFromCache(fileDetails.data);
const cachedPdf = await getSuggestedPatterns(fileDetails.data);

if (cachedPdf) {
form = updateFormSummary(form, {
Expand Down
8 changes: 3 additions & 5 deletions packages/forms/src/documents/pdf/parsing-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,12 @@ export type ParsedPdf = {
};

export const callExternalParser = async (
rawData: Uint8Array
rawData: Uint8Array,
endpointUrl: string = 'https://10x-atj-doc-automation-staging.app.cloud.gov/api/parse'
): Promise<ParsedPdf> => {
const base64 = await uint8ArrayToBase64(rawData);

// TODO: set this with deploy vars...
const endpoint =
'https://10x-atj-doc-automation-staging.app.cloud.gov/api/parse';
const response = await fetch(endpoint, {
const response = await fetch(endpointUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
Loading

0 comments on commit e4364e2

Please sign in to comment.