Input Controller API
Purpose
This module defines file operation processing corresponding to various input modes in RDEToolKit. It provides functionality for input mode determination, file validation, and processing control.
Key Features
Input Mode Management
- Automatic determination of mode from input file patterns
- Support for Invoice, ExcelInvoice, RDEFormat, and MultiFile modes
- Input file validation and preprocessing
File Operation Control
- Acquisition and classification of input files
- File format validation
- Control of processing workflow
src.rdetoolkit.impl.input_controller.InvoiceChecker(unpacked_dir_basename)
Bases: IInputFileChecker
A checker class to determine and parse the invoice mode.
This class groups and checks invoice files, specifically identifying zip files, Excel invoice files, and other types of files.
属性:
| 名前 | タイプ | デスクリプション |
|---|---|---|
out_dir_temp |
Path
|
Temporary directory for the unpacked content. |
Note
For the purpose of this checker, notable files are primarily Excel invoices with a specific naming convention.
checker_type
property
Return the type identifier for this checker.
out_dir_temp = unpacked_dir_basename
instance-attribute
parse(src_dir_input)
Parses the source input directory, grouping files based on their type.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
src_dir_input
|
Path
|
Source directory containing the input files. |
必須 |
戻り値:
| タイプ | デスクリプション |
|---|---|
tuple[RawFiles, Path | None]
|
tuple[RawFiles, Optional[Path]]:
|
src.rdetoolkit.impl.input_controller.ExcelInvoiceChecker(unpacked_dir_basename)
Bases: IInputFileChecker
A checker class to determine and parse the ExcelInvoice mode.
This class is used to identify, group, and validate the files in ExcelInvoice mode. The primary focus is on determining the presence and validity of ZIP files, Excel Invoice files, and other file types.
属性:
| 名前 | タイプ | デスクリプション |
|---|---|---|
out_dir_temp |
Path
|
Temporary directory for unpacked content. |
メソッド:
| 名前 | デスクリプション |
|---|---|
parse |
Path) -> tuple[RawFiles, Optional[Path]]: Parse the source input directory, validate the file groups, and return the raw files and the Excel Invoice file. |
checker_type
property
Return the type identifier for this checker.
out_dir_temp = unpacked_dir_basename
instance-attribute
get_index(paths, sort_items)
Retrieves the index of the divided folder.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
paths
|
Path
|
Directory path of the raw files. |
必須 |
sort_items
|
Sequence
|
A list of files sorted in the order described in the Excel invoice. |
必須 |
戻り値:
| 名前 | タイプ | デスクリプション |
|---|---|---|
int |
int
|
The index number. |
parse(src_dir_input)
Parse the source input directory, group files by their type, validate the groups, and return the raw files and Excel Invoice file.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
src_dir_input
|
Path
|
Source directory containing the input files. |
必須 |
戻り値:
| タイプ | デスクリプション |
|---|---|
tuple[RawFiles, Path | None]
|
tuple[RawFiles, Optional[Path]]:
|
src.rdetoolkit.impl.input_controller.RDEFormatChecker(unpacked_dir_basename)
Bases: IInputFileChecker
A checker class to identify and parse the RDE Format.
This class is designed to handle files in the RDE Format. It checks the presence of ZIP files, unpacks them, and retrieves raw files from the unpacked content.
属性:
| 名前 | タイプ | デスクリプション |
|---|---|---|
out_dir_temp |
Path
|
Temporary directory for unpacked content. |
checker_type
property
Return the type identifier for this checker.
out_dir_temp = unpacked_dir_basename
instance-attribute
parse(src_dir_input)
Parse the source input directory, identify ZIP files, unpack the ZIP file, and return the raw files.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
src_dir_input
|
Path
|
Source directory containing the input files. |
必須 |
戻り値:
| タイプ | デスクリプション |
|---|---|
tuple[RawFiles, Path | None]
|
tuple[RawFiles, Optional[Path]]:
|
src.rdetoolkit.impl.input_controller.MultiFileChecker(unpacked_dir_basename)
Bases: IInputFileChecker
A checker class to identify and parse the MultiFile mode.
This class is designed to handle multiple file modes. It checks the files in the source input directory, groups them, and retrieves the raw files.
属性:
| 名前 | タイプ | デスクリプション |
|---|---|---|
out_dir_temp |
Path
|
Temporary directory used for certain operations. |
checker_type
property
Return the type identifier for this checker.
out_dir_temp = unpacked_dir_basename
instance-attribute
parse(src_dir_input)
Parse the source input directory, group ZIP files and other files, and return the raw files.
引数:
| 名前 | タイプ | デスクリプション | デフォルト |
|---|---|---|---|
src_dir_input
|
Path
|
Source directory containing the input files. |
必須 |
戻り値:
| タイプ | デスクリプション |
|---|---|
tuple[RawFiles, Path | None]
|
tuple[RawFiles, Optional[Path]]:
|
Practical Usage
Invoice Mode Processing
| invoice_mode_processing.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
ExcelInvoice Mode Processing
| excel_invoice_mode_processing.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
RDEFormat Mode Processing
| rde_format_mode_processing.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
MultiFile Mode Processing
| multifile_mode_processing.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
Integrated Input Control System
| integrated_input_control.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |