Py’otrMuhammad Toheed Sahar

Patient-community signal extraction from public forums

I built a small pipeline that reads public patient posts, strips personal details at capture, has an LLM pull structured facts from each one, and builds two research tables where every number traces back to a post.

Client
A health-research request
Year
2026
Type
Data & pipelines · Demo

The problem

A research request wanted patient-reported experiences from public online communities turned into structured tables. The rules were strict: nothing that identifies a poster could be collected, and the output could not recommend, rank or imply that any treatment works.

How I built it

Phase 1 collects posts from two public communities through their RSS feeds and keeps only six fields (record ID, source, title, date, post text, URL), scrubbing any email or user handle typed inside a post. Phase 2 makes one LLM call per post against a fixed JSON schema, with the model told to act as a neutral recorder, and every row carries its record ID and a short verbatim quote. Phase 3 builds two tables: a signal framework (per intervention, how many people reported it, outcome counts, evidence IDs) and a list of emerging research questions.

What got hard

  1. Reddit's JSON API began returning 403 to non-browser clients, and its feeds rate-limit unauthenticated requests quickly.

    I switched to the public RSS feed, which carries the same content and permalinks without a login, and added exponential backoff on 429 and 503 plus a pause between feeds.

  2. Privacy had to hold from the first byte, not be cleaned up afterwards.

    The collector never writes anything beyond the six requested fields, scrubs inline emails and handles as a second line of defence, and stops with an assertion if a banned field such as username, email, avatar or replies ever appears.

  3. The output could not drift into medical advice or efficacy claims.

    The extraction prompt only records what the patient says, signal strength is a plain count band (Emerging, Moderate, Strong) rather than a verdict, and every row links back to its evidence IDs so any figure can be checked against the source post.

  4. The LLM endpoint refused connections when too many requests ran at once.

    I capped extraction at three parallel workers and kept the model and endpoint configurable so the whole corpus could be re-run cheaply while tuning the schema.

The result

The demo run took 50 public posts, identified 40 as personal patient accounts, and produced a 66-row intervention table with outcome counts and evidence IDs plus an 8-row research-priorities table, with XLSX, CSV and a preview image.