Model/backend/documents_parser
Khalim Conn-Kowlessar ff25746f44 Slice S0380.40: parametrized API-path chain sweep for cohort-2 (34/38 at 1e-4)
Mirror of the cohort-2 Summary-path sweep that closed across
S0380.30..38: for each of the 38 cohort-2 certs whose API JSON was
fetched in S0380.39, drive the full API chain (`from_api_response`
→ `cert_to_inputs` → `calculate_sap_from_inputs`) and assert
`sap_score_continuous` vs the worksheet's lodged SAP at abs <= 1e-4.

Per cross-mapper parity ([[feedback-cross-mapper-parity-via-cascade]]):
the SAP cascade is the load-bearing equivalence check between
EpcPropertyData produced by from_api_response and from_elmhurst_site_notes.
If both paths hit the worksheet at 1e-4, they're cascade-output-
equivalent for load-bearing fields — strictly stronger than a noisy
structural EpcPropertyData diff.

Two parametrized tests, both green at HEAD:

- test_api_cohort_2_full_chain_sap_matches_worksheet_at_1e_minus_4:
  34 certs that hit the worksheet at 1e-4 on the API path immediately
  (the cascade can't tell which mapper produced the EPC).

- test_api_cohort_2_open_cert_residual_matches_current_pin:
  4 certs that don't yet hit 1e-4 — pinned at their current cascade
  output as forcing functions per [[project-api-to-sap-residual-test]].
  When a follow-up slice closes the underlying mapper/spec gap, the
  cascade output moves and the pin fires, forcing the cert to migrate
  from _COHORT_2_API_OPEN to _COHORT_2_API_CLOSED.

Open cohort residuals (handover to Slice C+):
  - 0300/1536/9380: tight +0.42..+0.44 band — likely a single shared
    cascade-spec gap (API-mapper-specific, since Summary path hits 1e-4)
  - 2102: -6.30 — Summary test (test_summary_2102_secondary_heating_
    routes_house_coal_for_open_fire) shows the cert lodges house-coal
    open-fire secondary heating; API mapper likely routes secondary
    fuel differently. Probe `secondary_heating` block first.

Test suite: 712 → 750 pass (0 fails). Pyright net-zero on touched file.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 16:45:48 +00:00
..
handler address JTK review comments 2026-04-20 15:11:17 +00:00
tests Slice S0380.40: parametrized API-path chain sweep for cohort-2 (34/38 at 1e-4) 2026-05-28 16:45:48 +00:00
__init__.py Map to RdSapSiteNotes from site notes JSON 🟥 2026-04-16 13:54:03 +00:00
db_writer.py include updating epc_property_data to pashub to ara workflow 2026-04-29 09:55:14 +00:00
elmhurst_extractor.py Slice S0380.26: RdSAP10 §5.8 dry-lining adjustment on alt walls — closes cert 7700 -0.44 → +5e-5 2026-05-28 10:56:11 +00:00
extractor.py Handle wall thickness "Unmeasurable" 🟩 2026-04-30 16:41:16 +00:00
local_runner.py update local runner to work for elmhurst 2026-04-24 14:01:36 +00:00
parser.py load ecmk site notes to db 2026-04-29 11:20:47 +00:00
pdf.py update local runner to work for elmhurst 2026-04-24 14:01:36 +00:00