API#

This is the API reference for call-report. See Get Started for a task-oriented introduction to the same functionality.

Package configuration#

Controls which dataframe library every reader returns native frames of, and whether they are returned eager or lazy.

call_report.config.get_config

Return a copy of the current thread's package configuration.

call_report.config.set_config

Update the current thread's package configuration.

call_report.config.config_context

Temporarily change the package configuration within a with block.

Core#

Shared, source-agnostic building blocks: the quarter-end reporting-period vocabulary, the cross-time schema vocabulary, the cross-source enums, the dataframe vocabulary every reader returns, and the abstract base every source-specific entry point implements.

call_report.core.ReportingPeriod

A single calendar-quarter reporting period.

call_report.core.PeriodRange

An inclusive, contiguous sequence of quarterly ReportingPeriods.

call_report.core.Quarter

A calendar quarter, ordered Q1 (Jan-Mar) through Q4 (Oct-Dec).

call_report.core.Source

A regulatory call report source supported (or planned) by this package.

call_report.core.FileType

The kind of file within a call report release.

call_report.core.BaseCallReport

Abstract base for every source-specific call report entry point.

call_report.core.FieldVersion

One span of a field's history where its dtype and definition held constant.

call_report.core.FieldAttributes

Cross-time metadata for a single field within a call report file.

call_report.core.FieldSchema

An ordered, immutable mapping of field name to FieldAttributes.

call_report.core.FieldChange

One field's before/after metadata between two FieldSchema snapshots.

call_report.core.FieldSchemaDiff

The result of comparing two FieldSchema snapshots via FieldSchema.compare.

call_report.core.FileMetadata

Cross-time metadata for a single call report file (schedule).

call_report.core.FileMetadataDiff

The result of comparing two FileMetadata via FileMetadata.compare.

Dataframe types#

The two type aliases that describe what a reader hands back. Both are importable from call_report.core for annotating your own code. They are written out here rather than generated, because a type alias has no runtime object for autodoc to read a docstring from.

call_report.core.NativeDataFrame#

The closed set of native dataframe types this package returns.

Every function and method that produces tabular data returns one of pandas.DataFrame, pyarrow.Table, polars.DataFrame, or polars.LazyFrame, never a narwhals wrapper. Which one you get is decided by the dataframe_backend and lazy settings (see call_report.config.set_config()), or by an explicit dataframe_type argument at the call site.

call_report.core.DataFrameType#

The names a caller requests a specific native dataframe type by.

One of "pandas", "pyarrow_table", "polars_dataframe", or "polars_lazyframe". Every method that builds a frame takes a dataframe_type argument accepting one of these values, applied as a final step whatever backend produced the frame. That lets a caller ask for a pandas DataFrame while the package is configured to use polars. None returns the frame as the configured backend built it.

Exceptions#

The exception hierarchy shared across sources.

call_report.exceptions.CallReportError

Root of every domain-specific error raised by call_report.

call_report.exceptions.InvalidPeriodError

A supplied period value is malformed or not a real calendar quarter end.

call_report.exceptions.PeriodNotAvailableError

A period is a valid quarter end but the source does not publish it.

call_report.exceptions.ScheduleNotFoundError

A requested schedule is unknown, or absent from every requested period.

call_report.exceptions.DomainDatasetNotFoundError

A requested curated domain dataset is not one this package ships.

call_report.exceptions.LayoutParseError

A layout or data file could not be parsed into the expected shape.

call_report.exceptions.DownloadError

A release's files could not be resolved or retrieved.

call_report.exceptions.ReshapeError

Loaded schedule data could not be reshaped into the requested layout.

FCA Call Report#

FCACallReport is the main entry point; the other members below are the lower-level building blocks it’s composed from, useful on their own for parsing an individual layout or data file.

call_report.fca.FCACallReport

The estimator-style entry point for FCA Call Report data.

call_report.fca.FCASchedule

A Farm Credit Administration Call Report schedule.

call_report.fca.FCADomainDataset

A curated domain dataset this package ships for FCA Call Report data.

call_report.fca.DomainDataset

A curated view assembled from several FCA Call Report schedules.

call_report.fca.DomainDatasetSource

One group of schedules contributing to a curated domain dataset.

call_report.fca.DomainDatasetColumn

One source variable's contribution to a curated domain dataset.

call_report.fca.DomainDatasetCode

One row key value in a curated domain dataset.

call_report.fca.DomainDatasetDerived

One output column computed from other output columns.

call_report.fca.convert_wide_format_to_long_format

Convert an already-built wide-format frame to long format.

call_report.fca.convert_long_format_to_wide_format

Convert an already-built long-format frame to wide format.

call_report.fca.convert_long_format_to_code_grain_format

Convert an already-built long-format frame to the code grain.

call_report.fca.get_fca_domain_dataset

Return one curated domain dataset's shipped definition.

call_report.fca.get_domain_dataset_codes

Return a curated domain dataset's codes and what each one means.

call_report.fca.get_fca_file_metadata

Return the canonical FileMetadata for one FCA schedule.

call_report.fca.get_institutions_file_metadata

Return the canonical FileMetadata for the FCA institution roster.

call_report.fca.all_fca_file_metadata

Return every FCA schedule's canonical FileMetadata, keyed by FCASchedule.

call_report.fca.catalog.construct_fca_download_url

Construct the FCA download URL for a period's Call Report zip archive.

call_report.fca.layout.parse_layout

Parse a D_<ROOT>.TXT layout file into an FCALayout.

call_report.fca.layout.FCALayout

A parsed FCA layout, with its scenario, variables, and column groups.

call_report.fca.layout.infer_field_dtype

Translate an FCA layout variable's declared type into a narwhals dtype.

call_report.fca.reader.read_schedule_file

Parse a schedule's data file into a tidy native dataframe.

call_report.fca.institutions.read_institutions

Parse a release's institution roster into a native dataframe.

call_report.fca.transport.FCATransport

The interface FCACallReport uses to resolve a period's local files.

call_report.fca.transport.LocalDirectoryTransport

A transport that resolves periods to pre-extracted local directories.

call_report.fca.transport.PackagedArchiveTransport

A transport that resolves periods to the release zips shipped in data/.