Skip to content

feat: chronology, circadian sleep pattern, and travel route tracker - #2709

Open
SuperJaba wants to merge 2 commits into
Datalux:developmentfrom
SuperJaba:feat/chronology-geo-travel-tracker
Open

SuperJaba wants to merge 2 commits into
Datalux:developmentfrom
SuperJaba:feat/chronology-geo-travel-tracker

Conversation

@SuperJaba

Copy link
Copy Markdown

Overview

Understanding when and where a target profile is active is essential for behavioral intelligence and physical verification in OSINT investigations.

This PR introduces Circadian Sleep Pattern Estimation and a Chronological Travel Route & Leg Tracker.

Key Changes

  1. Sleep Schedule & Timezone Inference (src/chronology_tracker.py):
    • Analyzes a 24-hour publication/interaction histogram across UTC hours.
    • Detects the deepest contiguous quiet window (~7 hours) to determine estimated sleep/inactivity periods.
    • Infers the target's probable home timezone (UTC±XX:00) with confidence scoring.
    • Flags nocturnal / jet-lag activity incidents (posts published in the middle of inferred sleep hours).
  2. Chronological Travel Route Tracker (src/chronology_tracker.py):
    • Extracts geotagged posts, sorts them chronologically ascending by timestamp.
    • Uses great-circle Haversine formula (pure standard library math, 0 new dependencies) to compute distance between consecutive stops.
    • Computes elapsed days between stops, average transit speeds, and categorizes travel legs (Flight / Long Distance Transit, Intercity Road / Rail Travel, Local / Stationary).
  3. Service & Tools Integration:
    • Added get_sleep_schedule(limit_posts=50) and get_travel_route(limit_posts=50) to OsintgramService.
    • Registered tools in src/web/tools.py.
    • Integrated into src/web/static/index.html with:
      • 24h interactive activity distribution chart with sleep window highlighting.
      • Travel route itinerary timeline with distance badges and direct Google Maps links.
    • Updated doc/web-ui.md command count (32 commands total) and documentation.
  4. Tests:
    • Added tests/test_chronology_travel.py covering Haversine distance calculations, timestamp parsing, sleep window inference, nocturnal anomalies, chronological travel hops, private profile protection, and tool execution.

Verification

  • 182/182 tests passing (python -m pytest -q).
  • Flake8 0 errors (flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics).

@SuperJaba
SuperJaba force-pushed the feat/chronology-geo-travel-tracker branch from caf3340 to 0299ece Compare October 28, 2026 17:28
@Datalux

Datalux commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR! A chronological route from public geotags fits the project, and it's cleanly scoped (one commit, no conflicts, the UI escapes the output). Before merging I'd like some changes, and I'd also like to discuss the sleep/timezone part.

Sleep schedule / timezone

  1. The quietest 7-hour window is picked with a strict <, so ties are resolved by the lowest start hour. With about 50 posts there are usually several empty windows, and the result depends on the ordering, not on the data. Please handle ties (e.g. smooth the histogram, take the center of the longest empty run, or report a range) and report the result as ambiguous when it is.
  2. The timezone assumes that sleep always starts at 23:00 local (offset = 23 - best_start). Night owls, shift workers, scheduled posts or business accounts give wrong results, and half-hour offsets and DST aren't handled. Please present it as a rough estimate (a range, not a single UTC+hh:00).
  3. The confidence is inflated: quiet_ratio is the share of posts outside a 7-hour window, so any account that doesn't post for 7 hours reaches "High" with 20 posts. It doesn't measure how regular the pattern is. Please base it on something meaningful (e.g. how much deeper the quiet window is than the average) or remove it.
  4. I'm not fully convinced that inferring someone's sleep window and home timezone is a good fit for this tool: it's the least reliable output and the most sensitive one. If we keep it, I'd like a clear "rough estimate, not evidence" note in the UI and in doc/web-ui.md.

Travel route
5. transit_type uses only the distance (leg_km > 500 is "Flight"), ignoring the time between the posts. Two posts 600 km apart and three months apart are labeled "Flight / Long Distance Transit", and speed_kmh between distant dates isn't meaningful. Please base the label on the time gap too, or use neutral wording ("distance from previous stop").
6. The post time and the geotag are not where the person was at that time: users tag places later, remotely, or post old photos. Please say so in the UI and docs.
7. loc.get("lat") or ... drops a coordinate equal to 0; please check for None instead.
8. limit_posts has no upper limit and accepts None from the AI tool. Please cap it server-side (e.g. 100), as in #2706.

Tests
Please add tests for ties in the histogram, a 600 km leg over a long gap, and a coordinate equal to 0.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants