FragDBnet's picture
v5.19: 142,676 fragrances (+1,135), incremental release, refreshed reviews and news
6dca920 verified
|
Raw History Blame Contribute Delete
28 kB
# Fragrantika News & Comments Datasets — Technical Specification
**Snapshot date:** 2026-10-19 (v5.19)
**Source:** `fragrantica.com` and 22 localized domains (`fragrantica.de`, `fragrantica.ru`, etc.)
**Format:** Apache Parquet (Zstandard compression)
**Total combined size:** ~1.56 GB on disk
This document specifies three datasets that complement the existing
Fragrantika perfume database (`merged_database`, `brands_database_v2`,
`perfumers_database_v2`, `notes_database_v2` — already documented and sold
separately):
1. **`comments.parquet`** — user reviews on individual perfumes
2. **`news.parquet`** — editorial articles published on Fragrantika
3. **`news_comments.parquet`** — user comments under those articles
The cross-dataset relationships in §5 explain how to join these with the
existing perfume/brand/perfumer DBs via primary keys.
---
## 1. Overview
| Dataset | Rows | Compressed Size | Distinct entities |
|---|---:|---:|---:|
| `comments.parquet` | 5,024,093 | 1.41 GB | 98,252 perfumes, 23 languages |
| `news.parquet` | 25,875 articles | 115 MB | NID 1..26385 |
| `news_comments.parquet` | 279,843 | 37 MB | 23,117 articles with comments |
All three datasets share the same identifier conventions used by the
existing perfume/brand/perfumer databases:
- **PID** (`int32`) — unique perfume identifier; matches `merged_database.PID`.
- **NID** (`int32`) — unique news article identifier (1..26385 range).
- **lang** (`string`) — ISO 639-1 language code identifying which Fragrantika
domain the content was sourced from. Each domain hosts independent
user-generated content (reviews are not translations of one another).
---
## 2. Dataset 1: `comments.parquet`
User-written reviews of individual perfumes, scraped across 23 localized
Fragrantika domains. Each comment is a unique user review, not a translation
or syndication.
### 2.1 Schema (8 fields)
| # | Field | Type | NULL? | Description |
|---:|---|---|---|---|
| 1 | `pid` | `int32` | NO | Foreign key → `merged_database.PID`. Identifies the perfume being reviewed. |
| 2 | `lang` | `string` | NO | Domain language (`en`, `ru`, `de`, …). 23 distinct values. |
| 3 | `comment_id` | `string` | NO | Globally unique deterministic ID, format `{pid}_{lang}_{12hex}` where `12hex` is the first 12 hexadecimal characters of `sha1(author + "|" + date + "|" + text)`. Stable across re-scrapes. |
| 4 | `author` | `string` | NO | Username as displayed on Fragrantika. May contain Unicode (e.g. `José`, `Søren`, `李明`). |
| 5 | `date` | `string` | NO | Date published as it appears on the page. Most rows: `MM/DD/YY HH:MM` (e.g., `04/11/26 10:05`). Always present. |
| 6 | `text` | `large_string` (64-bit offsets) | NO | Review body. UTF-8, no HTML tags, paragraph breaks via `\n`. May contain emoji. Length range observed: 1 char (emoji-only) to ~120 KB. |
| 7 | `avatar_url` | `string` | NO | Full URL to the user's avatar image hosted on Fragrantika's CDN. Verified ~100% reachable. |
| 8 | `gradient_class` | `string` | NO | Fragrantika's CSS class for the user's color badge (e.g., `tw-gradient-rose`). 7 distinct values observed (`tw-gradient-amber`/`emerald`/`orange`/`rose`/`sky`/`teal`/`violet`). Useful for UI consistency if displaying. |
### 2.2 Volumetrics
- **Total rows:** 5,024,093
- **Distinct PIDs covered:** 98,252 — 98,240 of the 142,676 perfumes in `fragrances.csv` (68.9%), plus 12 perfumes no longer in the catalogue; the remaining 44,436 perfumes have zero reviews
- **PID range:** 1 — 145,291
- **Languages:** 23 (full list in §2.3)
### 2.3 Language distribution
| Lang | Code | Comments | Distinct PIDs |
|---|---|---:|---:|
| English | `en` | 1,914,933 | 81,642 (57% of perfumes) |
| Russian | `ru` | 938,870 | 55,094 |
| Portuguese (Brazilian) | `pt` | 283,681 | 23,258 |
| Spanish | `es` | 245,951 | 28,294 |
| Korean | `ko` | 215,074 | 11,707 |
| Turkish | `tr` | 192,846 | 11,820 |
| Japanese | `ja` | 188,341 | 10,846 |
| Polish | `pl` | 154,223 | 27,026 |
| Italian | `it` | 126,169 | 23,488 |
| Serbian | `sr` | 110,402 | 15,348 |
| Hungarian | `hu` | 109,532 | 11,568 |
| Swedish | `sv` | 108,006 | 11,166 |
| German | `de` | 101,525 | 15,749 |
| Hebrew | `he` | 83,236 | 10,257 |
| Ukrainian | `uk` | 53,175 | 16,523 |
| French | `fr` | 48,534 | 14,510 |
| Arabic | `ar` | 37,302 | 9,818 |
| Greek | `el` | 29,626 | 8,838 |
| Czech | `cs` | 24,435 | 3,468 |
| Chinese (Simplified) | `zh` | 16,017 | 4,585 |
| Dutch | `nl` | 15,442 | 6,682 |
| Romanian | `ro` | 14,632 | 6,648 |
| Mongolian | `mn` | 12,141 | 2,062 |
Each `lang` represents an independent set of user reviews from the
corresponding national Fragrantika domain. A user reviewing the same
perfume on `fragrantica.com` (en) and `fragrantica.ru` (ru) would write
two distinct reviews; both are included.
### 2.4 ID generation
`comment_id` is content-derived (sha1-based), giving three properties:
- **Globally unique** across all 5.0M rows (0 collisions in v5.19).
- **Stable across re-scrapes**: re-fetching the same comment yields the same
ID. Useful for incremental updates and joining with downstream tables.
- **Idempotent dedup key**: `(nid, comment_id)` and `comment_id` alone are
both safe primary keys.
---
## 3. Dataset 2: `news.parquet`
Editorial articles from `fragrantica.com/news/` (English-only). Covers the
entire archive 2008-2026 (NID 1..26385), including both archived legacy
articles and modern editorial content.
### 3.1 Schema (16 fields)
| # | Field | Type | NULL? | Description |
|---:|---|---|---|---|
| 1 | `nid` | `int32` | NO | News article ID. Range 1..26385. |
| 2 | `title` | `string` | NO | Article title. Plain text, HTML entities decoded. |
| 3 | `category` | `string` | NO | Editorial category (e.g., `New Fragrances`, `Fragrance Reviews`, `Interviews`). 30+ distinct values. Top 10 in §3.4. |
| 4 | `author` | `string` | YES | Comma-separated list of author names (multi-author articles common). |
| 5 | `description` | `string` | YES | Short summary from `<meta property="og:description">`. Plain text. |
| 6 | `text` | `string` | NO | Full article body. Plain text, paragraph breaks via `\n`. Footer/byline blocks stripped. UTF-8. |
| 7 | `text_html` | `string` | NO | Article body **with original HTML preserved** — `<p>`, `<a>`, `<img>`, embedded videos. Useful for rendering or DOM-aware downstream processing. |
| 8 | `main_image` | `string` | YES | URL to the article's primary image (Fragrantika CDN). Verified reachable. |
| 9 | `article_images` | `string` | NO | **JSON-encoded array** of all image URLs in the article body. Use `json.loads(field)` → `list[str]`. Empty array `'[]'` if none. |
| 10 | `url` | `string` | NO | Canonical article URL (e.g., `https://www.fragrantica.com/news/x-12345.html`). |
| 11 | `is_archived` | `bool` | NO | `True` if article is in Fragrantika's legacy/archived corpus (older HTML template, often missing publication date — see §3.5). |
| 12 | `related_pids` | `string` | NO | **JSON-encoded array** of PIDs (as decimal strings) referenced in the article. Foreign key → `merged_database.PID`. 176 of 127,137 references (0.14%) point to perfumes no longer in the catalogue. |
| 13 | `related_brands` | `string` | NO | **JSON-encoded array** of brand names. Informational metadata; see §5.4 for canonical resolution. |
| 14 | `related_perfumers` | `string` | NO | **JSON-encoded array** of perfumer names with diacritics preserved (e.g., `François Demachy`, `Carlos Benaïm`). Informational; see §5.5. |
| 15 | `comments_count` | `int32` | NO | Count of comments in `news_comments.parquet` matching this NID. |
| 16 | `date_unix` | `int64` | NO | Publication time as Unix timestamp (seconds since epoch). `0` indicates the date is not extractable from the source HTML — see §3.5. |
### 3.2 Volumetrics
- **Total rows:** 25,875 articles
- **NID range:** 1 — 26,385 (510 NIDs in that range are absent from the source)
- **Archived:** 15,458 / 25,875 (59.7%)
- **Non-archived:** 10,417 / 25,875 (40.3%)
- **With publication date (`date_unix > 0`):** 15,089 (58.3%)
### 3.3 List-fields format note
Four fields hold lists: `article_images`, `related_pids`, `related_brands`,
`related_perfumers`. **All four are stored as JSON-encoded strings** for
consistency. Use:
```python
import json
images = json.loads(row['article_images']) # → list[str]
```
`related_pids` contains PID values as decimal strings (e.g., `'704'`, not
the int `704`). Cast as needed when joining.
### 3.4 Top categories
| Category | Articles | % |
|---|---:|---:|
| New Fragrances | 8,778 | 33.9% |
| Fragrance Reviews | 6,224 | 24.1% |
| Niche Perfumery | 2,622 | 10.1% |
| Art Books Events | 1,654 | 6.4% |
| Columns | 1,492 | 5.8% |
| Fragrant Horoscope | 877 | 3.4% |
| Fragrance News | 817 | 3.2% |
| Interviews | 693 | 2.7% |
| Vintages | 456 | 1.8% |
| Raw Materials | 397 | 1.5% |
Remaining 1,865 articles span 35 smaller categories.
### 3.5 Date coverage
`date_unix == 0` for 10,786 articles (41.7%). Distribution by NID range:
| NID range | Articles | with date | % | archived % |
|---|---:|---:|---:|---:|
| 1 — 5,000 | 4,898 | 2 | 0.0% | 100% |
| 5,001 — 10,000 | 4,803 | 0 | 0.0% | 100% |
| 10,001 — 15,000 | 4,905 | 3,837 | 78.2% | 100% |
| 15,001 — 20,000 | 4,915 | 4,915 | 100% | 17.3% |
| 20,001 — 25,000 | 4,971 | 4,971 | 100% | 0% |
| 25,001 — 26,385 | 1,383 | 1,364 | 98.6% | 0% |
Of the 10,786 articles without date, 10,767 come from the archived legacy
template: 9,699 in NIDs 1–10,000 (all but 2 of the 9,701 there) and 1,068 in
NIDs 10,001–15,000 (the remaining 22% of that range — the other 78% have
recoverable visible-text dates). Fragrantika's old archived HTML does not
embed any date marker (no `<time>`, no `<meta>`, no visible date string)
for these. This is an upstream HTML limitation, not a parser issue.
The other 19 are the newest non-archived articles (19 of the 23 with NID 26,363 and above) whose
date was not captured at collection time — a gap on our side, not an upstream limitation.
**Of the 10,417 non-archived articles, 10,398 have `date_unix` populated.**
---
## 4. Dataset 3: `news_comments.parquet`
User comments under news articles. Pure UGC; same comment-card schema
Fragrantika uses on perfume pages.
### 4.1 Schema (9 fields)
| # | Field | Type | NULL? | Description |
|---:|---|---|---|---|
| 1 | `nid` | `int32` | NO | Foreign key → `news.parquet.nid` (0% orphan rate). |
| 2 | `comment_id` | `string` | NO | Comment ID as Fragrantika assigns it (page-anchor format). Globally unique within parquet. |
| 3 | `author` | `string` | NO | Commenter username. |
| 4 | `date` | `string` | NO | Date as displayed on page (e.g., `04/11/26 10:05`). |
| 5 | `date_unix` | `int64` | NO | Parsed Unix timestamp. **100% populated** (all rows have `date_unix > 0`). |
| 6 | `text` | `string` | NO | Comment body, plain text. |
| 7 | `avatar_url` | `string` | NO | Full URL to author avatar (Fragrantika CDN). |
| 8 | `gradient` | `string` | NO | CSS class for color badge (same scheme as `comments.parquet.gradient_class`). |
| 9 | `is_reply` | `bool` | NO | `True` if this comment is a reply to another comment (threaded discussion); `False` for root comments. 5.6% of rows are replies (15,786 / 279,843). |
### 4.2 Volumetrics
- **Total rows:** 279,843
- **Distinct NIDs:** 23,117 (89.3% of articles have at least one comment)
- **Replies:** 15,786 (5.6%)
- **Average comments per article (in articles with comments):** 12.1
---
## 5. Cross-dataset relationships
This section is the load-bearing piece for buyers integrating with the
existing perfume/brand/perfumer DBs.
### 5.1 Diagram
```
┌────────────────────────────────────────────────────────┐
│ merged_database.csv (existing, 142,676 perfumes) │
│ ───────────────────── │
│ PID ←──────────────────────┐ │
│ Brand │ │
│ Name │ │
│ noses_f (perfumers) │ │
│ ...30 fields total │ │
└────────────────────────────────┼───────────────────────┘
│
┌────────────────┴───────────────┐
│ │
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ comments.parquet │ │ news.parquet │
│ ──────────────────── │ │ ──────────────────── │
│ pid ─────────────►│ │ related_pids ───────►│
│ lang (23 langs) │ │ related_brands │
│ comment_id (sha1) │ │ related_perfumers │
│ author/date/text │ │ nid ◄────┐ │
│ +avatar/gradient │ │ ...16 fields total │
└──────────────────────┘ └──────────┼───────────┘
│
│
┌──────────┴───────────┐
│ news_comments.parquet│
│ ──────────────────── │
│ nid ─────────────────│ FK → news.nid
│ comment_id │
│ author/date/text │
│ is_reply │
└──────────────────────┘
```
### 5.2 Linking comments to perfumes (PID)
Foreign key: **`comments.pid → merged_database.PID`** — every row joins except 62 reviews on 12 perfumes no longer in the catalogue.
```sql
-- All English reviews for the perfume "Mugler Angel" (PID 704):
SELECT c.author, c.date, c.text
FROM read_parquet('comments.parquet') c
JOIN read_csv('merged_database.csv', delim='⏸') m ON c.pid = m.PID
WHERE m.Brand = 'Mugler' AND m.Name = 'Angel' AND c.lang = 'en'
ORDER BY c.date DESC LIMIT 100;
```
```python
import pyarrow.parquet as pq
import pyarrow.compute as pc
c = pq.read_table('comments.parquet')
angel_reviews = c.filter(pc.and_(pc.equal(c['pid'], 704),
pc.equal(c['lang'], 'en')))
```
### 5.3 Linking news to perfumes (related_pids)
Foreign key: **`news.related_pids → merged_database.PID`** — JSON-array
field; 127,137 references, of which 176 (0.14%) point to perfumes no longer in the catalogue.
```sql
-- All news mentioning Aventus (PID 9828):
SELECT nid, title, category, date_unix
FROM read_parquet('news.parquet')
WHERE list_contains(json_extract(related_pids, '$'), '9828');
```
```python
import json
n = pq.read_table('news.parquet')
mentions_aventus = []
for i, rp in enumerate(n.column('related_pids').to_pylist()):
if rp and '9828' in json.loads(rp):
mentions_aventus.append(i)
```
### 5.4 Linking news to brands
`news.related_brands` is a **JSON array of brand-name strings** (informational).
**Authoritative brand resolution** for any news article uses the PID:
```
news.related_pids → merged_database.PID → merged_database.Brand
```
The `related_brands` field is provided as supplementary metadata. Approx.
12% of strings in `related_brands` will not match `brands_database_v2.name`
exactly because Fragrantika has renamed some brands over time
(e.g., `Christian Dior` → `Dior`, `Annick Goutal` → `Goutal`,
`Paco Rabanne` → `Rabanne`). The original captured name is preserved.
For canonical brand lookup, always join via `related_pids`:
```sql
SELECT DISTINCT m.Brand
FROM read_parquet('news.parquet') n
JOIN read_csv('merged_database.csv', delim='⏸') m
ON list_contains(json_extract(n.related_pids, '$'), CAST(m.PID AS VARCHAR))
WHERE n.nid = 17644;
```
### 5.5 Linking news to perfumers
Same pattern as brands. `news.related_perfumers` is a **JSON array of perfumer-name
strings** with diacritics preserved (e.g., `François Demachy`, `Carlos Benaïm`,
`Cécile Zarokian` — verified canonical post-fix).
**Authoritative perfumer resolution** uses PID:
```
news.related_pids → merged_database.PID → merged_database.noses_f
```
`merged_database.noses_f` contains the full list of perfumers per perfume in
the project's standard format. Approximately 11% of `related_perfumers`
strings will not exactly match `perfumers_database_v2.name` due to the
upstream perfumer DB not yet covering all names mentioned in news (e.g.,
`Jean Claude Ellena` ×191 mentions). Use the PID-join for guaranteed
matches.
### 5.6 Linking news_comments to articles (NID)
Foreign key: **`news_comments.nid → news.nid`** — 0% orphan rate.
```sql
-- All comments under article NID 17644:
SELECT author, date, text, is_reply
FROM read_parquet('news_comments.parquet')
WHERE nid = 17644
ORDER BY date_unix ASC;
```
### 5.7 Combined query examples
**Q1.** All news articles + their root comments mentioning Creed Aventus
(PID 9828) in 2024:
```sql
SELECT n.nid, n.title, n.date_unix, nc.author, nc.text
FROM read_parquet('news.parquet') n
LEFT JOIN read_parquet('news_comments.parquet') nc ON n.nid = nc.nid
WHERE list_contains(json_extract(n.related_pids, '$'), '9828')
AND n.date_unix BETWEEN 1704067200 AND 1735689599 -- 2024
AND nc.is_reply = false
ORDER BY n.date_unix DESC, nc.date_unix ASC;
```
**Q2.** Top-10 most-reviewed perfumes by language:
```sql
SELECT lang, pid, COUNT(*) AS review_count
FROM read_parquet('comments.parquet')
GROUP BY lang, pid
QUALIFY ROW_NUMBER() OVER (PARTITION BY lang ORDER BY COUNT(*) DESC) <= 10;
```
**Q3.** Sentiment correlation between news articles and reviews — pairs of
(news article, perfume reviewed in same time window):
```sql
SELECT n.nid, n.title, m.Brand, m.Name, COUNT(c.comment_id) AS reviews_in_30d
FROM read_parquet('news.parquet') n
JOIN read_csv('merged_database.csv', delim='⏸') m
ON list_contains(json_extract(n.related_pids, '$'), CAST(m.PID AS VARCHAR))
JOIN read_parquet('comments.parquet') c
ON c.pid = m.PID
WHERE n.date_unix > 0
AND c.date_unix BETWEEN n.date_unix AND n.date_unix + 2592000 -- 30 days
GROUP BY n.nid, n.title, m.Brand, m.Name;
```
---
## 6. Format specification
### 6.1 Storage
- **Container:** Apache Parquet 2.x
- **Compression:** Zstandard (`zstd`)
- **Row groups:**
- `comments.parquet` — 5 row groups
- `news.parquet` — 1 row group
- `news_comments.parquet` — 1 row group
### 6.2 String types
PyArrow uses two string types:
- `string` — backed by 32-bit offsets (per-array limit ~2 GB total).
- `large_string` — backed by 64-bit offsets (no practical size limit).
`comments.parquet` uses `large_string` for the `text` column (because the
combined corpus of 5.0M reviews exceeds the 32-bit offset limit). All
other string columns in all three datasets use `string`. Pandas
automatically converts both to its native `object` dtype on load — buyers
generally do not need to distinguish between the two types unless writing
custom Arrow code.
Exact field-level types are listed in the schema tables of §2.1, §3.1, §4.1.
### 6.3 Encoding
- **Character encoding:** UTF-8 throughout.
- **Normalization:** NFC where applicable; original Unicode codepoints
preserved (including emoji).
- **Newlines:** `\n` only (Unix-style). No `\r`.
- **HTML entities:** decoded (no `&amp;`, `&lt;`, etc. in text fields).
- **Replacement chars (U+FFFD):** zero — rare upstream-broken bytes were
stripped, with the surrounding text preserved.
### 6.4 List fields (news.parquet)
Four columns store JSON-encoded arrays-as-strings:
- `article_images`: `list[str]` of image URLs
- `related_pids`: `list[str]` of decimal-string PIDs
- `related_brands`: `list[str]` of brand names
- `related_perfumers`: `list[str]` of perfumer names
Empty list is stored as the literal string `'[]'` (not NULL, not empty
string). This makes parsing branchless:
```python
items = json.loads(row[field]) # always returns a list
```
---
## 7. Data quality
The datasets passed a multi-track validation audit (full report:
`reports/data_quality/POST_FIX_VALIDATION.md`). Summary:
| Check | Result |
|---|:---:|
| Duplicate rows by primary key (all 3 datasets) | 0 |
| FK integrity (`comments.pid → PID`) | 62 rows on 12 perfumes no longer in the catalogue |
| FK integrity (`news.related_pids → PID`) | 176 of 127,137 refs point to perfumes no longer in the catalogue |
| FK integrity (`news_comments.nid → nid`) | 0 orphans |
| `comment_id` global uniqueness (`comments.parquet`) | 0 collisions over 5.0M rows |
| HTML/CSS pollution in text fields | 0 |
| Cloudflare challenge pages in data | 0 |
| Mojibake / replacement char (U+FFFD) | 0 |
| Language attribution accuracy (langdetect on sample) | >95% per language |
| `news_comments.date_unix > 0` populated | 100% |
| `news.date_unix > 0` populated (non-archived) | 99.8% (10,398 / 10,417) |
### 7.1 Provenance
Data scraped via headless browser fingerprinting (chrome120 impersonation
through curl_cffi) over a residential proxy network. Each page was
individually fetched, parsed by a custom HTML parser, and post-processed
through a content sanitization pipeline. Re-scrapes are idempotent thanks
to deterministic comment IDs (§2.4).
---
## 8. Known limitations (transparent disclosure)
1. **News articles without dates (10,786 / 25,875 = 41.7%).**
Fragrantika's archived HTML template does not embed any date marker
(`<time>`, meta tag, or visible string). For these articles, `date_unix`
is `0`. The archived no-date subset is concentrated in NIDs 1–15,000: 9,699 of
9,701 archived articles in NIDs 1–10,000 and 1,068 of 4,905 in NIDs
10,001–15,000. (852 archived articles in NIDs 15,001–20,000 do have
dates.) In addition, 19 of the 23 newest non-archived articles (NID 26,363 and above)
were collected without their date; the remaining 10,398 of 10,417 non-archived
articles are dated.
2. **`related_brands` matching gap (~12%).** Fragrantika has renamed
~50 brands over the years (e.g., `Christian Dior → Dior`); the captured
name in news may be the older form, while `brands_database_v2.csv`
carries only the canonical (post-rename) name. Use `related_pids` for
authoritative brand resolution (§5.4).
3. **`related_perfumers` matching gap (~11%).** Some perfumer names
referenced in news (e.g., `Jean Claude Ellena` ×191) are not yet in the
companion `perfumers_database_v2.csv`. The names in news are
diacritic-correct; the gap is in the reference DB coverage. Use
`related_pids → merged_database.noses_f` for authoritative resolution
(§5.5).
4. **Cross-language mirrored short comments (~0.014%).** Approximately
650 short, identical-text comments appear in multiple languages
(e.g., a "5/10" rating posted by the same author on multiple subdomains).
These are real (Fragrantika's display behavior), not parser duplicates.
5. **Comments PID coverage gap.** 44,436 perfumes (31.1%) have zero comments
in any language. In the May 2026 audit, checked against Fragrantika's `reviews_count` field,
99.8% of zero-comment perfumes truly had zero reviews on the platform. A
targeted re-collection of the 73 PIDs flagged as `reviews_count > 0`
yet missing comments recovered 68 of them (305 new comments added);
the remaining 5 PIDs have `reviews_count > 0` in Fragrantika's metadata
but the page returns no review HTML — treated as upstream
metadata/page mismatch.
---
## 9. Loading examples
### 9.1 Python (PyArrow + Pandas)
```python
import pyarrow.parquet as pq
import json
# Comments
comments = pq.read_table('comments.parquet')
df = comments.to_pandas()
print(df.head())
# News list-field unpack
news = pq.read_table('news.parquet').to_pandas()
news['related_pids'] = news['related_pids'].apply(json.loads)
news['related_brands'] = news['related_brands'].apply(json.loads)
```
### 9.2 DuckDB (zero-copy SQL on Parquet)
```sql
-- Direct query, no import needed
SELECT lang, COUNT(*) FROM 'comments.parquet' GROUP BY lang ORDER BY 2 DESC;
-- Multi-file join
SELECT n.title, COUNT(nc.comment_id) AS replies
FROM 'news.parquet' n
LEFT JOIN 'news_comments.parquet' nc ON n.nid = nc.nid AND nc.is_reply = true
GROUP BY n.nid, n.title HAVING replies > 10;
```
### 9.3 Polars
```python
import polars as pl
df = pl.read_parquet('comments.parquet')
df.filter(pl.col('lang') == 'en').head()
```
---
## 10. Sample files
The `samples/` directory contains three small Parquet files that
demonstrate the cross-dataset relationships using real production data:
| File | Rows | Content |
|---|---:|---|
| `comments_sample.parquet` | 25 | Reviews of 5 popular perfumes (Mugler Angel, Guerlain Shalimar, Creed Aventus, JPG Le Male, Dior Poison), each in 5 languages (en/ru/de/es/fr). |
| `news_sample.parquet` | 20 | News articles that reference these 5 perfumes via `related_pids`. Diverse categories and archived/recent mix. |
| `news_comments_sample.parquet` | 20 | Comments from 7 of the news articles in `news_sample.parquet`, mix of root and replies. |
The samples are produced by `scripts/build_sales_samples.py` and use the
**identical Parquet schema and Zstandard compression as the production
files** — buyers can verify their loading code against the samples before
committing to the full datasets.
### 10.1 Cross-link verification (using the samples)
```python
import pyarrow.parquet as pq
import json
c = pq.read_table('samples/comments_sample.parquet')
n = pq.read_table('samples/news_sample.parquet')
nc = pq.read_table('samples/news_comments_sample.parquet')
sample_pids = set(c.column('pid').to_pylist())
print(f"Comment-sample PIDs: {sorted(sample_pids)}")
# {53, 218, 430, 704, 9828}
# Find news rows that reference these PIDs:
for i, rp in enumerate(n.column('related_pids').to_pylist()):
pids = set(int(p) for p in json.loads(rp) if p.isdigit())
if pids & sample_pids:
nid = n.column('nid').to_pylist()[i]
title = n.column('title').to_pylist()[i]
print(f" NID {nid} ({title[:60]}...) references PIDs {pids & sample_pids}")
# All news_comments NIDs are subset of news_sample NIDs:
sample_nids = set(n.column('nid').to_pylist())
nc_nids = set(nc.column('nid').to_pylist())
assert nc_nids <= sample_nids, "FK integrity holds in samples"
print(f"\nAll news_comments_sample NIDs link back to news_sample: {nc_nids <= sample_nids}")
```
Running this script on the supplied samples will print a verification
trace and confirm relational integrity.
---
## 11. Versioning and updates
| Field | Value |
|---|---|
| Snapshot date | 2026-10-19 (v5.19) |
| Comments PID range | 1 — 145,291 |
| News NID range | 1 — 26,385 |
| Schema version | v1 (8 / 16 / 9 fields respectively) |
| Compression | zstd |
| Format | Parquet 2.x |
Updates to these datasets are produced as full snapshots; incremental
diffs (per-PID / per-NID delta exports) are available on request.