Finish off the links between frontend and backend #10

Merged
dylan merged 24 commits from feat/add-frontend-pages into main 2026-03-18 20:30:19 +00:00
Showing only changes of commit 7e4a91bb5e - Show all commits

View File

@@ -1,14 +1,28 @@
// User Responses // Shared types
type TopUser = { type FrequencyWord = {
author: string; word: string;
source: string; count: number;
count: number
}; };
type FrequencyWord = { type NGram = {
word: string; count: number;
count: number; ngram: string;
} };
type Emotion = {
emotion_anger: number;
emotion_disgust: number;
emotion_fear: number;
emotion_joy: number;
emotion_sadness: number;
};
// User
type TopUser = {
author: string;
source: string;
count: number;
};
type Vocab = { type Vocab = {
author: string; author: string;
@@ -31,12 +45,9 @@ type User = {
type InteractionGraph = Record<string, Record<string, number>>; type InteractionGraph = Record<string, Record<string, number>>;
type ConversationConcentration = { type UserEndpointResponse = {
total_commenting_authors: number; top_users: TopUser[];
top_10pct_author_count: number; users: User[];
top_10pct_comment_share: number;
single_comment_authors: number;
single_comment_author_ratio: number;
}; };
type UserAnalysisResponse = { type UserAnalysisResponse = {
@@ -45,42 +56,24 @@ type UserAnalysisResponse = {
interaction_graph: InteractionGraph; interaction_graph: InteractionGraph;
}; };
type UserEndpointResponse = { // Time
top_users: TopUser[];
users: User[];
};
// Time Analysis
type EventsPerDay = { type EventsPerDay = {
date: Date; date: Date;
count: number; count: number;
} };
type HeatmapCell = { type HeatmapCell = {
date: Date; date: Date;
hour: number; hour: number;
count: number; count: number;
}
type TimeAnalysisResponse = {
events_per_day: EventsPerDay[];
weekday_hour_heatmap: HeatmapCell[];
}
// Content Analysis
type Emotion = {
emotion_anger: number;
emotion_disgust: number;
emotion_fear: number;
emotion_joy: number;
emotion_sadness: number;
}; };
type NGram = { type TimeAnalysisResponse = {
count: number; events_per_day: EventsPerDay[];
ngram: string; weekday_hour_heatmap: HeatmapCell[];
} };
// Content (combines emotional and linguistic)
type AverageEmotionByTopic = Emotion & { type AverageEmotionByTopic = Emotion & {
n: number; n: number;
topic: string; topic: string;
@@ -105,17 +98,17 @@ type EmotionBySource = {
event_count: number; event_count: number;
}; };
type ContentAnalysisResponse = { type ContentAnalysisResponse = {
word_frequencies: FrequencyWord[]; word_frequencies: FrequencyWord[];
average_emotion_by_topic: AverageEmotionByTopic[]; average_emotion_by_topic: AverageEmotionByTopic[];
common_three_phrases: NGram[]; common_three_phrases: NGram[];
common_two_phrases: NGram[]; common_two_phrases: NGram[];
overall_emotion_average?: OverallEmotionAverage[]; overall_emotion_average?: OverallEmotionAverage[];
dominant_emotion_distribution?: DominantEmotionDistribution[]; dominant_emotion_distribution?: DominantEmotionDistribution[];
emotion_by_source?: EmotionBySource[]; emotion_by_source?: EmotionBySource[];
} };
// Linguistic
type LinguisticAnalysisResponse = { type LinguisticAnalysisResponse = {
word_frequencies: FrequencyWord[]; word_frequencies: FrequencyWord[];
common_two_phrases: NGram[]; common_two_phrases: NGram[];
@@ -123,6 +116,7 @@ type LinguisticAnalysisResponse = {
lexical_diversity?: Record<string, number>; lexical_diversity?: Record<string, number>;
}; };
// Emotional
type EmotionalAnalysisResponse = { type EmotionalAnalysisResponse = {
average_emotion_by_topic: AverageEmotionByTopic[]; average_emotion_by_topic: AverageEmotionByTopic[];
overall_emotion_average?: OverallEmotionAverage[]; overall_emotion_average?: OverallEmotionAverage[];
@@ -130,6 +124,15 @@ type EmotionalAnalysisResponse = {
emotion_by_source?: EmotionBySource[]; emotion_by_source?: EmotionBySource[];
}; };
// Interactional
type ConversationConcentration = {
total_commenting_authors: number;
top_10pct_author_count: number;
top_10pct_comment_share: number;
single_comment_authors: number;
single_comment_author_ratio: number;
};
type InteractionAnalysisResponse = { type InteractionAnalysisResponse = {
average_thread_depth?: number; average_thread_depth?: number;
top_interaction_pairs?: [[string, string], number][]; top_interaction_pairs?: [[string, string], number][];
@@ -137,6 +140,7 @@ type InteractionAnalysisResponse = {
interaction_graph: InteractionGraph; interaction_graph: InteractionGraph;
}; };
// Cultural
type IdentityMarkers = { type IdentityMarkers = {
in_group_usage: number; in_group_usage: number;
out_group_usage: number; out_group_usage: number;
@@ -190,35 +194,35 @@ type SummaryResponse = {
sources: string[]; sources: string[];
}; };
// Filtering Response // Filter
type FilterResponse = { type FilterResponse = {
rows: number rows: number;
data: any; data: any;
} };
export type { export type {
TopUser, TopUser,
Vocab, Vocab,
User, User,
InteractionGraph, InteractionGraph,
ConversationConcentration, ConversationConcentration,
UserAnalysisResponse, UserAnalysisResponse,
UserEndpointResponse, UserEndpointResponse,
FrequencyWord, FrequencyWord,
AverageEmotionByTopic, AverageEmotionByTopic,
OverallEmotionAverage, OverallEmotionAverage,
DominantEmotionDistribution, DominantEmotionDistribution,
EmotionBySource, EmotionBySource,
SummaryResponse, SummaryResponse,
TimeAnalysisResponse, TimeAnalysisResponse,
ContentAnalysisResponse, ContentAnalysisResponse,
LinguisticAnalysisResponse, LinguisticAnalysisResponse,
EmotionalAnalysisResponse, EmotionalAnalysisResponse,
InteractionAnalysisResponse, InteractionAnalysisResponse,
IdentityMarkers, IdentityMarkers,
StanceMarkers, StanceMarkers,
EntityEmotionAggregate, EntityEmotionAggregate,
AverageEmotionPerEntity, AverageEmotionPerEntity,
CulturalAnalysisResponse, CulturalAnalysisResponse,
FilterResponse FilterResponse,
} };