Skip to content

Pydantic Models and Enums

Pydantic Models

  • Bai2Model

bai2_reader.src.models.Bai2Model

The model for the BAI2 file, which will be the output of the parser

  • FileHeader

bai2_reader.src.models.FileHeader

The header record TransactionType.debit, which will be the first line of the file, record code: '01'

  • GroupSection

bai2_reader.src.models.GroupSection

The group section for each group, which will contain - the group header record, - the account sections, - and the group trailer record

  • GroupHeader

bai2_reader.src.models.GroupHeader

The group header record TransactionType.debit, which will be the first line of each group, record code: '02'

  • AccountSection

bai2_reader.src.models.AccountSection

Account section for each account, which will contain - the account identifier record, - account summary - the transaction sections, - and the account trailer record

  • AccountIdentifier

bai2_reader.src.models.AccountIdentifier

The account identifier record, which will be the first line of each account, record code: '03'

  • TransactionSection

bai2_reader.src.models.TransactionSection

The transaction section for each transaction, which will contain - the transaction detail record - and the continuation records that follow the transaction detail

  • Transaction

bai2_reader.src.models.Transaction

The transaction record which will be the line of each transaction. '16' record code

  • AccountTrailer

bai2_reader.src.models.AccountTrailer

The account trailer record which will be the last line of each account, record code: '49'

  • GroupTrailer

bai2_reader.src.models.GroupTrailer

The group trailer record TransactionType.debit, which will be the last line of each group, record code: '98'

  • FileTrailer

bai2_reader.src.models.FileTrailer

The file trailer record TransactionType.debit, which will be the last line of the file, record code: '99'

  • Continuation

bai2_reader.src.models.Continuation

The continuation record, which will be the line of each continuation, record code: '88'


Enumerations

  • Record

bai2_reader.src.enums.Record

An enumeration representing the different types of records in a BAI2 file.

account_identifier = '03' class-attribute instance-attribute

account_trailer = '49' class-attribute instance-attribute

continuation = '88' class-attribute instance-attribute

file_header = '01' class-attribute instance-attribute

file_trailer = '99' class-attribute instance-attribute

group_header = '02' class-attribute instance-attribute

group_trailer = '98' class-attribute instance-attribute

transaction = '16' class-attribute instance-attribute

  • GroupStatus

bai2_reader.src.enums.GroupStatus

An enumeration representing the different group status codes in a BAI2 file.

delete = '3' class-attribute instance-attribute

new = '1' class-attribute instance-attribute

test_only = '4' class-attribute instance-attribute

update = '2' class-attribute instance-attribute

  • AsOfDateModifier

bai2_reader.src.enums.AsOfDateModifier

An enumeration representing the different as-of date modifiers in a BAI2 file.

final_previous_day = '2' class-attribute instance-attribute

final_same_day = '4' class-attribute instance-attribute

interim_previous_day = '1' class-attribute instance-attribute

interim_same_day = '3' class-attribute instance-attribute

  • FundsType

bai2_reader.src.enums.FundsType

An enumeration representing the different funds types in a BAI2 file.

distributed_availability = 'D' class-attribute instance-attribute

distributed_availability_simple = 'S' class-attribute instance-attribute

immediate_availability = '0' class-attribute instance-attribute

one_day_availability = '1' class-attribute instance-attribute

two_day_availability = '2' class-attribute instance-attribute

unknown_availability = 'Z' class-attribute instance-attribute

value_dated = 'V' class-attribute instance-attribute

  • TransactionType

bai2_reader.src.enums.TransactionType

An enumeration representing the different transaction types in a BAI2 file.

credit = 'CR' class-attribute instance-attribute

debit = 'DB' class-attribute instance-attribute

misc = 'M' class-attribute instance-attribute

  • TypeCodeLevel

bai2_reader.src.enums.TypeCodeLevel

An enumeration representing the different type code levels in a BAI2 file.

detail = 'detail' class-attribute instance-attribute

status = 'status' class-attribute instance-attribute

summary = 'summary' class-attribute instance-attribute

  • TypeCodes

bai2_reader.src.enums.TypeCodes

A class representing the different type codes in a BAI2 file, including the transaction type, type level code, and description.

type_codes cached property

Get all Typecode details Thanks to : https://github.com/mrrozz/bai2-codes-csv/blob/master/bai-codes.csv

TypeCode dataclass

A data class representing the details of a type code, including the transaction type, type level code, and description.

Parameters:

Name Type Description Default
transaction_type TransactionType | None
None
type_level_code TypeCodeLevel | None
None
description str | None
''
description = '' class-attribute instance-attribute
transaction_type = None class-attribute instance-attribute
type_level_code = None class-attribute instance-attribute
__init__(transaction_type=None, type_level_code=None, description='')

get_type_code(type_code, ignore_if_not_found=True)

Get the details of a type code by its code. set ignore_if_not_found to false to raise an exception if the type code is not found, otherwise it will return empty details and log a warning