DEV Community

 AI Automation Enterenpeur
AI Automation Enterenpeur

Posted on

Let Your Users Pick the Next Lesson: Group Feedback Replies With Python

If you write tutorials, docs, or a course, you've probably asked "what should I cover next?" and then guessed. There's a better loop: ship one lesson, ask readers "What's still unclear?", and let the most common answer decide the next lesson.

The tedious part is reading every reply and tallying themes. Let's automate that with a short Python script.

The input

Export or paste the replies into a CSV called replies.csv with one column, reply:

reply
I got lost setting up the API key
How do I schedule it to run daily?
Where do I put the API key?
Can this run on a schedule?
What about error handling?
Enter fullscreen mode Exit fullscreen mode

The idea

We'll define a few themes, each with keywords. Each reply gets counted under every theme it matches. Anything that matches nothing goes into an "other" list so you can read it and add new themes later. No external libraries needed.

The script

import csv
from collections import Counter

THEMES = {
    "auth / api keys": ["api key", "token", "auth", "credential"],
    "scheduling": ["schedule", "daily", "cron", "every day"],
    "errors": ["error", "fail", "crash", "retry"],
    "setup": ["install", "setup", "setting up", "lost"],
}

def classify(text):
    text = text.lower()
    return [name for name, words in THEMES.items()
            if any(w in text for w in words)]

counts = Counter()
unmatched = []

with open("replies.csv", newline="", encoding="utf-8") as f:
    for row in csv.DictReader(f):
        reply = row["reply"].strip()
        if not reply:
            continue
        themes = classify(reply)
        if themes:
            counts.update(themes)
        else:
            unmatched.append(reply)

print("Next lesson candidates:")
for theme, n in counts.most_common():
    print(f"  {n:>3}  {theme}")

if unmatched:
    print("\nUnmatched replies (read these):")
    for r in unmatched:
        print("  -", r)
Enter fullscreen mode Exit fullscreen mode

Running it on the sample prints something like:

Next lesson candidates:
    2  auth / api keys
    2  scheduling
    1  setup
    1  errors
Enter fullscreen mode Exit fullscreen mode

API keys and scheduling are tied at the top, so either is a strong pick for lesson 2.

Making it better

Grow the theme list. Every week, read the unmatched replies and add keywords. After a few rounds the script catches nearly everything.

Track over time. Append each week's counts to a history CSV with a date column, so you can see which confusions go away once you publish a lesson.

Swap in an LLM later. If keyword matching gets clumsy, send the unmatched replies to an LLM and ask it to suggest a theme name. Keep the keyword pass first, since it's free and predictable.

Run it on a schedule. Drop it into a cron job or a GitHub Action that reads a shared sheet export every Monday and posts the top theme to your team chat.

Why bother

Every lesson you publish answers a question someone actually asked. Your content stays small and focused, and readers come back because they see their questions turned into the next lesson.

I'm building courses with this loop alongside other builders in Automation Entrepreneur: https://www.skool.com/automation-enterenpeur-7666

Top comments (0)