Map PasHub RdSAP Summary response to as-surveyed performance values 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-14 13:40:55 +00:00
parent 85482cdf9e
commit af6c461c93

View file

@ -1,6 +1,6 @@
from collections import defaultdict
import os
from typing import Dict, List, NamedTuple, Optional
from typing import Any, Dict, List, NamedTuple, Optional
from datetime import datetime
import requests
@ -133,7 +133,17 @@ class PashubClient:
return None
def get_rdsap_summary_by_job_id(self, job_id: str) -> RdSapSummary:
raise NotImplementedError
logger.info(f"Getting RdSAP Summary for job ID {job_id}")
url = f"{self.base}/jobs/{job_id}/rdSapSummary"
r = self.session.get(url)
data: Dict[str, Any] = r.json()
return RdSapSummary(
pre_sap_rating=data.get("preSapRating"),
pre_current_co2_emissions=data.get("preCurrentCo2Emissions"),
pre_current_energy_consumption=data.get("preCurrentEnergyConsumption"),
)
def _group_into_core_and_other_files(
self,