OneDriveReadFilesEditor Documentation
Overview
The OneDriveReadFilesEditor is a component designed for integrating with OneDrive to browse, filter, and select files. It is part of the Vantage analytics and data platform and allows users to configure various settings for reading files from OneDrive, including file type filtering, search capabilities, and controlling the maximum number of files output. The selected files, along with their metadata, can be further processed with AI tools like Image Analysis or PDF Extract.
Purpose
The primary purpose of the OneDriveReadFilesEditor is to provide an interface for users to interact with their OneDrive files within a data workflow. It enables users to:
- Filter files based on type (images, PDFs, etc.)
- Search for specific files using a query
- Select multiple files for processing
- Limit the number of files returned and optionally download the content of the files
Settings
1. File Type
- Name:
fileType - Input Type: Dropdown
- Description: This setting allows users to filter the types of files that appear in the OneDrive file picker.
- Options:
all: All file typesimage: Images Onlypdf: PDFs Onlydataset: Datasets
- Options:
- Default Value:
all - Effect of Change: Selecting a different option changes the list of files displayed in the picker to match the chosen file type, thereby limiting the selection.
2. Search Query
- Name:
searchQuery - Input Type: String (text field)
- Description: An optional search string that filters the files shown in the picker based on the file name or content.
- Default Value:
""(empty string) - Effect of Change: Inputting text here will filter the displayed files to only those containing the search term. Leaving it empty allows navigating the entire directory.
3. Selected Files
- Name:
selectedFiles - Input Type: Array
- Description: Holds an array of files that have been selected by the user from OneDrive.
- Default Value:
[](empty array) - Effect of Change: Changing the selected files updates the files that will be output with their metadata and impacts the results available for further processing.
4. Max Files
- Name:
maxFiles - Input Type: Numeric (number input)
- Description: Specifies the maximum number of files allowed in the output.
- Default Value:
50 - Effect of Change: Modifying this value will limit the number of files output in subsequent processing steps. It must be between 1 and 200, and setting it higher than 200 will revert it to the maximum threshold of 200.
5. Include Content
- Name:
includeContent - Input Type: Boolean (toggle switch)
- Description: A toggle to download the content of the selected files in base64 format, allowing direct processing without the need to fetch files separately.
- Default Value:
false - Effect of Change: Toggling it on will include the file content along with metadata in the output, which can be vital for certain use cases, such as direct analysis or processing tasks.
How It Works
The OneDriveReadFilesEditor component renders an interface to allow users to control file selection and settings through various input elements (dropdowns, text fields, switches). The state of these settings is managed through props that are updated via callback functions (updateField). When a user interacts with any UI element, the corresponding state is updated, triggering any connected workflow steps in the Vantage platform.
Data Expectations
The OneDriveReadFilesEditor expects the following data structures:
- selectedNode: Information related to the current node in the workflow.
- nodes and edges: Data representing the overall workflow structure.
- config: An object that contains the current configuration settings (e.g.,
fileType,selectedFiles, etc.). - workflowId: A string representing the unique identifier for the current workflow.
Use Cases & Examples
Use Case 1: Image Processing
A tech company may want to analyze images stored in OneDrive for object detection. Using the OneDriveReadFilesEditor, they can filter only image file types, search for specific keywords (e.g., "test.jpg"), and select multiple images to be processed by an image analysis tool.
Use Case 2: Document Retrieval
A financial institution needs to fetch specific documents (like invoices). Utilizing the search query feature, they can look for terms like "invoice" in their OneDrive files and restrict the output to only PDFs for easier processing.
Example Configuration
To solve the document retrieval use case, the component may be configured as follows:
{
"fileType": "pdf",
"searchQuery": "invoice",
"selectedFiles": ["invoice_2023_01.pdf", "invoice_2023_02.pdf"],
"maxFiles": 10,
"includeContent": true
}In this example:
- Only PDF files will be displayed in the picker.
- The search query filters the list to files containing "invoice."
- Up to 10 files can be selected, and their content will be included in the output for subsequent processing.