How azure-samples/document-intelligence-code-samples works
Main Components
• Language-specific sample projects: The repository is divided into multiple directories for each supported language (.NET(v4.0), Python(v4.0), Java(v4.0), JavaScript(v4.0)). Each of these includes projects and sample code demonstrating how to call the Azure Document Intelligence client libraries.
• Feature-specific samples: Within each language folder, there are further subdivisions that separate different models (for example, “Prebuilt models”, “Custom models”, “Read model”, “Layout model”, and “Add-on capabilities” in Python).
• Data and Schema: The repository contains a “Data” folder housing sample documents (e.g., invoices, IDs, contracts) and a “schema” folder defining document formats and model configurations used to process these documents.
• Quickstarts and Helper Libraries: For .NET, there is a “Quickstarts” directory which includes helper code, assets (like PDFs and configurations), and sample programs that guide new users.
Interrelationships and Data Flow
• Clients (sample applications) in the language-specific directories illustrate how to interact with the Azure AI Document Intelligence service.
• The client applications use SDKs (provided or installed via package managers like pip for Python or NuGet for .NET) to communicate with the backend cloud service.
• Documents—from the “Data” directory—are used as inputs for the different analysis models. They feed into requests made by the sample applications.
• The responses (often structured as JSON and defined by the “schema”) flow back from the Azure service to the client code. This represents the data transformation and processing chain.
• For advanced functionalities like retrieval augmented generation (RAG) and add-on capabilities, there is a further processing layer demonstrated in the Python folder where postprocessing scripts (notebooks and scripts) perform additional data refinement.
Architectural Patterns and Design Principles
• Modular and Language-Agnostic Approach: The samples are organized by language, yet they all demonstrate similar functionality using the Azure AI Document Intelligence service. This separation makes it easier to update or add samples for new SDKs or functionalities.
• Separation of Concerns: The division between sample code, data, schema, and helper scripts clearly delineates where the domain logic (request construction, response handling), business rules, and data examples reside.
• Reusability: The common patterns (e.g., sending requests, processing responses) are abstracted out into helper modules (such as Utils.cs in .NET or helper scripts in Python) which are reused across different samples.