The BUSINESS VIDEO is at:
https://youtube.com/shorts/t1Bc-_SUxZg
The website is hosted at:
https://ldihk.xyz/
The hosted frontend is configured to use the live Render backend API:
https://ldihk-api.onrender.com
Health check:
https://ldihk-api.onrender.com/health
The hosted demo runs with the frontend mock API disabled and sends browser API traffic to the Render service. Local development instructions are below.
Set up the local Python environment:
uv venv .venv
uv syncRun the tests:
uv run python -m unittest discover -s backend/testsProcess the local Google Takeout export:
uv run python backend/scripts/process_youtube_usage.pyThis writes:
data/processed/users/local_user/youtube_usage.v1.json
Build the v3 SQLite usage store:
uv run python backend/scripts/import_youtube_usage_sql.pyThis writes:
data/processed/users/local_user/youtube_usage.v3.sqlite
Enrich v3 video durations when a YouTube Data API key is configured:
cp .env.example .env
# Set YOUTUBE_API_KEY in .env
uv run python backend/scripts/enrich_youtube_durations.pyStart the read-only API:
uv run flask --app backend.app run --host 127.0.0.1 --port 8000Available endpoints:
GET http://127.0.0.1:8000/health
GET http://127.0.0.1:8000/api/users/local_user/youtube-usage
GET http://127.0.0.1:8000/api/v2/users/local_user/youtube-usage/temporal
POST http://127.0.0.1:8000/api/v3/query
POST http://127.0.0.1:8000/api/query
POST http://127.0.0.1:8000/api/imports
GET http://127.0.0.1:8000/api/imports/{import_id}
If uv cannot write to its default cache in a restricted environment, prefix commands with:
uv --cache-dir .uv-cache ...The pulled frontend lives in Frontend/.
cd Frontend
npm install
cp .env.example .env
npm run devFor the real backend, set:
PUBLIC_API_URL=http://127.0.0.1:8000For local browser development, the backend CORS allowlist includes Astro's default origin:
http://localhost:4321
Leave PUBLIC_API_URL empty to use the frontend's local Astro mock API routes.
flowchart LR
subgraph Ingestion["Ingestion"]
IG["Instagram usage data"]
YT["YouTube usage data"]
TT["TikTok / Douyin usage data"]
RAW["Raw usage data"]
IG --> RAW
YT --> RAW
TT --> RAW
end
subgraph Preprocessing["Preprocessing"]
direction TB
CLEAN["Clean and validate data"] --> STRUCTURE["Convert to structured format"] --> STANDARD["Standardized data structure"]
STANDARD --> DB[("SQL database")]
DB --> AI["AI analysis / augmentation"]
AI --> FEATURES["Derived metrics and risk signals"]
end
subgraph Dashboard["Analysis Dashboard"]
TEMPORAL["Temporal usage graph"]
POP["Population comparison"]
HEALTHY["Comparison with healthy / average usage"]
RISK["Risk-factor trends over time"]
CORR["Correlation analysis across groups"]
end
RAW --> CLEAN
FEATURES --> TEMPORAL
FEATURES --> POP
FEATURES --> HEALTHY
FEATURES --> RISK
FEATURES --> CORR