File size: 3,843 Bytes
f252ea9
 
 
 
 
 
 
e908cb2
f252ea9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340244c
 
 
 
58b1050
340244c
 
 
 
 
 
8fec1f4
 
bfed44d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# config.py
"""
Global configuration constants for the LinkedIn Organization Dashboard.
"""

# --- LinkedIn Post Constants ---
DEFAULT_INITIAL_FETCH_COUNT = 10
DEFAULT_POSTS_UPDATE_FETCH_COUNT = 10
LINKEDIN_POST_URN_KEY = 'id' # Key for post URN in LinkedIn API response
BUBBLE_POST_URN_COLUMN_NAME = 'id' # Column name for unique post ID in Bubble 'LI_posts' table
BUBBLE_POST_DATE_COLUMN_NAME = 'published_at' # Column name for post publication date in Bubble 'LI_posts' table
BUBBLE_POSTS_TABLE_NAME = "LI_posts"
BUBBLE_POST_STATS_TABLE_NAME = "LI_post_stats"
BUBBLE_POST_COMMENTS_TABLE_NAME = "LI_post_comments"

# --- LinkedIn Mentions Constants ---
BUBBLE_MENTIONS_TABLE_NAME = "LI_mentions"
BUBBLE_MENTIONS_ID_COLUMN_NAME = "id" # Column name for unique mention ID in Bubble
BUBBLE_MENTIONS_DATE_COLUMN_NAME = "date" # Column name for mention date in Bubble
DEFAULT_MENTIONS_INITIAL_FETCH_COUNT = 20
DEFAULT_MENTIONS_UPDATE_FETCH_COUNT = 10

# --- LinkedIn Follower Stats Constants ---
BUBBLE_FOLLOWER_STATS_TABLE_NAME = "LI_follower_stats"
FOLLOWER_STATS_CATEGORY_COLUMN = "category_name" # For demographics: name (e.g., "Engineering"), for monthly gains: date string 'YYYY-MM-DD'
FOLLOWER_STATS_TYPE_COLUMN = "follower_count_type" # e.g., "follower_seniority", "follower_gains_monthly"
FOLLOWER_STATS_ORG_URN_COLUMN = "organization_urn" # URN of the organization
FOLLOWER_STATS_ORGANIC_COLUMN = "follower_count_organic"
FOLLOWER_STATS_PAID_COLUMN = "follower_count_paid"
FOLLOWER_STATS_CATEGORY_COLUMN_DT = 'category_name_dt' # Temporary column for datetime conversion

# --- Environment Variable Names (Optional, for consistency if checking elsewhere) ---
LINKEDIN_CLIENT_ID_ENV_VAR = "Linkedin_client_id"
BUBBLE_APP_NAME_ENV_VAR = "BUBBLE_APP_NAME"
BUBBLE_API_KEY_PRIVATE_ENV_VAR = "BUBBLE_API_KEY_PRIVATE"
BUBBLE_API_ENDPOINT_ENV_VAR = "BUBBLE_API_ENDPOINT"

# --- UI Constants ---
UI_DATE_FORMAT = '%Y-%m-%d %H:%M'
UI_MONTH_FORMAT = '%Y-%m'

# --- NEW CONSTANTS for LinkedIn Data Operations Log ---
BUBBLE_OPERATIONS_LOG_TABLE_NAME = "linkedin_data_operations_log"
# Column names in the 'linkedin_data_operations_log' table in Bubble:
BUBBLE_OPERATIONS_LOG_DATE_COLUMN = "data" # Stores the timestamp of the sync attempt
BUBBLE_OPERATIONS_LOG_SUBJECT_COLUMN = "linkedin_data_operation_subject" # e.g., "post", "mention", "follower_stats"
BUBBLE_OPERATIONS_LOG_ORG_URN_COLUMN = "organization_urn" # Stores the org URN

# Standardized subject names for the operations log
LOG_SUBJECT_POSTS = "post"
LOG_SUBJECT_MENTIONS = "mention"
LOG_SUBJECT_FOLLOWER_STATS = "followers_stats"

BUBBLE_UNIQUE_ID_COLUMN_NAME = "_id"

# Mapping from plot_configs IDs to PLOT_FORMULAS keys
PLOT_ID_TO_FORMULA_KEY_MAP = {
    "posts_activity": "posts_activity", 
    "mentions_activity": "mentions_activity", 
    "mention_sentiment": "mention_sentiment", 
    "followers_count": "followers_count_over_time",
    "followers_growth_rate": "followers_growth_rate",
    "followers_by_location": "followers_by_demographics",
    "followers_by_role": "followers_by_demographics",
    "followers_by_industry": "followers_by_demographics",
    "followers_by_seniority": "followers_by_demographics",
    "engagement_rate": "engagement_rate_over_time",
    "reach_over_time": "reach_over_time",
    "impressions_over_time": "impressions_over_time",
    "likes_over_time": "likes_over_time",
    "clicks_over_time": "clicks_over_time",
    "shares_over_time": "shares_over_time",
    "comments_over_time": "comments_over_time",
    "comments_sentiment": "comments_sentiment_breakdown",
    "post_frequency_cs": "post_frequency",
    "content_format_breakdown_cs": "content_format_breakdown",
    "content_topic_breakdown_cs": "content_topic_breakdown",
    "mention_analysis_volume": "mentions_activity", 
    "mention_analysis_sentiment": "mention_sentiment"
}