Implements Phase 1 & 2 of Google Takeout RAG integration: - Database migrations for calendar_events, location_history, search_history - DAO implementations with hybrid time + semantic search - Parsers for .ics, JSON, and HTML Google Takeout formats - Import utilities with batch insert optimization Features: - CalendarEventDao: Hybrid time-range + semantic search for events - LocationHistoryDao: GPS proximity with Haversine distance calculation - SearchHistoryDao: Semantic-first search (queries are embedding-rich) - Batch inserts for performance (1M+ records in minutes vs hours) - OpenTelemetry tracing for all database operations Import utilities: - import_calendar: Parse .ics with optional embedding generation - import_location_history: High-volume GPS data with batch inserts - import_search_history: Always generates embeddings for semantic search 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
171 lines
3.8 KiB
Rust
171 lines
3.8 KiB
Rust
// @generated automatically by Diesel CLI.
|
|
|
|
diesel::table! {
|
|
calendar_events (id) {
|
|
id -> Integer,
|
|
event_uid -> Nullable<Text>,
|
|
summary -> Text,
|
|
description -> Nullable<Text>,
|
|
location -> Nullable<Text>,
|
|
start_time -> BigInt,
|
|
end_time -> BigInt,
|
|
all_day -> Bool,
|
|
organizer -> Nullable<Text>,
|
|
attendees -> Nullable<Text>,
|
|
embedding -> Nullable<Binary>,
|
|
created_at -> BigInt,
|
|
source_file -> Nullable<Text>,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
daily_conversation_summaries (id) {
|
|
id -> Integer,
|
|
date -> Text,
|
|
contact -> Text,
|
|
summary -> Text,
|
|
message_count -> Integer,
|
|
embedding -> Binary,
|
|
created_at -> BigInt,
|
|
model_version -> Text,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
favorites (id) {
|
|
id -> Integer,
|
|
userid -> Integer,
|
|
path -> Text,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
image_exif (id) {
|
|
id -> Integer,
|
|
file_path -> Text,
|
|
camera_make -> Nullable<Text>,
|
|
camera_model -> Nullable<Text>,
|
|
lens_model -> Nullable<Text>,
|
|
width -> Nullable<Integer>,
|
|
height -> Nullable<Integer>,
|
|
orientation -> Nullable<Integer>,
|
|
gps_latitude -> Nullable<Float>,
|
|
gps_longitude -> Nullable<Float>,
|
|
gps_altitude -> Nullable<Float>,
|
|
focal_length -> Nullable<Float>,
|
|
aperture -> Nullable<Float>,
|
|
shutter_speed -> Nullable<Text>,
|
|
iso -> Nullable<Integer>,
|
|
date_taken -> Nullable<BigInt>,
|
|
created_time -> BigInt,
|
|
last_modified -> BigInt,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
knowledge_embeddings (id) {
|
|
id -> Integer,
|
|
keyword -> Text,
|
|
description -> Text,
|
|
category -> Nullable<Text>,
|
|
embedding -> Binary,
|
|
created_at -> BigInt,
|
|
model_version -> Text,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
location_history (id) {
|
|
id -> Integer,
|
|
timestamp -> BigInt,
|
|
latitude -> Float,
|
|
longitude -> Float,
|
|
accuracy -> Nullable<Integer>,
|
|
activity -> Nullable<Text>,
|
|
activity_confidence -> Nullable<Integer>,
|
|
place_name -> Nullable<Text>,
|
|
place_category -> Nullable<Text>,
|
|
embedding -> Nullable<Binary>,
|
|
created_at -> BigInt,
|
|
source_file -> Nullable<Text>,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
message_embeddings (id) {
|
|
id -> Integer,
|
|
contact -> Text,
|
|
body -> Text,
|
|
timestamp -> BigInt,
|
|
is_sent -> Bool,
|
|
embedding -> Binary,
|
|
created_at -> BigInt,
|
|
model_version -> Text,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
photo_insights (id) {
|
|
id -> Integer,
|
|
file_path -> Text,
|
|
title -> Text,
|
|
summary -> Text,
|
|
generated_at -> BigInt,
|
|
model_version -> Text,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
search_history (id) {
|
|
id -> Integer,
|
|
timestamp -> BigInt,
|
|
query -> Text,
|
|
search_engine -> Nullable<Text>,
|
|
embedding -> Binary,
|
|
created_at -> BigInt,
|
|
source_file -> Nullable<Text>,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
tagged_photo (id) {
|
|
id -> Integer,
|
|
photo_name -> Text,
|
|
tag_id -> Integer,
|
|
created_time -> BigInt,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
tags (id) {
|
|
id -> Integer,
|
|
name -> Text,
|
|
created_time -> BigInt,
|
|
}
|
|
}
|
|
|
|
diesel::table! {
|
|
users (id) {
|
|
id -> Integer,
|
|
username -> Text,
|
|
password -> Text,
|
|
}
|
|
}
|
|
|
|
diesel::joinable!(tagged_photo -> tags (tag_id));
|
|
|
|
diesel::allow_tables_to_appear_in_same_query!(
|
|
calendar_events,
|
|
daily_conversation_summaries,
|
|
favorites,
|
|
image_exif,
|
|
knowledge_embeddings,
|
|
location_history,
|
|
message_embeddings,
|
|
photo_insights,
|
|
search_history,
|
|
tagged_photo,
|
|
tags,
|
|
users,
|
|
);
|