FastFEC
A C program to stream and parse Federal Election Commission (FEC) filings, writing output to CSV.
Installation
Download the latest release and place it on your path, or if you have Homebrew and are on Mac or Linux, you can install via:
brew install fastfec
You can also build a binary yourself following the development instructions below.
Usage
Once FastFEC has been installed, you can run the program by calling fastfec in your terminal:
Usage: fastfec [flags] <id or file> [output directory=output] [override id]
[flags]: optional flags which must come before other args; see below<file or id>is either- a file, in which case the filing is read from disk at the specified local path
- a numeric ID (only works with
--print-url): prints the possible URLs the filing lives on the FEC docquery website
[output directory]is the folder in which CSV files will be written. By default, it isoutput/.[override id]is an ID to use as the filing ID. If not specified, this ID is pulled out of the first parameter as a numeric component that can be found at the end of the path.
The CLI will read the specified filing from disk and then write output CSVs for each form type in the output directory. The paths of the outputted files are:
{output directory}/{filing id}/{form type}.csv
You can also pipe the output of another command in by following this usage:
[some command] | fastfec [flags] <id> [output directory=output]
Flags
The CLI supports the following flags:
--include-filing-id/-i: if this flag is passed, then the generated output will include a column at the beginning of every generated file calledfiling_idthat gets passed the filing ID. This can be useful for bulk uploading CSVs into a database--silent/-s: suppress all non-error output messages--warn/-w: show warning messages (e.g. for rows with unexpected numbers of fields or field types that don't match exactly)--no-stdin/-x: disable receiving piped input from other programs (stdin)--print-url/-p: print URLs from docquery.fec.gov (cannot be specified with other flags)
The short form of flags can be combined, e.g. -is would include filing IDs and suppress output.
Examples
Parsing a local filing
fastfec -s 13360.fec fastfec_output/
- This will run FastFEC in silent mode, parse the local filing 13360.fec, and store the output in CSV files at
fastfec_output/13360/.
Downloading and parsing a filing
Get the FEC filing URL needed:
fastfec -p 13360
If you have curl installed, you can then run this command:
curl https://docquery.fec.gov/dcdev/posted/13360.fec | fastfec 13360
- This will download the filing with ID 13360 from the FEC's servers and stream/parse it, storing the output in CSV files at
output/13360/
If you don't have curl installed, you can also download the filing from the URL (https://docquery.fec.gov/dcdev/posted/13360.fec), save the file, and run (is equivalent to the above):
fastfec 13360.fec
Benchmarks
The following was performed on an M1 Macbook Air:
| Filing | Size | Time | Memory usage | CPU usage |
|---|---|---|---|---|
1464847.fec |
8.4gb | 1m 42s | 1.7mb | 98% |
Local development
Build system
Zig is used to build and compile the project. Download and install the latest version of Zig (>=0.11.0) by following the instructions on the website (you can verify it's working by typing zig in the terminal and seeing help commands).
Dependencies
FastFEC has no external C dependencies. PCRE is bundled with the library to ensure compatibility with Zig's build system and cross-platform compilation.
Building
From the root directory of the repo, run:
zig build
- The above commands will output a binary at
zig-out/bin/fastfecand a shared library file in thezig-out/lib/directory - If you want to only build the library, you can pass
-Dlib-only=trueas a build option followingzig build - You can also compile for other operating systems via
-Dtarget=x86_64-windows(see here for additional targets)
Testing
Currently, there's C tests for specific parsing/buffer/write/CLI functionality and Python integration tests.
- Running the C tests:
zig build test - Running the Python tests:
cd python pip install -r requirements-dev.txt tox -e py
See the GitHub test workflow for more info
Scripts
python scripts/generate_mappings.py: A Python script to auto-generate C header files containing column header and type mappings
Metadata
Release files for fastfec 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| fastfec-0.4.1-py3-none-win_arm64.whl | Python 3 | none | Windows ARM64 | Details for fastfec-0.4.1-py3-none-win_arm64.whl |
| fastfec-0.4.1-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for fastfec-0.4.1-py3-none-win_amd64.whl |
| fastfec-0.4.1-py3-none-manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details for fastfec-0.4.1-py3-none-manylinux2014_aarch64.whl |
| fastfec-0.4.1-py3-none-manylinux1_x86_64.whl | Python 3 | none | Linux glibc 2.5+ x86-64 | Details for fastfec-0.4.1-py3-none-manylinux1_x86_64.whl |
| fastfec-0.4.1-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for fastfec-0.4.1-py3-none-macosx_11_0_arm64.whl |
| fastfec-0.4.1-py3-none-macosx_10_9_x86_64.whl | Python 3 | none | macOS 10.9+ x86-64 | Details for fastfec-0.4.1-py3-none-macosx_10_9_x86_64.whl |
Total release size: 2.1 MB
Release files / fastfec-0.4.1-py3-none-win_arm64.whl
| Download URL | fastfec-0.4.1-py3-none-win_arm64.whl |
|---|---|
| Size | 356.3 kB |
| Tags | Python 3 Windows ARM64 |
|
SHA-256 checksum How to use checksums |
650e2ed9b22793182038a689385b8c560434dc4f6bc08a908bfd388074c2978a
|
|
BLAKE2b-256 checksum How to use checksums |
271e21efe6b9e40f75ac8cf25d7628d9258e07d6f51e79dad3f2e7d07a7a5d7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Release files / fastfec-0.4.1-py3-none-win_amd64.whl
| Download URL | fastfec-0.4.1-py3-none-win_amd64.whl |
|---|---|
| Size | 284.4 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
cb123dba67e47d517c97646de70460d59d6921ab2ca177b3870e3f2f3aef5183
|
|
BLAKE2b-256 checksum How to use checksums |
a40936081184c4e06f8d8ab363b122aee35db5d79edea8598b6635079f0811e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Release files / fastfec-0.4.1-py3-none-manylinux2014_aarch64.whl
| Download URL | fastfec-0.4.1-py3-none-manylinux2014_aarch64.whl |
|---|---|
| Size | 457.0 kB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
3717c8353fc1e18f0a737a242f466c7dadff25767bfeb6ec8cedfffdf29e54ae
|
|
BLAKE2b-256 checksum How to use checksums |
dfb35eefc7086a3ff831836e8b83da02f327af370386d7bbb6fb674fc52f454f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Release files / fastfec-0.4.1-py3-none-manylinux1_x86_64.whl
| Download URL | fastfec-0.4.1-py3-none-manylinux1_x86_64.whl |
|---|---|
| Size | 345.7 kB |
| Tags | Linux glibc 2.5+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
ca50ddc5c2d5b300d4e788661f1638d643155b66f3f55c55cfed35032b653c37
|
|
BLAKE2b-256 checksum How to use checksums |
7fd3072cd393ab12505a186b6803aabc12a34bdca2d37c38bd01107e138660b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Release files / fastfec-0.4.1-py3-none-macosx_11_0_arm64.whl
| Download URL | fastfec-0.4.1-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 357.1 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
363aa3271e0691f77b7405b4bab7fc9c8927c9954293523d6ab4d0faf3df0442
|
|
BLAKE2b-256 checksum How to use checksums |
c0b3c164c11e479ddd44a5d5dc5370bd4402c7ae786ca06ef06018176f38ecc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Release files / fastfec-0.4.1-py3-none-macosx_10_9_x86_64.whl
| Download URL | fastfec-0.4.1-py3-none-macosx_10_9_x86_64.whl |
|---|---|
| Size | 272.9 kB |
| Tags | Python 3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
eaa22f938c21db00d6dbb08e17f0c66454248acbbf40cab018dbd4b6bc3845d5
|
|
BLAKE2b-256 checksum How to use checksums |
4f5da61aeae41a7c6395b601715ac089665880902bc7a590dea445f1e864faf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Security for fastfec 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.