Skip to main content

A tool for extracting data from FERC XBRL Filings.

Project description

Project Status: Active Tox-PyTest Status Codecov Test Coverage Read the Docs Build Status PyPI Latest Version conda-forge Version Supported Python Versions Any color you want, so long as it's black. pre-commit CI https://zenodo.org/badge/471019769.svg

The Federal Energy Regulatory Commission (FERC) has moved to collecting and distributing data using XBRL. XBRL is primarily designed for financial reporting, and has been adopted by regulators in the US and other countries. Much of the tooling in the XBRL ecosystem is targeted towards filers, and rendering individual filings in a human readable way, but there is very little targeted towards accessing and analyzing large collections of filings. This tool is designed to provide that functionality for FERC XBRL data. Specifically, it can extract data from a set of XBRL filings, and write that data to a SQLite database whose structure is generated from an XBRL Taxonomy. While each XBRL instance contains a reference to a taxonomy, this tool requires a path to a single taxonomy that will be used to interpret all instances being processed. This means even if instances were created from different versions of a Taxonomy, the provided taxonomy will be used when processing all of these instances, so the output database will have a consistent structure. For more information on the technical details of the XBRL extraction, see the docs.

We are currently using this tool to extract and publish the following FERC data:

FERC Form

Archived XBRL

SQLite DB

Form 1

https://doi.org/10.5281/zenodo.4127043

https://data.catalyst.coop/ferc1_xbrl

Form 2

https://doi.org/10.5281/zenodo.5879542

https://data.catalyst.coop/ferc2_xbrl

Form 6

https://doi.org/10.5281/zenodo.7126395

https://data.catalyst.coop/ferc6_xbrl

Form 60

https://doi.org/10.5281/zenodo.7126434

https://data.catalyst.coop/ferc60_xbrl

Form 714

https://doi.org/10.5281/zenodo.4127100

https://data.catalyst.coop/ferc714_xbrl

Usage

Installation

To install using conda, run the following command, and activate the environment.

$ conda env create -f environment.yml

Activate:

$ conda activate ferc-xbrl-extractor

CLI

This tool can be used as a library, as it is in PUDL, or there is a CLI provided for interacting with XBRL data. The only required options for the CLI are a path to the filings to be extracted, and a path to the output SQLite database. The path to the filings can point to a directory full of XBRL Filings, a single XBRL filing, or a zipfile with XBRL filings. If the specified SQLite database already exists, it will be overwritten by this command.

$ xbrl_extract {path_to_filings} --sqlite-path {path_to_database}

This repo contains a small selection of FERC Form 1 filings from 2021, along with an archive of taxonomies in the examples directory. To test the tool on these filings, use the command:

$ xbrl_extract examples/ferc1-2021-sample.zip --sqlite-path ./ferc1-2021-sample.sqlite \
    --taxonomy examples/ferc1-xbrl-taxonomies.zip

The tool expects the --taxonomy option to point to a zipfile containing archived taxonomies produced by the pudl-archiver. The extractor will parse all taxonomies in the archive, then use the taxonomy referenced in each filing while parsing it.

Parsing XBRL filings can be a time consuming and CPU heavy task, so this tool implements some basic multiprocessing to speed this up. It uses a process pool to do this. There are two options for configuring the process pool, --batch-size and --workers. The batch size configures how many filings will be processed by each child process at a time, and workers specifies how many child processes to create in the pool. It may take some experimentation to get these options optimally configured. The following command will use 5 worker processes to process batches of 50 filings at a time.

$ xbrl_extract examples/ferc1-2021-sample.zip .--sqlite-path /ferc1-2021-sample.sqlite \
    --taxonomy examples/ferc1-xbrl-taxonomies.zip
    --workers 5 \
    --batch-size 50

There are also several options included for extracting metadata from the taxonomy. First is the --datapackage-path command to save a frictionless datapackage descriptor as JSON, which annotates the generated SQLite database. There is also the --metadata-path option, which writes more extensive taxonomy metadata to a json file, grouped by table name. See the ferc_xbrl_extractor.arelle_interface module for more info on the extracted metadata. To create both of these files using the example filings and taxonomy, run the following command.

$ xbrl_extract examples/ferc1-2021-sample.zip .--sqlite-path /ferc1-2021-sample.sqlite \
    --taxonomy examples/ferc1-xbrl-taxonomies.zip
    --metadata-path metadata.json \
    --datapackage-path datapackage.json

PUDL Sustainers

This package is part of the Public Utility Data Liberation (PUDL) project.

The PUDL Sustainers provide ongoing financial support to ensure the open data keeps flowing, and the project is sustainable long term. They’re also involved in our quarterly planning process. To learn more see the PUDL Project on Open Collective.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

catalystcoop_ferc_xbrl_extractor-1.7.2.tar.gz (27.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file catalystcoop_ferc_xbrl_extractor-1.7.2.tar.gz.

File metadata

File hashes

Hashes for catalystcoop_ferc_xbrl_extractor-1.7.2.tar.gz
Algorithm Hash digest
SHA256 61c068f30159162f997107678c5f21419b90b4c7157c8013384a590bde841337
MD5 b28a70cecda9b5f6e53b56f66a53819e
BLAKE2b-256 471e76a4727fa3d1fb942b519d492f325a361451e28ecf9ae0e19a255cd0a8ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for catalystcoop_ferc_xbrl_extractor-1.7.2.tar.gz:

Publisher: release.yml on catalyst-cooperative/ferc-xbrl-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file catalystcoop_ferc_xbrl_extractor-1.7.2-py3-none-any.whl.

File metadata

File hashes

Hashes for catalystcoop_ferc_xbrl_extractor-1.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 592b89f8736fe8154a153ccfd43818147fd4484c35b747b8d0956388e876fc32
MD5 dd2714e99583e5d996d4c0ba8c5189c8
BLAKE2b-256 0a28721b5acf8b75b5737a86de5da9b2570e0b2c5f89a2cc3ea82b8ddb090591

See more details on using hashes here.

Provenance

The following attestation bundles were made for catalystcoop_ferc_xbrl_extractor-1.7.2-py3-none-any.whl:

Publisher: release.yml on catalyst-cooperative/ferc-xbrl-extractor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page