fix(db): missing post ID in db schema
Caused surprisingly little errors. It only broke the interaction graph.
This commit is contained in:
@@ -127,8 +127,8 @@ class InteractionAnalysis:
|
|||||||
def interaction_graph(self, df: pd.DataFrame):
|
def interaction_graph(self, df: pd.DataFrame):
|
||||||
interactions = {a: {} for a in df["author"].dropna().unique()}
|
interactions = {a: {} for a in df["author"].dropna().unique()}
|
||||||
|
|
||||||
# reply_to refers to the comment id, this allows us to map comment ids to usernames
|
# reply_to refers to the comment id, this allows us to map comment/post ids to usernames
|
||||||
id_to_author = df.set_index("id")["author"].to_dict()
|
id_to_author = df.set_index("post_id")["author"].to_dict()
|
||||||
|
|
||||||
for _, row in df.iterrows():
|
for _, row in df.iterrows():
|
||||||
a = row["author"]
|
a = row["author"]
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class DatasetManager:
|
|||||||
query = """
|
query = """
|
||||||
INSERT INTO events (
|
INSERT INTO events (
|
||||||
dataset_id,
|
dataset_id,
|
||||||
|
post_id,
|
||||||
type,
|
type,
|
||||||
parent_id,
|
parent_id,
|
||||||
author,
|
author,
|
||||||
@@ -78,13 +79,14 @@ class DatasetManager:
|
|||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s, %s, %s, %s, %s,
|
%s, %s, %s, %s, %s,
|
||||||
%s
|
%s, %s
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
values = [
|
values = [
|
||||||
(
|
(
|
||||||
dataset_id,
|
dataset_id,
|
||||||
|
row["id"],
|
||||||
row["type"],
|
row["type"],
|
||||||
row["parent_id"],
|
row["parent_id"],
|
||||||
row["author"],
|
row["author"],
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ CREATE TABLE events (
|
|||||||
/* Required Fields */
|
/* Required Fields */
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
dataset_id INTEGER NOT NULL,
|
dataset_id INTEGER NOT NULL,
|
||||||
|
|
||||||
|
post_id VARCHAR(255) NOT NULL,
|
||||||
type VARCHAR(255) NOT NULL,
|
type VARCHAR(255) NOT NULL,
|
||||||
|
|
||||||
author VARCHAR(255) NOT NULL,
|
author VARCHAR(255) NOT NULL,
|
||||||
|
|||||||
Reference in New Issue
Block a user