API
FecFile
An FEC file.
This doesn't do any reading or parsing until you access one of the members.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
src |
str | os.PathLike
|
A path or a URL to an FEC file. If a string that starts with "http://" or "https://", it will be treated as a URL. Otherwise, it will be treated as a path. |
required |
cover
cached
property
The Cover of the FEC file.
The first time this is accessed, the FEC file will be read and parsed as far as needed. Subsequent accesses will return the same object.
header
cached
property
The Header of the FEC file.
The first time this is accessed, the FEC file will be read and parsed as far as needed. Subsequent accesses will return the same object.
to_csvs
Write all itemizations in this FEC file to CSV files.
There will be one CSV file for each record type, eg. sa11.csv
.
Header
Bases: NamedTuple
The header of a FecFile.
Attributes:
Name | Type | Description |
---|---|---|
fec_version |
str
|
The version of the FEC file format. |
software_name |
str
|
The name of the software that generated the file. |
software_version |
str | None
|
The version of the software that generated the file. This isn't present in some older FEC files. |
report_id |
str | None
|
If this .fec file is an amendment to a previous filing, the filing number of the original. |
report_number |
str | None
|
If this .fec file is an amendment to a previous filing, which number amendement this is (1, 2, 3 etc) |
Cover
Bases: NamedTuple
The Cover Line of an FecFile.
Attributes:
Name | Type | Description |
---|---|---|
form_type |
str
|
The form type of the filing, eg. "F3" |
filer_committee_id |
str
|
The FEC-assigned ID of the committee that filed the report, eg "C00618371" |
ItemizationBatch
Bases: NamedTuple
A batch of itemizations.
Attributes:
Name | Type | Description |
---|---|---|
code |
str
|
The code of the itemization type, eg. "SA11AI" |
records |
pa.RecordBatch
|
A pyarrow.RecordBatch of itemizations. |
PyarrowBatcher
Iterates an FecFile and yields ItemizationBatchs of itemizations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fec_file |
FecFile
|
The FecFile to iterate. |
required |
max_batch_size |
int | None
|
The max rows per pyarrow.RecordBatch. Defaults to 1024 * 1024, which is what rust parquet uses. |
None
|