@@ -352,54 +352,3 @@ def parse_radar_summary(raw: str) -> RadarSummary:
352352 persistent_red = data .get ("persistent_red" , 0 ),
353353 sources = sources ,
354354 )
355-
356-
357- @dataclass
358- class PortalCandidate :
359- """Single portal candidate from discovered_portals_summary.json."""
360-
361- domain : str
362- protocol : str
363- probe_url : str
364-
365-
366- @dataclass
367- class PortalScoutSummary :
368- """Portal discovery summary from source-observatory discovered_portals_summary.json."""
369-
370- generated_at : str
371- total_portals : int
372- new_candidates : int
373- new_confirmed_protocol : int
374- known_registry_seen : int
375- by_protocol : dict [str , int ]
376- new_structured : list [PortalCandidate ] = field (default_factory = list )
377- known_registry_healthcheck : list [PortalCandidate ] = field (default_factory = list )
378-
379-
380- def parse_portal_scout_summary (raw : str ) -> PortalScoutSummary :
381- try :
382- data : dict [str , Any ] = json .loads (raw )
383- except json .JSONDecodeError as exc :
384- raise ValueError (f"Invalid JSON: { exc } " ) from exc
385-
386- def _parse_candidates (items : list [dict [str , Any ]]) -> list [PortalCandidate ]:
387- return [
388- PortalCandidate (
389- domain = c .get ("domain" , "" ),
390- protocol = c .get ("protocol" , "" ),
391- probe_url = c .get ("probe_url" , "" ),
392- )
393- for c in items
394- ]
395-
396- return PortalScoutSummary (
397- generated_at = data .get ("generated_at" , "unknown" ),
398- total_portals = data .get ("total_portals" , 0 ),
399- new_candidates = data .get ("new_candidates" , 0 ),
400- new_confirmed_protocol = data .get ("new_confirmed_protocol" , 0 ),
401- known_registry_seen = data .get ("known_registry_seen" , 0 ),
402- by_protocol = data .get ("by_protocol" , {}),
403- new_structured = _parse_candidates (data .get ("new_structured" , [])),
404- known_registry_healthcheck = _parse_candidates (data .get ("known_registry_healthcheck" , [])),
405- )
0 commit comments