Skip to content

Add --json output to libfec info for machine-readable metadata #5

@hodgesmr

Description

@hodgesmr

Right now libfec info <filing_id> prints a human-pretty summary:

libfec info 1918948
FEC-1918948 F3N October Quarterly by Colby Watson for Congress (C00920652)
Covering 2025-07-01 to 2025-09-30

Report of Receipts and Disbursements for an Authorized Committee
https://docquery.fec.gov/cgi-bin/forms/C00920652/1918948
v8.5 1.28 KiB filed with FECfile 8.5.0.0(f33)

This is nice for eyeballing, but it’s hard to consume from scripts/tools.

Consider a machine-readable output mode:

Proposal

Add a --json flag (or similar) to libfec info that prints structured metadata derived from the filing header and cover records.

  • Default output remains unchanged (human pretty format).
  • --json outputs only JSON (no extra commentary), suitable for jq, pandas, etc.
  • Include a libfec_schema_version field so the JSON contract can evolve without breaking downstream users.
  • Include a libfec_version field for reproducibility.

Example JSON output

Note: this is just a hand-made example, not the exact schema that would map to the header fields.

{
  "libfec_version": "0.0.1"
  "libfec_schema_version": 1,
  "filing_id": 1918948,
  "form_type": "F3N",
  "report_title": "October Quarterly",
  "committee": {
    "name": "Colby Watson for Congress",
    "fec_id": "C00920652"
  },
  "coverage": {
    "from": "2025-07-01",
    "to": "2025-09-30"
  },
  "document_url": "https://docquery.fec.gov/cgi-bin/forms/C00920652/1918948",
  "hdr": {  # does this need its own metadata to identify type? 
    "record_type": "HDR",
    "ef_type": null,
    "fec_version": "8.5",
    "soft_name": "FECfile",
    "soft_ver": "8.5.0.0",
    "batch_number": null,  # nulls feels weird given the shape of this changes
    "received_date": null,
    "report_number": null,
    "name_delim": null,
    "comment": null
  },
}

If some fields aren’t available for a given filing type, decide to omit them or set them to null... whichever fits project style best.

Opening this issue as a conversation-starter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions