Closed DanielZambSB closed 2 months ago
Question: if the email does not have a date limit for the quotation, when to assign the quotation visit?
In emails with only an image, some fields are missing:
The Fields that the OCR process is covering:
remember to empty the string on city, on create inquiry
fixed problem on regex pattern, when an email is forwarded the formatting of the text changes, so, pattern has to change too. fixed JSON response linebreak problem on the response from the LLM, mainly using regex to remove unwanted linebreak that were not escaped.
beware this feature could break if the formatting of the emails changes in some way, so it wise to think of another method to parse the information of email and feed it to current backend structure
Related Files:
Related Functions:
parseEmailTable()
addEmailInfoToEmailTableDB()
Code Changes Proposed:
JSON.parse(string)
.parseEmailTable
FunctionThe parseEmailTable
function is a critical component designed for parsing unread emails from a Gmail inbox that contain specific subject lines related to invitations for quotations. The function operates through the following sequence of tasks:
requestBisonEmailtable
), which is indicated by a special flag in the result.This function is vital for automating the extraction and processing of email data for subsequent operations, such as database entries or further administrative processing.
requestBisonEmailtable
FunctionThe requestBisonEmailtable
function is designed to interact with a machine learning model hosted on Google's AI Platform to process text data and extract specific information in a structured format. This function primarily handles the automation of data extraction from maintenance request emails, which involves the following steps:
This function is essential for enhancing the efficiency of processing and organizing email content by leveraging AI capabilities to automate the extraction of critical data, which is then used in subsequent administrative processes.
addEmailInfoToEmailTableDB
FunctionThe function addEmailInfoToEmailTableDB
is designed to process email information parsed from an email table and append this data to a specified Google Spreadsheet, as well as log specific actions or events. This function primarily involves two main tasks: appending rows to the 'Consolidado TablaEmail' sheet in a Google Spreadsheet, and inserting inquiry details into a database. The function operates as follows:
parseEmailTable
function to retrieve arrays of email data (emailArr
) and logs (loggerArr
).aiParsedThis
is present), the entire email data is appended as a new row. An inquiry object is then created with detailed fields initialized from the email data and subsequently sent to the database via the createInquiryDB
function.Logger.log
, and then calls createLoggerEmail
to store log information.This function is crucial for handling batch email data processing and updates, making it an essential part of the system's backend infrastructure for email management and logging activities.
processFolderFiles
and processResultsIntoObjects
FunctionsprocessFolderFiles
FunctionThe processFolderFiles
function is designed to automate the processing of documents stored in a Google Drive folder, extract textual content using OCR (Optical Character Recognition), and integrate results into a Google Spreadsheet. Here’s how it functions:
Initialization:
File Processing Loop:
processDocument
function, which likely handles the conversion of image-based text into editable text.requestBisonEmailImage
function, presumably to parse structured data from the combined text.Data Handling:
createInquiryDB
.Data Management:
processResultsIntoObjects
FunctionThe processResultsIntoObjects
function is aimed at retrieving processed results from a Google Spreadsheet and reformatting them for consistency and further usage:
Data Retrieval:
Result Parsing and Formatting:
Spreadsheet Update:
These functions collectively enhance the automation of document handling and data processing within a digital environment, streamlining operations related to document management, OCR processing, and data integration into structured formats for business or operational needs.
User Role:
User Stories:
Acceptance Criteria: