API reference¶
The importable Python surface: the loading and summary functions, the
BacsSummary dataclass, and BacsStatementParser, the
BankStatementParser the core discovers through the bacs and std18
entry points in bankstatementparser.loaders. Generated from the
docstrings by mkdocstrings.
bankstatementparser_loader_bacs.loader
¶
Core UK BACS Standard 18 & Faster Payments Statement Loader.
BacsSummary
dataclass
¶
Summary metrics and headers for a BACS Standard 18 submission.
Source code in bankstatementparser_loader_bacs/loader.py
67 68 69 70 71 72 73 74 75 76 77 78 | |
BacsStatementParser
¶
Bases: BankStatementParser
BankStatementParser plugin implementation for UK BACS Standard 18 files.
Source code in bankstatementparser_loader_bacs/loader.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
__init__(file_name, **kwargs)
¶
Initialize the BACS statement parser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_name
|
str | Path
|
Path to the BACS statement file. |
required |
**kwargs
|
Any
|
Extra options passed to base parser. |
{}
|
Source code in bankstatementparser_loader_bacs/loader.py
305 306 307 308 309 310 311 312 313 | |
parse()
¶
Parse the BACS file into a pandas DataFrame.
Returns:
| Type | Description |
|---|---|
DataFrame
|
A pandas DataFrame containing standardized statement transactions. |
Source code in bankstatementparser_loader_bacs/loader.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
to_transactions()
¶
Parse the BACS file into a list of Transaction models.
Returns:
| Type | Description |
|---|---|
list[Transaction]
|
List of parsed Transaction instances. |
Source code in bankstatementparser_loader_bacs/loader.py
349 350 351 352 353 354 355 | |
get_summary()
¶
Get summary metadata and balance metrics for the BACS file.
Returns:
| Type | Description |
|---|---|
BacsSummaryRecord
|
Dictionary with statement statistics. |
Source code in bankstatementparser_loader_bacs/loader.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
load_bacs(text_or_lines)
¶
Parse BACS Standard 18 text into domain Transaction models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_or_lines
|
str | Iterable[str]
|
Raw BACS payload or line iterable. |
required |
Returns:
| Type | Description |
|---|---|
list[Transaction]
|
List of Transaction instances. |
Source code in bankstatementparser_loader_bacs/loader.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
load_bacs_file(path)
¶
Read and parse a BACS statement file from disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | PathLike[str]
|
Path to the BACS file. |
required |
Returns:
| Type | Description |
|---|---|
list[Transaction]
|
List of Transaction instances. |
Source code in bankstatementparser_loader_bacs/loader.py
251 252 253 254 255 256 257 258 259 260 261 | |
summarize_bacs(text_or_lines)
¶
Generate financial metrics and headers summary for a BACS statement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_or_lines
|
str | Iterable[str]
|
Raw BACS payload or line iterable. |
required |
Returns:
| Type | Description |
|---|---|
BacsSummary
|
A BacsSummary instance. |
Source code in bankstatementparser_loader_bacs/loader.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |