fix(web): offer representative time after occupation notes cover
Dateless occupation_note stayed draft, so classic coverage never finished and offer-candidates stayed blocked. Confirm those notes, stop crowding dasha probes with encoded exam quality, and adopt once blocking methods are covered. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -423,20 +423,55 @@ def _public_probe(
|
||||
}
|
||||
|
||||
|
||||
QUALITY_HINTS: dict[str, tuple[str, ...]] = {
|
||||
"education": ("失利", "失常", "压力", "复读", "考砸", "发挥不好"),
|
||||
}
|
||||
|
||||
|
||||
def _quality_encoded(event: dict[str, Any], domain: str) -> bool:
|
||||
summary = str(event.get("summary") or "")
|
||||
return any(hint in summary for hint in QUALITY_HINTS.get(domain, ()))
|
||||
|
||||
|
||||
def _year_quality_encoded(events: Sequence[dict[str, Any]], domain: str, year: int) -> bool:
|
||||
return any(
|
||||
isinstance(event, dict)
|
||||
and str(event.get("domain") or "") == domain
|
||||
and _event_year(event) == year
|
||||
and _quality_encoded(event, domain)
|
||||
for event in events
|
||||
)
|
||||
|
||||
|
||||
def _event_years(events: Sequence[dict[str, Any]], domain: str) -> set[int]:
|
||||
years: set[int] = set()
|
||||
for event in events:
|
||||
if not isinstance(event, dict) or str(event.get("domain") or "") != domain:
|
||||
continue
|
||||
year = _event_year(event)
|
||||
if year is not None:
|
||||
years.add(year)
|
||||
return years
|
||||
|
||||
|
||||
def _quality_probes(
|
||||
events: Sequence[dict[str, Any]],
|
||||
domains: Sequence[str],
|
||||
) -> list[dict[str, Any]]:
|
||||
rows: list[dict[str, Any]] = []
|
||||
seen: set[tuple[str, int]] = set()
|
||||
seen_domains: set[str] = set()
|
||||
for event in events:
|
||||
if not isinstance(event, dict):
|
||||
continue
|
||||
domain = str(event.get("domain") or "")
|
||||
year = _event_year(event)
|
||||
if domain not in domains or year is None or (domain, year) in seen:
|
||||
if domain not in domains or year is None or domain in seen_domains:
|
||||
continue
|
||||
seen.add((domain, year))
|
||||
if domain not in DOMAIN_CATALOG:
|
||||
continue
|
||||
if _year_quality_encoded(events, domain, year):
|
||||
continue
|
||||
seen_domains.add(domain)
|
||||
summary = str(event.get("summary") or "")
|
||||
family = str(DOMAIN_CATALOG[domain]["quality_family"])
|
||||
exam = domain == "education" and ("高考" in summary or "考试" in summary)
|
||||
@@ -537,11 +572,14 @@ def discriminating_event_probes(
|
||||
if left_narayana is not None and right_narayana is not None:
|
||||
narayana_years = _boundary_years(left_narayana, right_narayana)
|
||||
for domain in domains:
|
||||
if domain in covered_domains:
|
||||
if domain in covered_domains or domain not in DOMAIN_CATALOG:
|
||||
continue
|
||||
known_years = _event_years(events, domain)
|
||||
boundary = sorted((vim_years | narayana_years) & set(range(lo, hi + 1)))
|
||||
found = None
|
||||
for year in boundary:
|
||||
if year in known_years:
|
||||
continue
|
||||
found = _evaluate_year(
|
||||
left, right, birth_date=birth_date, domain=domain, year=year, source="dasha_boundary",
|
||||
)
|
||||
@@ -549,7 +587,7 @@ def discriminating_event_probes(
|
||||
break
|
||||
if found is None:
|
||||
midpoint = _age_band_year(birth_year, domain, now)
|
||||
if midpoint is not None:
|
||||
if midpoint is not None and midpoint not in known_years:
|
||||
found = _evaluate_year(
|
||||
left, right, birth_date=birth_date, domain=domain, year=midpoint, source="dasha_activation",
|
||||
)
|
||||
@@ -558,10 +596,11 @@ def discriminating_event_probes(
|
||||
dasha_domains.add(domain)
|
||||
covered_domains.add(domain)
|
||||
for domain in domains:
|
||||
if domain in covered_domains or domain in dasha_domains:
|
||||
if domain in covered_domains or domain in dasha_domains or domain not in DOMAIN_CATALOG:
|
||||
continue
|
||||
known_years = _event_years(events, domain)
|
||||
year = _age_band_year(birth_year, domain, now)
|
||||
if year is None:
|
||||
if year is None or year in known_years:
|
||||
continue
|
||||
probes.append(_public_probe(
|
||||
year=year,
|
||||
@@ -570,9 +609,9 @@ def discriminating_event_probes(
|
||||
tracks=("vimshottari", "narayana"),
|
||||
tracks_agree=False,
|
||||
user_meaning=_agent_brief(
|
||||
year_label=_year_label(year),
|
||||
family=str(DOMAIN_CATALOG[domain]["event_family"]),
|
||||
),
|
||||
year_label=_year_label(year),
|
||||
family=str(DOMAIN_CATALOG[domain]["event_family"]),
|
||||
),
|
||||
event_family=str(DOMAIN_CATALOG[domain]["event_family"]),
|
||||
))
|
||||
covered_domains.add(domain)
|
||||
|
||||
Reference in New Issue
Block a user