Datasets:
Request access to the OP-R1 Reddit corpus
This dataset contains pseudonymized but re-identifiable social-media content about substance use. Access is reviewed manually and granted only for public-health / harm-reduction research. Requests without a verifiable institutional affiliation and a specific research purpose will be declined.
DATA USE AGREEMENT — read in full before requesting access.
This corpus contains Reddit posts and comments about drug use, including opioids. Author usernames are replaced by salted HMAC pseudonyms, but the dataset retains original Reddit post/comment identifiers (id, link_id, parent_id). Those identifiers can be resolved on reddit.com to the original content and, where not deleted, to the author's real account. Treat every record as identifiable personal data concerning health and potentially criminal conduct.
By requesting access you represent that you have read this agreement and agree to be bound by it.
1. Permitted use. Aggregate public-health, harm-reduction, epidemiological, computational-social-science or NLP research, conducted under the oversight of an IRB / research ethics committee (or a documented determination that such oversight is not required in your jurisdiction).
2. Prohibited uses. You will NOT: (a) attempt to re-identify, deanonymize, unmask or determine the real-world identity of any individual, including by resolving retained Reddit identifiers, cross-referencing external data, or querying any API or web service with dataset content; (b) contact, message, survey, recruit, profile, monitor or surveil any individual represented in the data; (c) use the data for law-enforcement, prosecutorial, immigration, insurance, credit, employment or any other adverse determination about an individual; (d) use it for commercial purposes, advertising, or targeting; (e) use it to facilitate the acquisition or distribution of controlled substances; (f) publish, present or otherwise disclose any verbatim quotation, username, pseudonymous user_id, Reddit identifier, or any other detail that could reasonably permit identification of an individual.
3. No redistribution. You will not republish, mirror, share, sublicense, post to any public repository or model hub, or otherwise transfer the data or any substantial derivative of it, in whole or in part, to any third party. Access is personal to you. Collaborators must request access individually. Models trained on this data must not be released if they can reproduce identifying content.
4. Security. You will store the data on access-controlled systems, restrict access to named personnel covered by this agreement, and not upload it to third-party services (including commercial LLM APIs) that may retain, train on, or disclose it.
5. Underlying rights. Content remains the intellectual property of its original authors and is subject to the Reddit User Agreement. This dataset is a research derivative; nothing here grants you rights in the underlying content. You are responsible for your own compliance with Reddit's terms and with all applicable law, including GDPR, HIPAA and equivalents.
6. Deletion. You will delete all copies upon completion of the stated research, upon withdrawal of access, or on request of the maintainers.
7. Incident reporting. You will report any accidental disclosure, re-identification, breach, or loss of control of the data to the maintainer within 72 hours.
8. Publication. Report results in aggregate. Paraphrase rather than quote. Cite the dataset and the upstream arctic_shift project.
9. Termination. Access may be revoked at any time, with or without cause. Breach terminates your rights immediately and obliges you to delete all copies.
10. No warranty. Provided "as is", without warranty of any kind. The maintainers accept no liability arising from your use. The data is a non-representative convenience sample and must not be used for clinical, diagnostic, or individual decision-making purposes.
Log in or Sign Up to review the conditions and access this dataset content.
OP-Reddit-Post — 37 drug subreddits, 2016–2026
Post-level corpus of 46,934,806 Reddit submissions and comments from 37 drug-related subreddits, spanning 2016-01-01 → 2026-07-27. Built for OP-R1, a reasoning model for opioid-involvement detection from social-media history.
Access. Gated dataset — access requests are reviewed manually and granted only for public-health / harm-reduction research under ethics oversight. IRB-gated human-subjects material. Intended for aggregate harm-reduction research — not for surveillance, deanonymization, law enforcement, or any action targeting individuals.
Loading
Partitioned by subreddit, so one community can be pulled without downloading all 47M rows:
from datasets import load_dataset
ds = load_dataset("OP-R1/OP-Reddit-Post", "opiates", split="train") # one subreddit
full = load_dataset("OP-R1/OP-Reddit-Post", split="train") # everything
Layout
data/<subreddit>/part-NNNNN.parquet rows sorted by (user_id, created_utc)
index/user_index.parquet user_id -> file + row range
index/id_index.parquet id -> file + row offset
Two properties make targeted retrieval cheap:
- Rows are sorted by
user_id, and a given user is never split across files within a subreddit — so one user's records are always a single contiguous row range. - Small Parquet row groups (2,000 rows) mean an HTTP ranged read can pull just the groups covering that range instead of the whole file.
Efficient retrieval (without downloading the corpus)
index/user_index.parquet maps a user to their exact location:
| column | meaning |
|---|---|
user_id |
salted-HMAC pseudonym |
subreddit |
which partition |
path |
e.g. data/opiates/part-00003.parquet |
row_start, row_count |
contiguous row range inside that file |
first_utc, last_utc |
time span of that user's activity there |
index/id_index.parquet maps any id → path + row_offset, which is how you
resolve the anchor posts, parent comments and replies referenced by
OP-Reddit-User.
See Retrieval helper below — the module
ships inside this repo and is loaded with importlib.
Because 56% of users appear in exactly one subreddit (80% in ≤2), a typical lookup is one or two ranged reads of a few MB rather than a 6.8 GB download.
Retrieval helper (retrieve.py)
retrieve.py ships inside this dataset repo, so approved users get it with
the data — no separate install, and it is always versioned against the index
layout it was built for.
Note. The
datasetslibrary removed loading scripts (trust_remote_codeno longer exists as ofdatasetsv5), soload_datasetwill not import this file. Download and load it explicitly:
import importlib.util, sys
from huggingface_hub import hf_hub_download
path = hf_hub_download(
"OP-R1/OP-Reddit-Post", "retrieve.py", repo_type="dataset",
)
spec = importlib.util.spec_from_file_location("opr1_retrieve", path)
mod = importlib.util.module_from_spec(spec)
sys.modules["opr1_retrieve"] = mod # REQUIRED before exec_module (see below)
spec.loader.exec_module(mod)
r = mod.OpR1Retriever() # uses HF_TOKEN, or pass token=...
user = r.get_user("18a38e35a00f09e39207") # profile + threads + text
⚠️ sys.modules[...] = mod is not optional. retrieve.py uses
@dataclass(slots=True), whose class construction looks the module up in
sys.modules. Omitting that line fails with:
AttributeError: 'NoneType' object has no attribute '__dict__'
Requirements
pip install huggingface_hub fsspec pyarrow
CLI
The same file runs standalone:
python retrieve.py --user-id 18a38e35a00f09e39207 --out user.json
It reports bytes fetched and the number of HTTP range requests on stderr, so you can confirm it is doing ranged reads rather than pulling whole files.
What it does
- Looks the user up in
index/user_index.parquet→ file + contiguous row range - Reads only the row groups covering that range via HTTP range requests
- Resolves anchor posts, parents and replies through
index/id_index.parquet - Returns one nested structure with text filled in
Measured on a real user: 11.87 MB in 6 ranged reads (1.9 s) versus a 7.3 GB full download — about 615× less data.
Companion dataset
OP-R1/OP-Reddit-User
holds one row per user — profile, interaction summary, and thread/reply
structure — deliberately without text, so it stays small. Join it to this
dataset on id / link_id / parent_id to materialize the text.
1. Data sources
Two complementary sources, both derived from the arctic_shift Reddit archive. Neither content nor labels were authored by us.
| Source | Window | Subreddits | Records |
|---|---|---|---|
Torrent dump (Academic Torrents 56aa49f9653ba545f48df2e33679f014d2829c10) |
2016-01-01 → 2023-12-31 | 28 | 36,513,028 |
| arctic_shift HTTP API | 2024-01-01 → 2026-07-27 (+ full window for 9 subs) | 37 | 10,421,778 |
| Total | 2016-01-01 → 2026-07-27 | 37 | 46,934,806 |
Every row records its own provenance in the source column, so the two
collection paths stay auditable and separable:
ds.filter(lambda r: r["source"] == "api") # 10,421,778 rows
ds.filter(lambda r: r["source"] == "torrent") # 36,513,028 rows
Observed ranges by source: torrent = 2016-01-01 … 2023-12-31 (the dump's hard
cutoff); api = 2016-01-02 … 2026-07-27 — the early api dates are the 9
dump-absent subreddits, collected over their full window.
The torrent is listed in arctic_shift's download_links.md as
2005-06 - 2023-12 top 40k subreddits. That file documents the dump's existence
and link only — it is a two-column Release | link table and does not define
how the "top 40k" were selected. The criterion is stated on the linked Academic
Torrents page, which we could not fetch programmatically to quote verbatim.
9 subreddits are absent from the torrent (1V_LSD, 4acodmt, DMXE,
DrugCombos, MXE, MemantineHCl, PCP, AMT, anabolic) and were collected
entirely via the API. Their absence is a sampling artifact of the source, not
evidence they are inactive — each falls below the smallest subreddit the dump
does include, which is consistent with a volume-based cutoff.
2. Acquisition methodology
Fully scripted; code in src/data/ of the OP-R1 repository.
Torrent path. .torrent metadata fetched over HTTPS; a bencode parser mapped
target subreddit names to file indices; aria2c --select-file downloaded only
56 of 79,895 files (5.94 GB) rather than the full multi-TB archive. Each .zst
was stream-decompressed (max_window_size=2**31, byte-level newline splitting so
multi-byte UTF-8 is never severed), filtered by subreddit and date, and
normalized — parallelized as a 56-task array job on the Notre Dame CRC cluster.
API path. Paginated ascending by created_utc (100 rows/request, 1.5 s
politeness delay, rate-limit headers respected), checkpointed per
(subreddit, kind) so interruptions resume rather than restart. Collection was
sharded across four machines; two high-volume subreddits (Drugs, meth) were
further split by date range across machines. Split boundaries were verified
contiguous and pairwise id-disjoint before merging — no gaps, no duplicates.
Data-quality handling
Real dump records contain occasional type inconsistencies (e.g. parent_id
sometimes an integer rather than "t3_abc123"). The exporter coerces defensively
and reports counts rather than failing or silently corrupting: string columns
via str(), integer columns to null on unparseable values, and records with an
unusable created_utc are dropped and counted.
For this release: 0 records dropped, 1,785 values coerced. Rows out (46,934,806) equals rows in — no silent loss.
3. De-identification
This data is pseudonymized, not anonymized. §3.3 is essential reading.
3.1 Removed
| Field | Treatment |
|---|---|
author (username) |
Dropped. Never written to disk in any output. |
permalink |
Dropped — links directly back to the live thread. |
3.2 Author pseudonymization
user_id = HMAC-SHA256(secret_salt, username).hexdigest()[:20]
- Salt: 256-bit (
openssl rand -hex 32), stored mode0600on institutional storage, outside the dataset; never published or transmitted with the data. - Irreversibility: HMAC is one-way — the salt is not a decryption key and
cannot recover a username. What the salt does enable is confirmation and
enumeration: since Reddit usernames are public and enumerable, anyone holding
the salt could hash a username list and match it against
user_ids. A plain unsalted hash would offer no protection at all for this reason. - Stability: the same salt is reused across releases, so
user_idis consistent over time and joins to the OP-R1 user-level dataset (1,132,208 users). - Non-user accounts:
[deleted],[removed],AutoModerator→user_id = null(5,795,977 rows). Rows are kept for conversational context but are attributable to no user.
3.3 Residual re-identification risk — important
Reddit IDs are retained in cleartext. id, link_id and parent_id are the
live Reddit identifiers, deliberately left unhashed so conversation threads can
be reconstructed and annotators can consult original context when assigning
labels. The direct consequence:
Anyone holding this dataset can look up a row's
idon Reddit and see the original author's real username. No salt is required. For any content not since deleted, the author pseudonymization can therefore be bypassed by anyone able to browse Reddit.
This is a conscious trade-off (thread structure + annotation utility vs. linkage resistance), not an oversight. Hashing these fields with the same salt would preserve thread structure while severing the lookup path, and should be done before any release wider than the current private, IRB-gated distribution.
The text field is likewise unmodified free-form prose and may still contain
u/username mentions, self-disclosed location/age/employer/medical details, or
distinctive phrasing that is externally searchable. No text scrubbing and no
formal privacy guarantee (e.g. differential privacy) has been applied.
4. Data ranges
| Coverage | 2016-01-01 → 2026-07-27 (UTC) |
| Lower bound | Our filter — a ~10-year analysis window. Raw dumps reach to ~2008 (r/Drugs from 2008-02-09); re-parsing without the date floor recovers it at no extra download. |
| Upper bound | Collection date. The torrent alone stops at 2023-12-31; everything after is API-collected. |
Most subreddits start at the 2016-01-01 floor; later starts (e.g. modafinil
2016-11-16, 5MeODMT 2016-06-22, fentanyl 2016-03-08) reflect when the
community or its activity began, not gaps in collection. A few end before
2026-07 where the community went inactive or was banned (e.g. anabolic
2025-08-11).
Per-subreddit breakdown
| Subreddit | Rows | Posts | Comments | First | Last |
|---|---|---|---|---|---|
Drugs |
12,284,700 | 989,774 | 11,294,926 | 2016-01-01 | 2026-07-27 |
LSD |
6,361,934 | 612,211 | 5,749,723 | 2016-01-01 | 2026-07-26 |
opiates |
4,592,852 | 322,868 | 4,269,984 | 2016-01-01 | 2026-07-26 |
cocaine |
4,127,039 | 732,132 | 3,394,907 | 2016-01-01 | 2026-07-27 |
DMT |
2,599,118 | 204,192 | 2,394,926 | 2016-01-01 | 2026-07-26 |
MDMA |
2,457,975 | 240,902 | 2,217,073 | 2016-01-01 | 2026-07-27 |
meth |
2,410,585 | 216,372 | 2,194,213 | 2016-01-04 | 2026-07-27 |
benzodiazepines |
2,352,722 | 241,865 | 2,110,857 | 2016-01-01 | 2026-07-26 |
dxm |
1,869,737 | 181,775 | 1,687,962 | 2016-01-01 | 2026-07-27 |
Nootropics |
1,658,708 | 154,486 | 1,504,222 | 2016-01-01 | 2026-07-27 |
treedibles |
817,940 | 77,359 | 740,581 | 2016-01-01 | 2026-07-27 |
ketamine |
798,317 | 78,175 | 720,142 | 2016-01-01 | 2026-07-27 |
CannabisExtracts |
756,382 | 64,133 | 692,249 | 2016-01-01 | 2026-07-26 |
DPH |
662,975 | 69,570 | 593,405 | 2016-01-02 | 2026-07-26 |
Ayahuasca |
429,680 | 31,988 | 397,692 | 2016-01-01 | 2026-07-26 |
2cb |
391,416 | 35,022 | 356,394 | 2016-01-25 | 2026-07-26 |
fentanyl |
354,467 | 30,396 | 324,071 | 2016-03-08 | 2026-07-27 |
adderall |
323,560 | 66,403 | 257,157 | 2016-01-01 | 2024-07-11 |
cannabis |
255,977 | 42,304 | 213,673 | 2016-01-01 | 2026-07-27 |
ambien |
254,144 | 40,283 | 213,861 | 2016-01-01 | 2026-07-27 |
mescaline |
227,437 | 18,035 | 209,402 | 2016-01-03 | 2026-07-27 |
LSA |
187,177 | 24,817 | 162,360 | 2016-01-03 | 2026-07-26 |
dissociatives |
170,681 | 11,957 | 158,724 | 2016-01-01 | 2026-07-27 |
modafinil |
160,650 | 18,434 | 142,216 | 2016-11-16 | 2026-07-27 |
1P_LSD |
123,855 | 12,252 | 111,603 | 2016-01-01 | 2026-07-25 |
afinil |
99,918 | 13,464 | 86,454 | 2016-01-01 | 2026-06-25 |
5MeODMT |
95,987 | 7,524 | 88,463 | 2016-06-22 | 2026-07-26 |
noids |
39,765 | 6,435 | 33,330 | 2016-01-01 | 2026-07-26 |
4acodmt |
25,717 | 2,544 | 23,173 | 2017-01-07 | 2026-07-26 |
MemantineHCl |
16,773 | 1,787 | 14,986 | 2017-01-05 | 2026-07-11 |
1V_LSD |
8,419 | 1,013 | 7,406 | 2021-07-07 | 2026-07-24 |
PCP |
7,439 | 699 | 6,740 | 2016-01-12 | 2026-07-08 |
MXE |
3,385 | 393 | 2,992 | 2016-01-02 | 2026-07-22 |
DMXE |
2,984 | 335 | 2,649 | 2020-12-11 | 2026-07-03 |
DrugCombos |
2,115 | 610 | 1,505 | 2016-02-06 | 2026-07-23 |
anabolic |
1,244 | 525 | 719 | 2016-01-11 | 2025-08-11 |
AMT |
1,032 | 249 | 783 | 2016-02-16 | 2026-07-11 |
Statistics
| Metric | Value |
|---|---|
| Rows | 46,934,806 |
Submissions (kind="post") |
4,553,283 (9.7%) |
Comments (kind="comment") |
42,381,523 (90.3%) |
Distinct user_id |
2,195,320 |
Rows with user_id = null |
5,795,977 (12.3%) |
Rows by source |
torrent 36,513,028 · api 10,421,778 |
| Subreddits | 37 |
| Files | 73 Parquet shards, 6.4 GB |
Column reference
Every row is one Reddit submission or one comment.
| Column | Type | Meaning |
|---|---|---|
id |
string |
Reddit's own base-36 identifier for this item (e.g. d62k7k3). Unique within a kind, not globally — key on (kind, id). This is a live Reddit id: see §3.3. |
kind |
string |
"post" = a submission (thread starter). "comment" = a reply inside a thread. Determines how text, link_id and parent_id behave. |
subreddit |
string |
Community the item was posted in, original capitalization (e.g. Drugs, 1P_LSD). Also the partition directory name. |
source |
string |
How this row was collected. torrent = bulk arctic_shift dump (2016-01-01 → 2023-12-31). api = live arctic_shift HTTP API (the 2024→2026 tail, and the full window for the 9 subreddits absent from the dump). Never null. |
user_id |
string (nullable) |
Pseudonymous author id — salted HMAC of the username (§3.2). Stable across rows and across the OP-R1 user-level dataset, so it is the key for grouping a person's full history. null when the author was [deleted]/[removed]/AutoModerator. |
created_utc |
int64 |
Post time, Unix seconds UTC. Use for chronological ordering and time-window slicing. |
text |
string |
The content. For a post: title + "\n\n" + selftext (title alone if there is no body). For a comment: the comment body. Unmodified prose — see §3.3. |
score |
int64 (nullable) |
Net votes at the time of archival, not current. Treat as a weak popularity signal, not ground truth. |
link_id |
string (nullable) |
For comments: the submission the comment belongs to, as t3_<id>. null for posts. All comments sharing a link_id are in the same thread. |
parent_id |
string (nullable) |
For comments: the immediate parent. t3_<id> = a top-level comment replying to the post; t1_<id> = a reply to another comment. null for posts. |
Reddit type prefixes
link_id/parent_id use Reddit's "fullname" format — a type prefix plus a base-36 id:
| Prefix | Refers to |
|---|---|
t1_ |
a comment |
t3_ |
a submission (post) |
Reconstructing a thread
# all comments in one thread
thread = ds.filter(lambda r: r["link_id"] == "t3_4v3or3")
# a comment's parent: strip the prefix and match against `id`
parent_key = row["parent_id"].split("_", 1)[1] # "t1_dbr0c7i" -> "dbr0c7i"
# parent is a post if parent_id starts with t3_, else another comment
Worked example (real rows from fentanyl):
| kind | id | link_id | parent_id | reads as |
|---|---|---|---|---|
| post | 49hs15 |
null |
null |
thread starter |
| comment | d62k7k3 |
t3_4v3or3 |
t3_4v3or3 |
top-level reply to post 4v3or3 |
| comment | dbrp9pv |
t3_5jto90 |
t1_dbr0c7i |
reply to comment dbr0c7i, in thread 5jto90 |
When link_id == parent_id, the comment is top-level; when they differ, it is
nested under another comment.
For the OP-R1 task
Group by user_id and order by created_utc to obtain a user's full posting
history — the classification unit for buyer/seller/user. link_id/parent_id
supply conversational context (what a user was responding to), which often
carries the intent signal that an isolated comment lacks.
Intended use & limitations
Intended: aggregate public-health and harm-reduction research — modeling opioid involvement, studying discourse, designing early intervention.
Out of scope: identifying or profiling individuals; law-enforcement or punitive use; contacting users; any deployment implying clinical diagnosis.
Limitations
- Not a population sample. Reddit drug-subreddit participants are self-selected and skew young, Western, English-speaking, internet-active.
- Survivorship bias — most consequential for this task. Moderation removes exactly the sourcing/transaction language that distinguishes buyer from seller, so those signals are systematically under-represented relative to their true prevalence.
- Class imbalance. Explicit sourcing content is rare next to experience-sharing.
- Comment-dominated (90.3%), so most user evidence is short conversational text rather than long-form posts.
- Point-in-time
scoreas archived; not current. - No labels.
role(buyer/seller/user) is not present — this is an unlabeled corpus.
Provenance & citation
Derived from arctic_shift; cite that project for the underlying archive. Reddit content belongs to its original authors.
Maintainer: Tianyi (Billy) Ma · tma2@nd.edu · University of Notre Dame
- Downloads last month
- -