DartDocumentAISamples is a personal initiative to showcase the capabilities of the Dart language in building applications that interact with Google Cloud services. The core of this project revolves around demonstrating how Dart can be seamlessly integrated with Google Cloud's DocumentAI. As a hands-on example, it provides Dart developers with practical insights into processing, managing, and leveraging DocumentAI's powerful features within a Dart-centric workflow. Please note that this is a work-in-progress, and contributions to enhance its offerings are warmly welcomed. For a glimpse of the roadmap, refer to the TODOs section below.
DocumentAI is a suite of tools provided by Google Cloud that harnesses the power of machine learning to help organizations automate document processing. It can efficiently parse, structure, and understand vast amounts of documents, from invoices and receipts to contracts and forms. With DocumentAI, you can extract meaningful data, insights, and knowledge from various document types, turning unstructured data into actionable insights. Its capabilities range from Optical Character Recognition (OCR) and form parsing to specialized processors tailored for specific industries and use cases.
- Dart SDK installed (Installation Guide)
- A Google Cloud Project with DocumentAI API enabled
- A Service Account with permissions to access DocumentAI
DartDocumentAISamples provides a command-line interface to interact with Google Cloud's DocumentAI.
-
Place Service Account Key:
- Ensure your Service Account key JSON file is placed in the
assets/
directory under the namesa-keys.json
.
- Ensure your Service Account key JSON file is placed in the
-
List Available Commands:
- To view the list of available commands and their descriptions, run:
dart bin/main.dart --help
-
Execute a Specific Command:
- Replace
<command_name>
with the command you wish to execute, and use the appropriate options and arguments for the command:
dart bin/main.dart <command_name> --<option_name> <option_value>
For example, to list available processor types:
dart bin/main.dart listProcessorTypes
- Replace
-
Get Detailed Help for a Command:
- For more detailed information about a specific command, use:
dart bin/main.dart help <command_name>
To help you quickly get started with DartDocumentAISamples, we provide an example.sh
script. This script allows you to easily run specific commands with pre-defined parameters. It's a great way to see the tool in action with minimal setup.
-
Ensure Prerequisites:
- Make sure you have the Dart SDK installed and your Google Cloud Project is set up with the DocumentAI API and a Service Account as described in the Prerequisites section.
-
Run a Command:
- Use the
example.sh
script followed by the command name to execute a predefined command. For example, to process a document using the Form Parser processor, run:./example.sh processDocumentWithFormParser
- Similarly, to process a document using a Specialized processor, execute:
./example.sh processDocumentUsingSpecializedProcessor
- Use the
-
Explore Other Commands:
- The script supports several commands matching the TODOs in our roadmap. Simply replace the command name in the script call with the one you wish to test.
- 1- Cancel a long-running operation
- 2- Create a processor
- 3- Delete a processor
- 4- Delete a processor version
- 5- Disable a processor
- 6- Deploy a processor version
- 7- Enable a processor
- 8- Evaluate a processor version
- 9- Get a list of processors
- 10- Get details about a long-running operation
- 11- Get evaluation details for a processor version
- 12- List processor types
- 13- List evaluations for a processor version
- 14- List long-running operations
- 15- Poll a long-running operation
- 16- Process a document using a Form Parser processor
- 17- Process a document using a Document OCR processor
- 18- Process a document using a Specialized processor
- 19- Process a document using a Splitter/Classifier processor
- 20- Quickstart
- 21- Request Human Review of a document
- 22- Send a batch process documents request
- 23- Send an online processing request
- 24- Toolbox - Convert Document to hOCR
- 25- Toolbox - Convert Document to Vision API Response
- 26- Toolbox - Convert external annotations to Document format
- 27- Toolbox - Create document batches
- 28- Toolbox - Export entities to BigQuery
- 29- Toolbox - Export images
- 30- Toolbox - Output table to Dataframe or CSV
- 31- Toolbox - Quickstart
- 32- Toolbox - Split a PDF
- 33- Train a processor version
- 34- Undeploy a processor version
- 35- View available processor versions
- 36- View details about a processor
- 37- View details about a processor version
dartdocumentaicli-demo.mov
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. As this project is a work-in-progress, any contribution to help complete the TODOs list would be appreciated.
This project draws inspiration from the official samples provided by Google. For a comprehensive list of samples and their descriptions, refer to Google's DocumentAI Samples.
This project is licensed under the MIT License, which allows for modification, distribution, and private use. Contributions are welcome, and forking the project for your own use is encouraged. For more details, see the LICENSE file in the repository.
For additional information and resources related to this project and DocumentAI, consider visiting the following links: