| name | ingest-spam-calls |
| description | Pull a Yet Another Call Blocker (YACB) JSON backup from an ADB-connected Android phone, ingest it into callers.csv with dedupe, and commit the result. Use when Daniel says "import spam calls", "pull yacb", "sync spam list", or has just marked new spam numbers on his phone and wants them in the repo. |
ingest-spam-calls
End-to-end flow for getting new spam-caller reports off the phone and into this repo.
Assumptions
- Repo root is the current working directory (
Israel-Spam-Callers).
- Phone is connected via USB with ADB debugging enabled — verify with
adb devices.
- YACB export lives in
/sdcard/Download/CallBlocker_backup_*.json. User triggers the export manually in YACB: Settings → Backup → Export to Download.
Steps
-
Verify ADB connection.
adb devices
If no device, stop and ask the user to plug in / unlock / authorise.
-
Find the most recent backup on the phone.
adb shell 'ls -t /sdcard/Download/CallBlocker_backup_*.json 2>/dev/null | head -1'
If empty, ask the user to run YACB → Settings → Backup → Export.
-
Pull it into _inbox/.
adb pull "$REMOTE_PATH" _inbox/
-
Run the ingest script. Dedupes by E.164 number; updates last_seen and bumps call_count on repeat numbers; adds new rows with source=yacb.
python3 scripts/ingest_yacb.py _inbox/CallBlocker_backup_*.json
Report the +N new, ~M updated line to the user.
-
Show the diff.
git diff --stat callers.csv
git diff callers.csv | head -40
-
Offer to commit + push. Do not auto-commit unless the user already said "and push" — otherwise confirm. Commit message format:
Ingest YACB backup YYYY-MM-DD: +N new, ~M updated
The inbox JSON is also committed (small, useful as an audit trail).
Handling the CSV manually
After ingest, the new rows have empty category / language / claimed_identity / notes fields. Ask the user if they want to fill those in for the new numbers before committing — for a single number it's fast; for a batch, offer to do it in a follow-up pass.
Failure modes
- No device / unauthorised → tell user to unlock phone and tap "Allow" on the ADB prompt.
- No backup file found → guide user through YACB export, don't guess filenames.
- Malformed JSON → surface the exception from
ingest_yacb.py, don't silently continue.
- Existing number, YACB-only source → the script still increments
call_count. That's intentional: each new YACB backup implies at least one more spam call since last ingest.