added
This commit is contained in:
1 parent
57f4e2c561
commit
902d332eec
14 files changed
+213
-22
No files matched your search
+27
-3
@@ -8,7 +8,7 @@ import re
|
||||
from pathlib import Path
|
||||
|
||||
POOLS = {"standard_web", "exa", "rock_fight", "sec_edgar"}
|
||||
METHODS = {"standard_web", "exa", "direct"}
|
||||
METHODS = {"standard_web", "exa", "direct", "gmail"}
|
||||
HEADINGS = ["Executive Summary", "Major Themes This Week", "Notable Brand and Industry Signals",
|
||||
"Playbook Concept Matches", "Public Company and SEC Intelligence", "Rock Fight Intelligence",
|
||||
"International Relevance to North America", "Other Interesting Activity",
|
||||
@@ -48,7 +48,26 @@ def validate_run(root, path, success=False):
|
||||
require(all("## " + h in body for h in HEADINGS), "Missing report sections")
|
||||
require(receipt["run_id"] == e["run_id"], "Receipt run mismatch")
|
||||
require(receipt["status"] == e["status"], "Receipt status mismatch")
|
||||
require(set(e["coverage"]) == POOLS, "Missing coverage pools")
|
||||
config = read(root / "config/research.json")
|
||||
gmail_config = config.get("gmail_candidate_source", {})
|
||||
gmail_active = bool(gmail_config) and e["run_date"] >= gmail_config["enabled_from_run_date"]
|
||||
expected_pools = POOLS | ({"gmail_brandemails"} if gmail_active else set())
|
||||
require(set(e["coverage"]) == expected_pools, "Missing coverage pools")
|
||||
if gmail_active:
|
||||
collection = e.get("gmail_collection", {})
|
||||
require(collection.get("status") == e["coverage"]["gmail_brandemails"], "Gmail coverage mismatch")
|
||||
for key in ("pages_read", "messages_enumerated", "messages_screened"):
|
||||
require(type(collection.get(key)) is int and collection[key] >= 0, "Invalid Gmail collection count: " + key)
|
||||
require(collection["messages_screened"] <= collection["messages_enumerated"], "Gmail screening exceeds enumeration")
|
||||
for key in ("enumeration_complete", "screening_complete"):
|
||||
require(type(collection.get(key)) is bool, "Missing Gmail completeness: " + key)
|
||||
require(isinstance(collection.get("limitations"), list), "Missing Gmail limitations")
|
||||
if collection["status"] == "complete":
|
||||
require(collection["enumeration_complete"] and collection["screening_complete"] and
|
||||
collection["messages_screened"] == collection["messages_enumerated"] and
|
||||
collection["pages_read"] > 0 and not collection["limitations"], "Incomplete Gmail scan")
|
||||
else:
|
||||
require(bool(collection["limitations"]), "Missing Gmail coverage limitation")
|
||||
require(all(v in {"complete", "partial", "unavailable"} for v in e["coverage"].values()), "Invalid coverage")
|
||||
require(receipt["capture_completeness"] in {"complete", "partial", "unavailable"}, "Capture status missing")
|
||||
dt.datetime.fromisoformat(receipt["started_at"])
|
||||
@@ -83,9 +102,14 @@ def validate_run(root, path, success=False):
|
||||
require("sec.gov/" in s["url"].split("https://", 1)[1] and
|
||||
s["url"].split("/")[2] in {"www.sec.gov", "sec.gov", "data.sec.gov"}, "SEC evidence must be official")
|
||||
if s["kind"] == "podcast":
|
||||
require(s["format"] in {"publisher_transcript", "show_notes", "outline", "audio_transcribed"}, "Podcast format overclaim")
|
||||
require(s["format"] in {"publisher_transcript", "show_notes", "outline", "audio_transcribed", "provided_speech_to_text"}, "Podcast format overclaim")
|
||||
for k in ("episode_title", "speaker", "timestamps"):
|
||||
require(bool(s[k]), "Podcast field missing: " + k)
|
||||
if s.get("podcast_series") in {"sia_inside_line", "sia_other"}:
|
||||
require(s["kind"] == "podcast" and s["format"] in {"publisher_transcript", "provided_speech_to_text"}, "SIA podcast requires provided transcript text")
|
||||
require(s.get("transcript_url", "").startswith("https://") and bool(s.get("transcript_provider")), "SIA transcript provenance missing")
|
||||
require(s.get("transcript_completeness") in {"full", "partial"} and isinstance(s.get("transcript_limitations"), list), "SIA transcript completeness missing")
|
||||
require(s["transcript_completeness"] != "partial" or bool(s["transcript_limitations"]), "Partial SIA transcript needs limitations")
|
||||
if success or e["status"] == "complete":
|
||||
require(e["status"] == "complete" and all(v == "complete" for v in e["coverage"].values()), "Incomplete research cannot finalize")
|
||||
require(receipt["validation_passed"] is True and not receipt["gaps"], "Receipt has failed validation or gaps")
|
||||
|
||||
Reference in new issue
Block a user