# Code Map

This folder contains sanitized publication copies of the source files responsible for the public demonstration evidence. Machine-local absolute paths were replaced with package-relative references; calculation logic and evidentiary values were not changed.

## run_bfcl_v4_sensitivity.py

- Published file: `code/run_bfcl_v4_sensitivity.py`
- Purpose: calculates buyer-profile scores and ranks; applies eligibility and hard-disqualification rules; produces profile rankings; normalizes cost efficiency; scores latency; writes the registered sensitivity outputs.
- Main functions or sections used: `cost_per_success`, `latency_score`, `lower_better_scores`, `higher_better_rank`, `lower_better_rank`, `weighted_score`, `row_metrics`, `disqualify_profile`, `profile_success_metric`, `build_profile_results`, `sensitivity_rows`, `write_csv`, `top_eligible`, `top_sensitivity`, `write_reports`, `main`.
- Outputs generated by the original run: `data/processed/bfcl_profile_results.csv`, `data/processed/bfcl_sensitivity_results.csv`, `data/processed/bfcl_disqualification_log.csv`, `outputs/BFCL_PROFILE_RESULTS_REPORT.md`, `outputs/BFCL_DECISION_FLIP_SUMMARY.md`.
- Execution status: directly executed in the prior frozen BFCL sensitivity run.
- Manual step involved: none in the calculation; it reads the frozen baseline and pre-registered profile assumptions.

## audit_bfcl_v4_sensitivity.py

- Published file: `code/audit_bfcl_v4_sensitivity.py`
- Purpose: verifies every Profile A-D calculation against the processed baseline, runs leave-one-factor-out checks, decomposes Profile A and D scores, audits Profile B thresholds, and writes the materiality audit.
- Main functions or sections used: `disqualify`, `eligible_rows`, `profile_success`, `profile_aux`, `profile_terms`, `score_from_terms`, `profile_score`, `ranked_for`, `verify_profiles`, `fix_sensitivity_outputs`, `decomposition_rows`, `leave_one_factor_rows`, `profile_b_threshold_audit`, `procurement_rows`, `write_audit_report`, `main`.
- Outputs generated by the original run: `outputs/BFCL_CALCULATION_AND_MATERIALITY_AUDIT.md`.
- Execution status: directly executed in the prior calculation/materiality audit.
- Manual step involved: none in the calculation; the leave-one-factor-out checks are diagnostic checks over the registered profile terms and do not redefine the frozen profile.

## freeze_bfcl_v4_snapshot.py

- Published file: `code/freeze_bfcl_v4_snapshot.py`
- Purpose: downloads and freezes the public BFCL V4 files, records source URLs/retrieval timestamps/file sizes/SHA-256 hashes, builds archive indexes, reconstructs the published aggregate score, and writes the processed baseline.
- Main functions or sections used: `sha256_bytes`, `request_bytes`, `csv_quality`, `json_quality`, `parse_snapshot_metadata`, `reconstruct`, `make_archive_index`, `write_manifest`, `write_baseline`, `write_report`, `main`.
- Outputs generated by the original run: `data/raw/BFCL_SNAPSHOT_MANIFEST.csv`, `data/raw/metadata/*archive*`, `data/processed/bfcl_v4_baseline.csv`, `outputs/BFCL_BASELINE_RECONSTRUCTION_REPORT.md`.
- Execution status: directly executed in the prior BFCL snapshot/baseline reconstruction run.
- Manual step involved: none beyond running the script at the time of the frozen snapshot.
