BlueTrack / README.md
Lions12138's picture
Rename SQL_TABLES_GUIDE.md to README.md
277748a verified
|
Raw
History Blame Contribute Delete
4.97 kB
# BlueTrack SQL Database Tables Guide
This document provides a comprehensive overview of the SQL database tables used in the BlueTrack project, including their structure, fields, and purposes.
## Tables Overview
| Table Name | Row Count | Purpose |
|------------|-----------|---------|
| `user_actions` | 27,713,990 | Complete record of all user actions on the platform |
| `user_stats` | 8,294 | Aggregated statistics for each user |
| `followers_list` | 728,506 | User follow relationships mapping |
| `user_actions_sampled` | 1,695,892 | Sampled subset of user actions |
---
## Detailed Table Structures
### 1. user_actions
**Purpose**: Stores all user actions on the platform, including posts, replies, reposts, and likes.
| Field Name | Type | Description |
|------------|------|-------------|
| `user_id` | integer | Unique user identifier |
| `action_type` | text | Type of action: `post`, `reply`, `repost`, `like`, etc. |
| `post_id` | integer | ID of the post/action created by this operation |
| `target_post_id` | integer | ID of the target post (for replies or reposts) |
| `target_author` | integer | User ID of the target post's author |
| `action_text` | text | Text content entered by the user in this action |
| `original_text` | text | Original text of the target post (preserved for replies/reposts) |
| `date` | text | Timestamp of the action (format: YYYYMMDDHHmm) |
| `labels` | text | Action labels or categories |
| `topic_name` | text | Associated topic name |
**Example**: A user posting a comment, replying to another post, or reposting content.
---
### 2. user_stats
**Purpose**: Stores aggregated statistics for each user, enabling quick queries of user activity and influence metrics.
| Field Name | Type | Description |
|------------|------|-------------|
| `user_id` | integer | Unique user identifier (primary key) |
| `following_count` | integer | Number of users this user follows |
| `follower_count` | integer | Number of followers this user has |
| `mutual_follow_count` | integer | Number of mutual followers |
| `sampled_count` | integer | Number of sampled actions for this user |
| `post_count` | integer | Total number of posts created |
| `reply_count` | integer | Total number of replies made |
| `repost_count` | integer | Total number of reposts made |
| `like_count` | integer | Total number of likes given |
| `community_id` | integer | Community ID the user belongs to |
**Example**: User 100032 has 205 following, 83 followers, and created 60 posts.
---
### 3. followers_list
**Purpose**: Stores follow relationships between users, used to construct the social network graph.
| Field Name | Type | Description |
|------------|------|-------------|
| `user_id` | integer | ID of the user being followed |
| `follower_id` | integer | ID of the user who is following |
**Note**: Each row represents that `follower_id` follows `user_id`. This is a directed relationship.
**Example**: If `user_id=100032` and `follower_id=100447`, it means user 100447 follows user 100032.
---
### 4. user_actions_sampled
**Purpose**: Stores a sampled subset of user actions to reduce data volume while maintaining representativeness.
| Field Name | Type | Description |
|------------|------|-------------|
| `user_id` | bigint | Unique user identifier |
| `action_type` | text | Type of action: `post`, `reply`, `repost`, `like`, etc. |
| `post_id` | bigint | ID of the post/action created |
| `target_post_id` | bigint | ID of the target post |
| `target_author` | bigint | User ID of the target post's author |
| `action_text` | text | Text content entered by the user |
| `original_text` | text | Original text of the target post |
| `date` | text | Timestamp of the action |
| `labels` | text | Action labels |
| `topic_name` | text | Associated topic name |
| `source_type` | text | Data source type |
**Note**: This table is a sampled version of `user_actions`, retaining all fields but with significantly reduced data volume (~1.7M rows vs 27.7B rows), enabling faster analysis and testing.
---
## Usage Recommendations
1. **Quick User Queries**: Use `user_stats` to retrieve aggregated user data
2. **Behavior Analysis**: Use `user_actions` or `user_actions_sampled` for detailed action analysis
3. **Social Network Construction**: Use `followers_list` to build follow relationship graphs
4. **Performance Optimization**: Prioritize `user_actions_sampled` over full `user_actions` for large-scale analysis
5. **Community Analysis**: Use `community_id` in `user_stats` to segment users by community
---
## Data Statistics
- **Total unique users**: 8,294 (from `final_users`)
- **Total actions recorded**: 27.7 billion (from `user_actions`)
- **Total follow relationships**: 728,506 (from `followers_list`)
- **Sampled actions**: 1.7 million (from `user_actions_sampled`)
**Dataset Source**: Based on the Bluesky dataset from [Failla & Rossetti (2024)](https://doi.org/10.1371/journal.pone.0310330)