femic.fansier_reporting

The femic.fansier_reporting module owns FEMIC’s structured parsing layer for FAN$IER batch text outputs.

Current responsibilities include:

  • parsing one FAN$IER long-report .txt file into normalized row groups;

  • normalizing machine-hostile scalar values such as: - comma-formatted numerics; - ∞; and - n/a;

  • preserving file-derived batch metadata such as regime, discount profile, selected product, and selected harvest age; and

  • aggregating a directory of FAN$IER reports into FEMIC-owned CSV tables for: - calculation_summary; - harvest_summary; - cost_lines; - product_price_factors; and - benefit_lines.

This is the parsing half of the tracked FAN$IER seam. In operator terms, it is what turns the long-report text lane into FEMIC-owned normalized tables that downstream economics code can consume without having to understand FAN$IER’s report layout directly.

Primary entry points

  • parse_fansier_batch_report()

  • parse_fansier_batch_output_dir()

See also:

Parse FAN$IER batch text reports into structured FEMIC-owned tables.

class femic.fansier_reporting.FansierBatchParseResult(report_dir, out_dir, report_count, calculation_summary_path, harvest_summary_path, cost_lines_path, product_price_factors_path, benefit_lines_path, manifest_path, calculation_summary_rows, harvest_summary_rows, cost_line_rows, product_price_factor_rows, benefit_line_rows)[source]

Bases: object

Paths and row counts for one parsed FAN$IER batch-output directory.

Parameters:
  • report_dir (Path)

  • out_dir (Path)

  • report_count (int)

  • calculation_summary_path (Path)

  • harvest_summary_path (Path)

  • cost_lines_path (Path)

  • product_price_factors_path (Path)

  • benefit_lines_path (Path)

  • manifest_path (Path)

  • calculation_summary_rows (int)

  • harvest_summary_rows (int)

  • cost_line_rows (int)

  • product_price_factor_rows (int)

  • benefit_line_rows (int)

benefit_line_rows: int
benefit_lines_path: Path
calculation_summary_path: Path
calculation_summary_rows: int
cost_line_rows: int
cost_lines_path: Path
harvest_summary_path: Path
harvest_summary_rows: int
manifest_path: Path
out_dir: Path
product_price_factor_rows: int
product_price_factors_path: Path
report_count: int
report_dir: Path
class femic.fansier_reporting.FansierParsedReport(metadata, calculation_summary, harvest_summary_rows, cost_line_rows, product_price_factor_rows, benefit_line_rows)[source]

Bases: object

Structured rows parsed from one FAN$IER long-report text file.

Parameters:
  • metadata (FansierReportMetadata)

  • calculation_summary (dict[str, Any])

  • harvest_summary_rows (tuple[dict[str, Any], ...])

  • cost_line_rows (tuple[dict[str, Any], ...])

  • product_price_factor_rows (tuple[dict[str, Any], ...])

  • benefit_line_rows (tuple[dict[str, Any], ...])

benefit_line_rows: tuple[dict[str, Any], ...]
calculation_summary: dict[str, Any]
cost_line_rows: tuple[dict[str, Any], ...]
harvest_summary_rows: tuple[dict[str, Any], ...]
metadata: FansierReportMetadata
product_price_factor_rows: tuple[dict[str, Any], ...]
class femic.fansier_reporting.FansierReportMetadata(source_report_path, run_id, regime_file, settings_label, discount_name, selected_product_group, selected_harvest_age)[source]

Bases: object

Filename-derived metadata for one FAN$IER batch report.

Parameters:
  • source_report_path (Path)

  • run_id (str | None)

  • regime_file (str | None)

  • settings_label (str | None)

  • discount_name (str | None)

  • selected_product_group (str | None)

  • selected_harvest_age (str | None)

discount_name: str | None
regime_file: str | None
run_id: str | None
selected_harvest_age: str | None
selected_product_group: str | None
settings_label: str | None
source_report_path: Path
exception femic.fansier_reporting.FansierReportParseError[source]

Bases: RuntimeError

Raised when a FAN$IER batch report cannot be parsed safely.

femic.fansier_reporting.parse_fansier_batch_output_dir(*, report_dir, out_dir=PosixPath('tipsy_io/logs/fansier_parsed'), report_glob='*.txt')[source]

Parse a directory of FAN$IER batch text reports into normalized CSV tables.

Parameters:
  • report_dir (Path)

  • out_dir (Path)

  • report_glob (str)

Return type:

FansierBatchParseResult

femic.fansier_reporting.parse_fansier_batch_report(report_path)[source]

Parse one FAN$IER long-report text file into normalized row groups.

Parameters:

report_path (Path)

Return type:

FansierParsedReport