Lead-quality gate: require a name or location, not just a reason
A call produced a near-empty lead (name=None, location=None, only reason="check on my eyes"). Changed the extraction gate from "name OR reason" to "name OR location" — a bare reason with no name and no office isn't an actionable worklist card, so skip it. Verified: reason-only -> skip; name-only, location- only, both -> keep. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
10
extract.py
10
extract.py
@@ -80,12 +80,12 @@ async def extract_and_record(messages, ollama_url, model, call_sid=None, caller_
|
||||
logger.info("Post-call extraction: no appointment requested")
|
||||
return None
|
||||
|
||||
# Don't create near-empty cards from quick hang-ups: require at least a name or a
|
||||
# reason. A bare location + caller-ID isn't enough to be worth a worklist card.
|
||||
# Lead-quality gate: a usable lead needs a NAME or a LOCATION (so staff can act on it) —
|
||||
# a bare reason like "check on my eyes" with no name and no office is not worth a card.
|
||||
name = (data.get("patient_name") or "").strip()
|
||||
reason_raw = (data.get("reason") or "").strip()
|
||||
if not name and not reason_raw:
|
||||
logger.info("Post-call extraction: appointment intent but no name/reason captured — skipping card")
|
||||
location = (data.get("location") or "").strip()
|
||||
if not name and not location:
|
||||
logger.info("Post-call extraction: appointment intent but no name/location captured — skipping card")
|
||||
return None
|
||||
|
||||
# Callback number: default to the verified Twilio caller-ID. If the caller explicitly
|
||||
|
||||
Reference in New Issue
Block a user