Skip to content

Replace pandas-backed data_mod with a plain dict - #12

Merged
cmaureir merged 1 commit into
mainfrom
remove-pandas-data-mod
Aug 15, 2026
Merged

Replace pandas-backed data_mod with a plain dict#12
cmaureir merged 1 commit into
mainfrom
remove-pandas-data-mod

Conversation

@cmaureir

Copy link
Copy Markdown
Member

bot.data_mod was a DataFrame used purely as a keyed collection (mask by message_id, concat to append, iterrows to list) - no aggregation or numeric computation anywhere, evidenced by mod_row["x"].values[0] unwrapping scattered through moderacion.py. Replaced with a plain dict[message_id, dict], loaded via a new utils.read_csv_dicts() (csv.DictReader) instead of pd.read_csv.

  • bot.py: builds bot.data_mod as {message_id: row} directly, filtering out already-accepted/rejected ids via set operations instead of DataFrame masking.
  • moderacion.py: ValidatedPost.mod_row is now a plain dict (dropped the now-unneeded condition: pd.Series field); lookups are data_mod.get(post_id), removal is del data_mod[post_id], get_mod_pending iterates data.values().
  • pandas dropped from requirements.txt and every import.

bot.data_mod was a DataFrame used purely as a keyed collection (mask
by message_id, concat to append, iterrows to list) - no aggregation
or numeric computation anywhere, evidenced by mod_row["x"].values[0]
unwrapping scattered through moderacion.py. Replaced with a plain
dict[message_id, dict], loaded via a new utils.read_csv_dicts()
(csv.DictReader) instead of pd.read_csv.

- bot.py: builds bot.data_mod as {message_id: row} directly, filtering
  out already-accepted/rejected ids via set operations instead of
  DataFrame masking.
- moderacion.py: ValidatedPost.mod_row is now a plain dict (dropped
  the now-unneeded condition: pd.Series field); lookups are
  data_mod.get(post_id), removal is del data_mod[post_id],
  get_mod_pending iterates data.values().
- pandas dropped from requirements.txt and every import.
@cmaureir
cmaureir merged commit 82df150 into main Aug 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant