---
name: fcall
description: >
  Parse Farm Credit Administration (FCA) Call Report data into tidy Polars data frames. Use when writing Python code that uses the fcall package.
license: MIT
compatibility: Requires Python >=3.11.
---

# fcall

Parse Farm Credit Administration (FCA) Call Report data into tidy Polars data frames

## Installation

```bash
pip install fcall
```

## API overview

### Core API

The three user-facing functions that mirror the R {fcall} package.

- `download_data`: Download a quarter's FCA Call Report archive and unzip into *dest*
- `process_data`: Read a quarter's downloaded .TXT files into tidy Polars DataFrames
- `compare_metadata`: Diff the metadata (D_*.TXT) files between two quarter directories

### Lower-level helpers

Exported for power users who need fine-grained control over parsing. Most users should call ``process_data()`` instead.


- `process_metadata_file`: Parse a metadata (D_*.TXT) file into a scenario + vars_info dict
- `process_data_file`: Read *file* and return a tidy DataFrame using *metadata* and *codes_dict*
- `read_data_file`: Low-level reader: returns an unnamed DataFrame matching the raw CSV shape
- `get_codes_dict`: Return the codes dictionary for *data_name*, or ``None`` values if none
- `compare_files_content`: Return unified-diff lines between *filename* in *dir1* and *dir2*

### Data assets

Internal datasets shipped with the package. ``fcall.file_metadata`` is a Polars DataFrame (36 rows) mapping file prefixes to descriptions — access it directly. ``get_code_df`` returns a code-to-label DataFrame for datasets that have repeating code groups.


- `get_code_df`: Return a DataFrame[code: Int64, value: Utf8] for *registry_key*

## Resources

- [Full documentation](https://ketchbrookanalytics.github.io/fcall-py/)
- [llms.txt](llms.txt) — Indexed API reference for LLMs
- [llms-full.txt](llms-full.txt) — Comprehensive documentation for LLMs
- [Source code](https://github.com/ketchbrookanalytics/fcall-py)
