Document Loaders¶
loaders
¶
Assembly: Mappy
Filename: loaders.py
Author: Terry D. Eppler
Created: 09-08-2026
Last Modified By: Terry D. Eppler
Last Modified On: 09-09-2026
Mappy is a Python framework for geospatial and data workflows.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Classes¶
Loader
¶
Base local-document loader.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
TextLoader
¶
Bases: Loader
Load UTF-8 text into LangChain documents.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
load
¶
Load a text document.
Purpose
Reads UTF-8 text and returns one LangChain document preserving source metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local text-file path. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded text document. |
Source code in loaders.py
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
CsvLoader
¶
Bases: Loader
Load CSV records into LangChain documents.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
load
¶
Load a CSV document.
Purpose
Uses LangChain CSVLoader to convert delimited rows into LangChain documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local CSV-file path. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded CSV row documents. |
Source code in loaders.py
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
PdfLoader
¶
Bases: Loader
Load PDF pages into LangChain documents.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
load
¶
Load a PDF document.
Purpose
Uses LangChain PyPDFLoader to convert PDF pages into LangChain documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local PDF-file path. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded PDF page documents. |
Source code in loaders.py
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
ExcelLoader
¶
Bases: Loader
Load Excel workbooks into LangChain documents.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
load
¶
Load an Excel workbook.
Purpose
Uses LangChain UnstructuredExcelLoader to convert workbook content into documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local Excel-workbook path. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded workbook documents. |
Source code in loaders.py
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
WordLoader
¶
Bases: Loader
Load Word documents into LangChain documents.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
load
¶
Load a Word document.
Purpose
Uses LangChain Docx2txtLoader to convert DOCX content into documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local Word-document path. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded Word documents. |
Source code in loaders.py
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
MarkdownLoader
¶
Bases: Loader
Load Markdown into LangChain documents.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
load
¶
Load a Markdown document.
Purpose
Uses LangChain UnstructuredMarkdownLoader to convert Markdown content into documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local Markdown-file path. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded Markdown documents. |
Source code in loaders.py
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
HtmlLoader
¶
Bases: Loader
Load HTML into LangChain documents.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
load
¶
Load an HTML document.
Purpose
Uses LangChain UnstructuredHTMLLoader to convert HTML content into documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local HTML-file path. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded HTML documents. |
Source code in loaders.py
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
JsonLoader
¶
Bases: Loader
Load JSON into LangChain documents.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
load
¶
Load a JSON document.
Purpose
Uses LangChain JSONLoader to convert JSON content into LangChain documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local JSON-file path. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded JSON documents. |
Source code in loaders.py
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
PowerPointLoader
¶
Bases: Loader
Load PowerPoint presentations into LangChain documents.
Initialize loader state.
Purpose
Initializes the current source path and LangChain document collection.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
load
¶
Load a PowerPoint presentation.
Purpose
Uses LangChain UnstructuredPowerPointLoader to convert slides into documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local PowerPoint-file path. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded presentation documents. |
Source code in loaders.py
verify_exists
¶
Validate the selected source path.
Purpose
Ensures the local source exists before constructing a LangChain loader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Local document path. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Validated local document path. |
Source code in loaders.py
set_metadata
¶
Apply consistent source metadata.
Purpose
Preserves source path, source filename, and Mappy loader identity on returned documents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
Public Mappy loader class name. |
required |
Returns:
| Type | Description |
|---|---|
List[Document]
|
List[Document]: Loaded LangChain documents with normalized metadata. |
Source code in loaders.py
DocumentLoaderFactory
¶
Create Mappy's supported local document loaders.
Initialize loader-factory state.
Purpose
Initializes the selected local loader type.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This method initializes instance state. |
Source code in loaders.py
Methods:¶
create
¶
create(loader_type: str) -> Loader
Create the selected local loader.
Purpose
Maps the finite document-source selection to the corresponding Mappy loader wrapper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_type
|
str
|
Selected document-source type. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Loader |
Loader
|
Configured local-document loader instance. |
Source code in loaders.py
Functions:¶
throw_if
¶
Validate a required runtime value.
Purpose
Ensures required loader configuration is present before filesystem or parser work begins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Argument name included in validation errors. |
required |
value
|
object
|
Runtime value to validate. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This function validates input and does not return a value. |