https://github.com/catalyst-cooperative/ferc-xbrl-extractor

A tool for converting FERC filings published in XBRL into SQLite databases

https://github.com/catalyst-cooperative/ferc-xbrl-extractor

Science Score: 59.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 11 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 7 committers (14.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.2%) to scientific vocabulary

Keywords

climate-change data database electricity energy etl ferc finance form-1 form-2 form-6 form-60 form-714 natural-gas pudl python regulation sqlite utility xbrl

Keywords from Contributors

policy emissions reproducibility energy-data cems coal ddj eia eia860 eia923
Last synced: 5 months ago · JSON representation

Repository

A tool for converting FERC filings published in XBRL into SQLite databases

Basic Info
  • Host: GitHub
  • Owner: catalyst-cooperative
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 138 MB
Statistics
  • Stars: 13
  • Watchers: 8
  • Forks: 3
  • Open Issues: 7
  • Releases: 19
Topics
climate-change data database electricity energy etl ferc finance form-1 form-2 form-6 form-60 form-714 natural-gas pudl python regulation sqlite utility xbrl
Created almost 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Funding License Code of conduct

README.rst

===============================================================================
FERC XBRL Extractor
===============================================================================


.. readme-intro

.. image:: https://www.repostatus.org/badges/latest/active.svg
   :target: https://www.repostatus.org/#active
   :alt: Project Status: Active

.. image:: https://github.com/catalyst-cooperative/ferc-xbrl-extractor/actions/workflows/tox-pytest.yml/badge.svg
   :target: https://github.com/catalyst-cooperative/ferc-xbrl-extractor/actions/workflows/tox-pytest.yml
   :alt: Tox-PyTest Status

.. image:: https://img.shields.io/codecov/c/github/catalyst-cooperative/ferc-xbrl-extractor?style=flat&logo=codecov
   :target: https://codecov.io/gh/catalyst-cooperative/ferc-xbrl-extractor
   :alt: Codecov Test Coverage

.. image:: https://img.shields.io/readthedocs/catalystcoop-ferc-xbrl-extractor?style=flat&logo=readthedocs
   :target: https://catalystcoop-ferc-xbrl-extractor.readthedocs.io/en/latest/
   :alt: Read the Docs Build Status

.. image:: https://img.shields.io/pypi/v/catalystcoop.ferc-xbrl-extractor
   :target: https://pypi.org/project/catalystcoop.ferc-xbrl-extractor/
   :alt: PyPI Latest Version

.. image:: https://img.shields.io/conda/vn/conda-forge/catalystcoop.ferc_xbrl_extractor
   :target: https://anaconda.org/conda-forge/catalystcoop.ferc_xbrl_extractor
   :alt: conda-forge Version

.. image:: https://img.shields.io/pypi/pyversions/catalystcoop.ferc-xbrl-extractor
   :target: https://pypi.org/project/catalystcoop.ferc-xbrl-extractor/
   :alt: Supported Python Versions

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://github.com/psf/black
   :alt: Any color you want, so long as it's black.

.. image:: https://results.pre-commit.ci/badge/github/catalyst-cooperative/ferc-xbrl-extractor/main.svg
   :target: https://results.pre-commit.ci/latest/github/catalyst-cooperative/ferc-xbrl-extractor/main
   :alt: pre-commit CI

.. image:: https://zenodo.org/badge/471019769.svg
  :target: https://zenodo.org/doi/10.5281/zenodo.10020145
   :alt: Zenodo DOI

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:

.. list-table::
   :header-rows: 1

   * - 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.

.. code-block:: console

    $ conda env create -f environment.yml

Activate:

.. code-block:: console

    $ 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 path to the database points to an existing database, the ``--clobber`` option
can be used to drop all existing data before performing the extraction.

.. code-block:: console

    $ xbrl_extract {path_to_filings} {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:

.. code-block:: console

    $ xbrl_extract examples/ferc1-2021-sample.zip --db-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.

.. code-block:: console

    $ xbrl_extract examples/ferc1-2021-sample.zip .--db-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.

.. code-block:: console

    $ xbrl_extract examples/ferc1-2021-sample.zip .--db-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
`__.

Owner

  • Name: Catalyst Cooperative
  • Login: catalyst-cooperative
  • Kind: organization
  • Email: hello@catalyst.coop
  • Location: United States of America

Catalyst is a small data engineering cooperative working on electricity regulation and climate change.

GitHub Events

Total
  • Create event: 36
  • Release event: 1
  • Watch event: 4
  • Delete event: 40
  • Member event: 1
  • Issue comment event: 5
  • Push event: 106
  • Pull request review comment event: 2
  • Pull request review event: 5
  • Pull request event: 132
  • Fork event: 2
Last Year
  • Create event: 36
  • Release event: 1
  • Watch event: 4
  • Delete event: 40
  • Member event: 1
  • Issue comment event: 5
  • Push event: 106
  • Pull request review comment event: 2
  • Pull request review event: 5
  • Pull request event: 132
  • Fork event: 2

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 348
  • Total Committers: 7
  • Avg Commits per committer: 49.714
  • Development Distribution Score (DDS): 0.489
Past Year
  • Commits: 150
  • Committers: 6
  • Avg Commits per committer: 25.0
  • Development Distribution Score (DDS): 0.573
Top Committers
Name Email Commits
zschira z****a@c****p 178
dependabot[bot] 4****] 64
pre-commit-ci[bot] 6****] 50
Zane Selvans z****s@c****p 48
Dazhong Xia d****a@c****p 6
Jan Rous r****k@g****m 1
bendnorman b****9@c****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 17
  • Total pull requests: 436
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 2 days
  • Total issue authors: 6
  • Total pull request authors: 7
  • Average comments per issue: 0.65
  • Average comments per pull request: 0.39
  • Merged pull requests: 399
  • Bot issues: 3
  • Bot pull requests: 387
Past Year
  • Issues: 1
  • Pull requests: 163
  • Average time to close issues: 16 minutes
  • Average time to close pull requests: about 2 hours
  • Issue authors: 1
  • Pull request authors: 4
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.04
  • Merged pull requests: 150
  • Bot issues: 1
  • Bot pull requests: 153
Top Authors
Issue Authors
  • zaneselvans (10)
  • dependabot[bot] (2)
  • zschira (2)
  • broscious4peg (1)
  • jdangerx (1)
  • pre-commit-ci[bot] (1)
Pull Request Authors
  • dependabot[bot] (223)
  • pre-commit-ci[bot] (164)
  • zaneselvans (25)
  • zschira (11)
  • jdangerx (9)
  • rousik (2)
  • e-belfer (2)
Top Labels
Issue Labels
xbrl (2) inframundo (2) metadata (2) dependencies (2) performance (1)
Pull Request Labels
dependencies (237) github_actions (20) xbrl (5) performance (5) bug (4) documentation (4) packaging (2) metadata (2) inframundo (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 1,871 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 30
  • Total maintainers: 3
pypi.org: catalystcoop.ferc-xbrl-extractor

A tool for extracting data from FERC XBRL Filings.

  • Homepage: https://github.com/catalyst-cooperative/ferc-xbrl-extractor
  • Documentation: https://catalystcoop-ferc-xbrl-extractor.readthedocs.io
  • License: MIT License Copyright (c) 2022 Catalyst Cooperative Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 1.6.0
    published 10 months ago
  • Versions: 30
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 1,871 Last month
Rankings
Dependent packages count: 3.2%
Downloads: 4.0%
Average: 15.9%
Stargazers count: 20.4%
Dependent repos count: 22.1%
Forks count: 29.9%
Maintainers (3)
Last synced: 6 months ago

Dependencies

.github/workflows/bot-auto-merge.yml actions
  • ridedott/merge-me-action v2 composite
  • tibdex/github-app-token v1 composite
.github/workflows/tox-pytest.yml actions
  • 8398a7/action-slack v3 composite
  • actions/checkout v3 composite
  • codecov/codecov-action v3.1.1 composite
  • conda-incubator/setup-miniconda v2.2.0 composite
environment.yml conda
  • pip >=21.0,<24
  • python >=3.10,<3.12
  • setuptools >=66,<69
.github/workflows/release.yml actions
  • 8398a7/action-slack v3 composite
  • actions/checkout v4 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
  • sigstore/gh-action-sigstore-python v2.0.1 composite
pyproject.toml pypi
  • arelle-release >=2.3,<3
  • coloredlogs >=14.0,<15.1
  • frictionless >=4.4,<5
  • lxml >=4.9.1,<5
  • numpy >=1.16,<2
  • pandas >=1.5,<2.2
  • pydantic >=1.9,<3
  • sqlalchemy >=1.4,<3
  • stringcase >=1.2,<2