FragDBnet commited on
Commit
156b9d8
·
verified ·
1 Parent(s): 96bddb2

Update to v5.3.1 — Add companion Parquet datasets (samples + SPEC.md)

Browse files
.gitattributes CHANGED
@@ -1 +1,2 @@
1
  *.csv filter=lfs diff=lfs merge=lfs -text
 
 
1
  *.csv filter=lfs diff=lfs merge=lfs -text
2
+ news_sample.parquet filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -552,10 +552,26 @@ The most comprehensive structured fragrance database available. This is a **free
552
  |------|---------|--------|-------------|
553
  | `fragrances.csv` | 10 | 30 | Top-rated fragrances |
554
  | `brands.csv` | 10 | 54 | Brand profiles + 22 lang translations |
555
- | `perfumers.csv` | 10 | 36 | Perfumer profiles + 22 lang translations |
556
  | `notes.csv` | 10 | 55 | Fragrance notes + 22 lang translations |
557
  | `accords.csv` | 10 | 27 | Accords + 22 lang translations |
558
  | `translations.csv` | 34 | 25 | Gender & voting vocabulary (full) |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
 
560
  ### Full Database
561
 
 
552
  |------|---------|--------|-------------|
553
  | `fragrances.csv` | 10 | 30 | Top-rated fragrances |
554
  | `brands.csv` | 10 | 54 | Brand profiles + 22 lang translations |
555
+ | `perfumers.csv` | 10 | 39 | Perfumer profiles + 22 lang + 6 name translit |
556
  | `notes.csv` | 10 | 55 | Fragrance notes + 22 lang translations |
557
  | `accords.csv` | 10 | 27 | Accords + 22 lang translations |
558
  | `translations.csv` | 34 | 25 | Gender & voting vocabulary (full) |
559
+ | `comments_sample.parquet` | 25 | 8 | User reviews preview (parquet) |
560
+ | `news_sample.parquet` | 20 | 16 | Editorial articles preview (parquet) |
561
+ | `news_comments_sample.parquet` | 20 | 9 | News comments preview (parquet) |
562
+ | `SPEC.md` | — | — | Parquet schema documentation |
563
+
564
+ ### Companion Parquet Datasets (Full tier only)
565
+
566
+ The full parquet datasets (not in this sample) ship with all paid tiers except the $200 Core:
567
+
568
+ | File | Rows | Description |
569
+ |------|------|-------------|
570
+ | `comments.parquet` | 4,643,851 | User reviews in 23 languages |
571
+ | `news.parquet` | 24,440 | Editorial articles, 2008-2026 |
572
+ | `news_comments.parquet` | 263,798 | Threaded news comments |
573
+
574
+ See `SPEC.md` for full schema. Pricing: https://fragdb.net/#pricing
575
 
576
  ### Full Database
577
 
SPEC.md ADDED
@@ -0,0 +1,635 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fragrantica News & Comments Datasets — Technical Specification
2
+
3
+ **Snapshot date:** 2026-05-05
4
+ **Source:** `fragrantica.com` and 22 localized domains (`fragrantica.de`, `fragrantica.ru`, etc.)
5
+ **Format:** Apache Parquet (Zstandard compression)
6
+ **Total combined size:** ~1.36 GB on disk
7
+
8
+ This document specifies three datasets that complement the existing
9
+ Fragrantica perfume database (`merged_database`, `brands_database_v2`,
10
+ `perfumers_database_v2`, `notes_database_v2` — already documented and sold
11
+ separately):
12
+
13
+ 1. **`comments.parquet`** — user reviews on individual perfumes
14
+ 2. **`news.parquet`** — editorial articles published on Fragrantica
15
+ 3. **`news_comments.parquet`** — user comments under those articles
16
+
17
+ The cross-dataset relationships in §5 explain how to join these with the
18
+ existing perfume/brand/perfumer DBs via primary keys.
19
+
20
+ ---
21
+
22
+ ## 1. Overview
23
+
24
+ | Dataset | Rows | Compressed Size | Distinct entities |
25
+ |---|---:|---:|---:|
26
+ | `comments.parquet` | 4,643,851 | 1.23 GB | 93,305 perfumes, 23 languages |
27
+ | `news.parquet` | 24,440 articles | 101 MB | NID 1..25000 |
28
+ | `news_comments.parquet` | 263,798 | 33 MB | 21,820 articles with comments |
29
+
30
+ All three datasets share the same identifier conventions used by the
31
+ existing perfume/brand/perfumer databases:
32
+
33
+ - **PID** (`int32`) — unique perfume identifier; matches `merged_database.PID`.
34
+ - **NID** (`int32`) — unique news article identifier (1..25000 range).
35
+ - **lang** (`string`) — ISO 639-1 language code identifying which Fragrantica
36
+ domain the content was sourced from. Each domain hosts independent
37
+ user-generated content (reviews are not translations of one another).
38
+
39
+ ---
40
+
41
+ ## 2. Dataset 1: `comments.parquet`
42
+
43
+ User-written reviews of individual perfumes, scraped across 23 localized
44
+ Fragrantica domains. Each comment is a unique user review, not a translation
45
+ or syndication.
46
+
47
+ ### 2.1 Schema (8 fields)
48
+
49
+ | # | Field | Type | NULL? | Description |
50
+ |---:|---|---|---|---|
51
+ | 1 | `pid` | `int32` | NO | Foreign key → `merged_database.PID`. Identifies the perfume being reviewed. |
52
+ | 2 | `lang` | `string` | NO | Domain language (`en`, `ru`, `de`, …). 23 distinct values. |
53
+ | 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. |
54
+ | 4 | `author` | `string` | NO | Username as displayed on Fragrantica. May contain Unicode (e.g. `Сергей`, `José`). |
55
+ | 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. |
56
+ | 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. |
57
+ | 7 | `avatar_url` | `string` | NO | Full URL to the user's avatar image hosted on Fragrantica's CDN. Verified ~100% reachable. |
58
+ | 8 | `gradient_class` | `string` | NO | Fragrantica'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. |
59
+
60
+ ### 2.2 Volumetrics
61
+
62
+ - **Total rows:** 4,643,851
63
+ - **Distinct PIDs covered:** 93,305 (70.6% of the 132,160 perfumes in `merged_database`; remaining 38,855 perfumes have zero reviews — verified against Fragrantica's `reviews_count` field)
64
+ - **PID range:** 1 — 130,121
65
+ - **Languages:** 23 (full list in §2.3)
66
+
67
+ ### 2.3 Language distribution
68
+
69
+ | Lang | Code | Comments | Distinct PIDs |
70
+ |---|---|---:|---:|
71
+ | English | `en` | 1,690,055 | 78,715 (60% of perfumes) |
72
+ | Russian | `ru` | 889,893 | 52,650 |
73
+ | Portuguese (Brazilian) | `pt` | 247,511 | 21,258 |
74
+ | Spanish | `es` | 226,451 | 26,586 |
75
+ | Korean | `ko` | 214,674 | 11,696 |
76
+ | Turkish | `tr` | 191,945 | 11,722 |
77
+ | Japanese | `ja` | 186,836 | 10,767 |
78
+ | Polish | `pl` | 141,242 | 25,350 |
79
+ | Italian | `it` | 115,972 | 22,100 |
80
+ | Hungarian | `hu` | 109,204 | 11,565 |
81
+ | Serbian | `sr` | 108,945 | 15,048 |
82
+ | Swedish | `sv` | 107,666 | 11,155 |
83
+ | German | `de` | 100,218 | 15,505 |
84
+ | Hebrew | `he` | 81,981 | 10,165 |
85
+ | Ukrainian | `uk` | 50,203 | 15,917 |
86
+ | French | `fr` | 42,256 | 13,379 |
87
+ | Arabic | `ar` | 33,077 | 9,071 |
88
+ | Greek | `el` | 28,208 | 8,512 |
89
+ | Czech | `cs` | 24,269 | 3,424 |
90
+ | Chinese (Simplified) | `zh` | 15,843 | 4,466 |
91
+ | Romanian | `ro` | 13,906 | 6,451 |
92
+ | Mongolian | `mn` | 12,100 | 2,056 |
93
+ | Dutch | `nl` | 11,396 | 5,045 |
94
+
95
+ Each `lang` represents an independent set of user reviews from the
96
+ corresponding national Fragrantica domain. A user reviewing the same
97
+ perfume on `fragrantica.com` (en) and `fragrantica.ru` (ru) would write
98
+ two distinct reviews; both are included.
99
+
100
+ ### 2.4 ID generation
101
+
102
+ `comment_id` is content-derived (sha1-based), giving three properties:
103
+ - **Globally unique** across all 4.6M rows (verified post-rewrite, 0 collisions).
104
+ - **Stable across re-scrapes**: re-fetching the same comment yields the same
105
+ ID. Useful for incremental updates and joining with downstream tables.
106
+ - **Idempotent dedup key**: `(nid, comment_id)` and `comment_id` alone are
107
+ both safe primary keys.
108
+
109
+ ---
110
+
111
+ ## 3. Dataset 2: `news.parquet`
112
+
113
+ Editorial articles from `fragrantica.com/news/` (English-only). Covers the
114
+ entire archive 2008-2026 (NID 1..25000), including both archived legacy
115
+ articles and modern editorial content.
116
+
117
+ ### 3.1 Schema (16 fields)
118
+
119
+ | # | Field | Type | NULL? | Description |
120
+ |---:|---|---|---|---|
121
+ | 1 | `nid` | `int32` | NO | News article ID. Range 1..25000. |
122
+ | 2 | `title` | `string` | NO | Article title. Plain text, HTML entities decoded. |
123
+ | 3 | `category` | `string` | NO | Editorial category (e.g., `New Fragrances`, `Fragrance Reviews`, `Interviews`). 30+ distinct values. Top 10 in §3.4. |
124
+ | 4 | `author` | `string` | YES | Comma-separated list of author names (multi-author articles common). |
125
+ | 5 | `description` | `string` | YES | Short summary from `<meta property="og:description">`. Plain text. |
126
+ | 6 | `text` | `string` | NO | Full article body. Plain text, paragraph breaks via `\n`. Footer/byline blocks stripped. UTF-8. |
127
+ | 7 | `text_html` | `string` | NO | Article body **with original HTML preserved** — `<p>`, `<a>`, `<img>`, embedded videos. Useful for rendering or DOM-aware downstream processing. |
128
+ | 8 | `main_image` | `string` | YES | URL to the article's primary image (Fragrantica CDN). Verified reachable. |
129
+ | 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. |
130
+ | 10 | `url` | `string` | NO | Canonical article URL (e.g., `https://www.fragrantica.com/news/x-12345.html`). |
131
+ | 11 | `is_archived` | `bool` | NO | `True` if article is in Fragrantica's legacy/archived corpus (older HTML template, often missing publication date — see §3.5). |
132
+ | 12 | `related_pids` | `string` | NO | **JSON-encoded array** of PIDs (as decimal strings) referenced in the article. Foreign key → `merged_database.PID`. 0% orphan rate (FK-validated). |
133
+ | 13 | `related_brands` | `string` | NO | **JSON-encoded array** of brand names. Informational metadata; see §5.4 for canonical resolution. |
134
+ | 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. |
135
+ | 15 | `comments_count` | `int32` | NO | Count of comments in `news_comments.parquet` matching this NID. |
136
+ | 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. |
137
+
138
+ ### 3.2 Volumetrics
139
+
140
+ - **Total rows:** 24,440 articles
141
+ - **NID range:** 1 — 25,000 (560 NIDs missing — Fragrantica returns HTTP 301 redirect for these — represents truly deleted articles)
142
+ - **Archived:** 15,427 / 24,440 (63.1%)
143
+ - **Non-archived:** 9,013 / 24,440 (36.9%)
144
+ - **With publication date (`date_unix > 0`):** 13,687 (56.0%)
145
+
146
+ ### 3.3 List-fields format note
147
+
148
+ Four fields hold lists: `article_images`, `related_pids`, `related_brands`,
149
+ `related_perfumers`. **All four are stored as JSON-encoded strings** for
150
+ consistency. Use:
151
+
152
+ ```python
153
+ import json
154
+ images = json.loads(row['article_images']) # → list[str]
155
+ ```
156
+
157
+ `related_pids` contains PID values as decimal strings (e.g., `'704'`, not
158
+ the int `704`). Cast as needed when joining.
159
+
160
+ ### 3.4 Top categories
161
+
162
+ | Category | Articles | % |
163
+ |---|---:|---:|
164
+ | New Fragrances | 8,534 | 34.9% |
165
+ | Fragrance Reviews | 5,583 | 22.8% |
166
+ | Niche Perfumery | 2,537 | 10.4% |
167
+ | Art Books Events | 1,570 | 6.4% |
168
+ | Columns | 1,346 | 5.5% |
169
+ | Fragrant Horoscope | 851 | 3.5% |
170
+ | Fragrance News | 760 | 3.1% |
171
+ | Interviews | 682 | 2.8% |
172
+ | Vintages | 437 | 1.8% |
173
+ | Raw Materials | 384 | 1.6% |
174
+
175
+ Remaining 1,756 articles span 33 smaller categories.
176
+
177
+ ### 3.5 Date coverage
178
+
179
+ `date_unix == 0` for 10,753 articles (44%). Distribution by NID range:
180
+
181
+ | NID range | Articles | with date | % | archived % |
182
+ |---|---:|---:|---:|---:|
183
+ | 1 — 5,000 | 4,888 | 2 | 0.0% | 100% |
184
+ | 5,001 — 10,000 | 4,799 | 0 | 0.0% | 100% |
185
+ | 10,001 — 15,000 | 4,890 | 3,822 | 78.2% | 100% |
186
+ | 15,001 — 20,000 | 4,900 | 4,900 | 100% | 17.3% |
187
+ | 20,001 — 25,000 | 4,963 | 4,963 | 100% | 0% |
188
+
189
+ The 10,753 articles without date come entirely from the archived legacy
190
+ template: 9,685 in NIDs 1–10,000 (effectively all of them) and 1,068 in
191
+ NIDs 10,001–15,000 (the remaining 22% of that range — the other 78% have
192
+ recoverable visible-text dates). Fragrantica's old archived HTML does not
193
+ embed any date marker (no `<time>`, no `<meta>`, no visible date string)
194
+ for these. This is an upstream HTML limitation, not a parser issue.
195
+ **For all non-archived articles (9,013 of them), `date_unix` is 100%
196
+ populated.**
197
+
198
+ ---
199
+
200
+ ## 4. Dataset 3: `news_comments.parquet`
201
+
202
+ User comments under news articles. Pure UGC; same comment-card schema
203
+ Fragrantica uses on perfume pages.
204
+
205
+ ### 4.1 Schema (9 fields)
206
+
207
+ | # | Field | Type | NULL? | Description |
208
+ |---:|---|---|---|---|
209
+ | 1 | `nid` | `int32` | NO | Foreign key → `news.parquet.nid` (0% orphan rate). |
210
+ | 2 | `comment_id` | `string` | NO | Comment ID as Fragrantica assigns it (page-anchor format). Globally unique within parquet. |
211
+ | 3 | `author` | `string` | NO | Commenter username. |
212
+ | 4 | `date` | `string` | NO | Date as displayed on page (e.g., `04/11/26 10:05`). |
213
+ | 5 | `date_unix` | `int64` | NO | Parsed Unix timestamp. **100% populated** (all rows have `date_unix > 0`). |
214
+ | 6 | `text` | `string` | NO | Comment body, plain text. |
215
+ | 7 | `avatar_url` | `string` | NO | Full URL to author avatar (Fragrantica CDN). |
216
+ | 8 | `gradient` | `string` | NO | CSS class for color badge (same scheme as `comments.parquet.gradient_class`). |
217
+ | 9 | `is_reply` | `bool` | NO | `True` if this comment is a reply to another comment (threaded discussion); `False` for root comments. 4.9% of rows are replies (12,898 / 263,798). |
218
+
219
+ ### 4.2 Volumetrics
220
+
221
+ - **Total rows:** 263,798
222
+ - **Distinct NIDs:** 21,820 (89.3% of articles have at least one comment)
223
+ - **Replies:** 12,898 (4.9%)
224
+ - **Average comments per article (in articles with comments):** 12.1
225
+
226
+ ---
227
+
228
+ ## 5. Cross-dataset relationships
229
+
230
+ This section is the load-bearing piece for buyers integrating with the
231
+ existing perfume/brand/perfumer DBs.
232
+
233
+ ### 5.1 Diagram
234
+
235
+ ```
236
+ ┌────────────────────────────────────────────────────────┐
237
+ │ merged_database.csv (existing, 132,160 perfumes) │
238
+ │ ───────────────────── │
239
+ │ PID ←──────────────────────┐ │
240
+ │ Brand │ │
241
+ │ Name │ │
242
+ │ noses_f (perfumers) │ │
243
+ │ ...30 fields total │ │
244
+ └────────────────────────────────┼───────────────────────┘
245
+
246
+ ┌────────────────┴───────────────┐
247
+ │ │
248
+ ▼ ▼
249
+ ┌──────────────────────┐ ┌──────────────────────┐
250
+ │ comments.parquet │ │ news.parquet │
251
+ │ ──────────────────── │ │ ──────────────────── │
252
+ │ pid ─────────────►│ │ related_pids ───────►│
253
+ │ lang (23 langs) │ │ related_brands │
254
+ │ comment_id (sha1) │ │ related_perfumers │
255
+ │ author/date/text │ │ nid ◄────┐ │
256
+ │ +avatar/gradient │ │ ...16 fields total │
257
+ └──────────────────────┘ └──────────┼───────────┘
258
+
259
+
260
+ ┌──────────┴───────────┐
261
+ │ news_comments.parquet│
262
+ │ ──────────────────── │
263
+ │ nid ─────────────────│ FK → news.nid
264
+ │ comment_id │
265
+ │ author/date/text │
266
+ │ is_reply │
267
+ └──────────────────────┘
268
+ ```
269
+
270
+ ### 5.2 Linking comments to perfumes (PID)
271
+
272
+ Foreign key: **`comments.pid → merged_database.PID`** — verified 0% orphan rate.
273
+
274
+ ```sql
275
+ -- All English reviews for the perfume "Mugler Angel" (PID 704):
276
+ SELECT c.author, c.date, c.text
277
+ FROM read_parquet('comments.parquet') c
278
+ JOIN read_csv('merged_database.csv', delim='⏸') m ON c.pid = m.PID
279
+ WHERE m.Brand = 'Mugler' AND m.Name = 'Angel' AND c.lang = 'en'
280
+ ORDER BY c.date DESC LIMIT 100;
281
+ ```
282
+
283
+ ```python
284
+ import pyarrow.parquet as pq
285
+ import pyarrow.compute as pc
286
+
287
+ c = pq.read_table('comments.parquet')
288
+ angel_reviews = c.filter(pc.and_(pc.equal(c['pid'], 704),
289
+ pc.equal(c['lang'], 'en')))
290
+ ```
291
+
292
+ ### 5.3 Linking news to perfumes (related_pids)
293
+
294
+ Foreign key: **`news.related_pids → merged_database.PID`** — JSON-array
295
+ field, 0% orphan rate over 119,662 references.
296
+
297
+ ```sql
298
+ -- All news mentioning Aventus (PID 9828):
299
+ SELECT nid, title, category, date_unix
300
+ FROM read_parquet('news.parquet')
301
+ WHERE list_contains(json_extract(related_pids, '$'), '9828');
302
+ ```
303
+
304
+ ```python
305
+ import json
306
+ n = pq.read_table('news.parquet')
307
+ mentions_aventus = []
308
+ for i, rp in enumerate(n.column('related_pids').to_pylist()):
309
+ if rp and '9828' in json.loads(rp):
310
+ mentions_aventus.append(i)
311
+ ```
312
+
313
+ ### 5.4 Linking news to brands
314
+
315
+ `news.related_brands` is a **JSON array of brand-name strings** (informational).
316
+
317
+ **Authoritative brand resolution** for any news article uses the PID:
318
+ ```
319
+ news.related_pids → merged_database.PID → merged_database.Brand
320
+ ```
321
+
322
+ The `related_brands` field is provided as supplementary metadata. Approx.
323
+ 12% of strings in `related_brands` will not match `brands_database_v2.name`
324
+ exactly because Fragrantica has renamed some brands over time
325
+ (e.g., `Christian Dior` → `Dior`, `Annick Goutal` → `Goutal`,
326
+ `Paco Rabanne` → `Rabanne`). The original captured name is preserved.
327
+
328
+ For canonical brand lookup, always join via `related_pids`:
329
+
330
+ ```sql
331
+ SELECT DISTINCT m.Brand
332
+ FROM read_parquet('news.parquet') n
333
+ JOIN read_csv('merged_database.csv', delim='⏸') m
334
+ ON list_contains(json_extract(n.related_pids, '$'), CAST(m.PID AS VARCHAR))
335
+ WHERE n.nid = 17644;
336
+ ```
337
+
338
+ ### 5.5 Linking news to perfumers
339
+
340
+ Same pattern as brands. `news.related_perfumers` is a **JSON array of perfumer-name
341
+ strings** with diacritics preserved (e.g., `François Demachy`, `Carlos Benaïm`,
342
+ `Cécile Zarokian` — verified canonical post-fix).
343
+
344
+ **Authoritative perfumer resolution** uses PID:
345
+ ```
346
+ news.related_pids → merged_database.PID → merged_database.noses_f
347
+ ```
348
+
349
+ `merged_database.noses_f` contains the full list of perfumers per perfume in
350
+ the project's standard format. Approximately 11% of `related_perfumers`
351
+ strings will not exactly match `perfumers_database_v2.name` due to the
352
+ upstream perfumer DB not yet covering all names mentioned in news (e.g.,
353
+ `Jean Claude Ellena` ×191 mentions). Use the PID-join for guaranteed
354
+ matches.
355
+
356
+ ### 5.6 Linking news_comments to articles (NID)
357
+
358
+ Foreign key: **`news_comments.nid → news.nid`** — 0% orphan rate.
359
+
360
+ ```sql
361
+ -- All comments under article NID 17644:
362
+ SELECT author, date, text, is_reply
363
+ FROM read_parquet('news_comments.parquet')
364
+ WHERE nid = 17644
365
+ ORDER BY date_unix ASC;
366
+ ```
367
+
368
+ ### 5.7 Combined query examples
369
+
370
+ **Q1.** All news articles + their root comments mentioning Creed Aventus
371
+ (PID 9828) in 2024:
372
+
373
+ ```sql
374
+ SELECT n.nid, n.title, n.date_unix, nc.author, nc.text
375
+ FROM read_parquet('news.parquet') n
376
+ LEFT JOIN read_parquet('news_comments.parquet') nc ON n.nid = nc.nid
377
+ WHERE list_contains(json_extract(n.related_pids, '$'), '9828')
378
+ AND n.date_unix BETWEEN 1704067200 AND 1735689599 -- 2024
379
+ AND nc.is_reply = false
380
+ ORDER BY n.date_unix DESC, nc.date_unix ASC;
381
+ ```
382
+
383
+ **Q2.** Top-10 most-reviewed perfumes by language:
384
+
385
+ ```sql
386
+ SELECT lang, pid, COUNT(*) AS review_count
387
+ FROM read_parquet('comments.parquet')
388
+ GROUP BY lang, pid
389
+ QUALIFY ROW_NUMBER() OVER (PARTITION BY lang ORDER BY COUNT(*) DESC) <= 10;
390
+ ```
391
+
392
+ **Q3.** Sentiment correlation between news articles and reviews — pairs of
393
+ (news article, perfume reviewed in same time window):
394
+
395
+ ```sql
396
+ SELECT n.nid, n.title, m.Brand, m.Name, COUNT(c.comment_id) AS reviews_in_30d
397
+ FROM read_parquet('news.parquet') n
398
+ JOIN read_csv('merged_database.csv', delim='⏸') m
399
+ ON list_contains(json_extract(n.related_pids, '$'), CAST(m.PID AS VARCHAR))
400
+ JOIN read_parquet('comments.parquet') c
401
+ ON c.pid = m.PID
402
+ WHERE n.date_unix > 0
403
+ AND c.date_unix BETWEEN n.date_unix AND n.date_unix + 2592000 -- 30 days
404
+ GROUP BY n.nid, n.title, m.Brand, m.Name;
405
+ ```
406
+
407
+ ---
408
+
409
+ ## 6. Format specification
410
+
411
+ ### 6.1 Storage
412
+
413
+ - **Container:** Apache Parquet 2.x
414
+ - **Compression:** Zstandard (`zstd`)
415
+ - **Row groups:**
416
+ - `comments.parquet` — 5 row groups
417
+ - `news.parquet` — 1 row group
418
+ - `news_comments.parquet` — 1 row group
419
+
420
+ ### 6.2 String types
421
+
422
+ PyArrow uses two string types:
423
+ - `string` — backed by 32-bit offsets (per-array limit ~2 GB total).
424
+ - `large_string` — backed by 64-bit offsets (no practical size limit).
425
+
426
+ `comments.parquet` uses `large_string` for the `text` column (because the
427
+ combined corpus of 4.6M reviews exceeds the 32-bit offset limit). All
428
+ other string columns in all three datasets use `string`. Pandas
429
+ automatically converts both to its native `object` dtype on load — buyers
430
+ generally do not need to distinguish between the two types unless writing
431
+ custom Arrow code.
432
+
433
+ Exact field-level types are listed in the schema tables of §2.1, §3.1, §4.1.
434
+
435
+ ### 6.3 Encoding
436
+
437
+ - **Character encoding:** UTF-8 throughout.
438
+ - **Normalization:** NFC where applicable; original Unicode codepoints
439
+ preserved (including emoji).
440
+ - **Newlines:** `\n` only (Unix-style). No `\r`.
441
+ - **HTML entities:** decoded (no `&amp;`, `&lt;`, etc. in text fields).
442
+ - **Replacement chars (U+FFFD):** zero — rare upstream-broken bytes were
443
+ stripped, with the surrounding text preserved.
444
+
445
+ ### 6.4 List fields (news.parquet)
446
+
447
+ Four columns store JSON-encoded arrays-as-strings:
448
+ - `article_images`: `list[str]` of image URLs
449
+ - `related_pids`: `list[str]` of decimal-string PIDs
450
+ - `related_brands`: `list[str]` of brand names
451
+ - `related_perfumers`: `list[str]` of perfumer names
452
+
453
+ Empty list is stored as the literal string `'[]'` (not NULL, not empty
454
+ string). This makes parsing branchless:
455
+
456
+ ```python
457
+ items = json.loads(row[field]) # always returns a list
458
+ ```
459
+
460
+ ---
461
+
462
+ ## 7. Data quality
463
+
464
+ The datasets passed a multi-track validation audit (full report:
465
+ `reports/data_quality/POST_FIX_VALIDATION.md`). Summary:
466
+
467
+ | Check | Result |
468
+ |---|:---:|
469
+ | Duplicate rows by primary key (all 3 datasets) | 0 |
470
+ | FK integrity (`comments.pid → PID`) | 0 orphans |
471
+ | FK integrity (`news.related_pids → PID`) | 0 orphans (over 119,662 refs) |
472
+ | FK integrity (`news_comments.nid → nid`) | 0 orphans |
473
+ | `comment_id` global uniqueness (`comments.parquet`) | 0 collisions over 4.6M rows |
474
+ | HTML/CSS pollution in text fields | 0 |
475
+ | Cloudflare challenge pages in data | 0 |
476
+ | Mojibake / replacement char (U+FFFD) | 0 |
477
+ | Language attribution accuracy (langdetect on sample) | >95% per language |
478
+ | `news_comments.date_unix > 0` populated | 100% |
479
+ | `news.date_unix > 0` populated (non-archived) | 100% |
480
+
481
+ ### 7.1 Provenance
482
+
483
+ Data scraped via headless browser fingerprinting (chrome120 impersonation
484
+ through curl_cffi) over a residential proxy network. Each page was
485
+ individually fetched, parsed by a custom HTML parser, and post-processed
486
+ through a content sanitization pipeline. Re-scrapes are idempotent thanks
487
+ to deterministic comment IDs (§2.4).
488
+
489
+ ---
490
+
491
+ ## 8. Known limitations (transparent disclosure)
492
+
493
+ 1. **Archived news articles without dates (10,753 / 24,440 = 44%).**
494
+ Fragrantica's archived HTML template does not embed any date marker
495
+ (`<time>`, meta tag, or visible string). For these articles, `date_unix`
496
+ is `0`. The no-date subset is concentrated in NIDs 1–15,000: 9,685 of
497
+ 9,687 archived articles in NIDs 1–10,000 and 1,068 of 4,890 in NIDs
498
+ 10,001–15,000. (850 archived articles in NIDs 15,001–20,000 do have
499
+ dates.) **All non-archived articles (9,013 of them) have 100% date
500
+ coverage.**
501
+
502
+ 2. **`related_brands` matching gap (~12%).** Fragrantica has renamed
503
+ ~50 brands over the years (e.g., `Christian Dior → Dior`); the captured
504
+ name in news may be the older form, while `brands_database_v2.csv`
505
+ carries only the canonical (post-rename) name. Use `related_pids` for
506
+ authoritative brand resolution (§5.4).
507
+
508
+ 3. **`related_perfumers` matching gap (~11%).** Some perfumer names
509
+ referenced in news (e.g., `Jean Claude Ellena` ×191) are not yet in the
510
+ companion `perfumers_database_v2.csv`. The names in news are
511
+ diacritic-correct; the gap is in the reference DB coverage. Use
512
+ `related_pids → merged_database.noses_f` for authoritative resolution
513
+ (§5.5).
514
+
515
+ 4. **Cross-language mirrored short comments (~0.014%).** Approximately
516
+ 650 short, identical-text comments appear in multiple languages
517
+ (e.g., a "5/10" rating posted by the same author on multiple subdomains).
518
+ These are real (Fragrantica's display behavior), not parser duplicates.
519
+
520
+ 5. **Comments PID coverage gap.** 38,855 perfumes (29%) have zero comments
521
+ in any language. Verified against Fragrantica's `reviews_count` field:
522
+ 99.8% of these perfumes truly have zero reviews on the platform. A
523
+ targeted re-collection of the 73 PIDs flagged as `reviews_count > 0`
524
+ yet missing comments recovered 68 of them (305 new comments added);
525
+ the remaining 5 PIDs have `reviews_count > 0` in Fragrantica's metadata
526
+ but the page returns no review HTML — treated as upstream
527
+ metadata/page mismatch.
528
+
529
+ ---
530
+
531
+ ## 9. Loading examples
532
+
533
+ ### 9.1 Python (PyArrow + Pandas)
534
+
535
+ ```python
536
+ import pyarrow.parquet as pq
537
+ import json
538
+
539
+ # Comments
540
+ comments = pq.read_table('comments.parquet')
541
+ df = comments.to_pandas()
542
+ print(df.head())
543
+
544
+ # News list-field unpack
545
+ news = pq.read_table('news.parquet').to_pandas()
546
+ news['related_pids'] = news['related_pids'].apply(json.loads)
547
+ news['related_brands'] = news['related_brands'].apply(json.loads)
548
+ ```
549
+
550
+ ### 9.2 DuckDB (zero-copy SQL on Parquet)
551
+
552
+ ```sql
553
+ -- Direct query, no import needed
554
+ SELECT lang, COUNT(*) FROM 'comments.parquet' GROUP BY lang ORDER BY 2 DESC;
555
+
556
+ -- Multi-file join
557
+ SELECT n.title, COUNT(nc.comment_id) AS replies
558
+ FROM 'news.parquet' n
559
+ LEFT JOIN 'news_comments.parquet' nc ON n.nid = nc.nid AND nc.is_reply = true
560
+ GROUP BY n.nid, n.title HAVING replies > 10;
561
+ ```
562
+
563
+ ### 9.3 Polars
564
+
565
+ ```python
566
+ import polars as pl
567
+ df = pl.read_parquet('comments.parquet')
568
+ df.filter(pl.col('lang') == 'en').head()
569
+ ```
570
+
571
+ ---
572
+
573
+ ## 10. Sample files
574
+
575
+ The `samples/` directory contains three small Parquet files that
576
+ demonstrate the cross-dataset relationships using real production data:
577
+
578
+ | File | Rows | Content |
579
+ |---|---:|---|
580
+ | `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). |
581
+ | `news_sample.parquet` | 20 | News articles that reference these 5 perfumes via `related_pids`. Diverse categories and archived/recent mix. |
582
+ | `news_comments_sample.parquet` | 20 | Comments from 7 of the news articles in `news_sample.parquet`, mix of root and replies. |
583
+
584
+ The samples are produced by `scripts/build_sales_samples.py` and use the
585
+ **identical Parquet schema and Zstandard compression as the production
586
+ files** — buyers can verify their loading code against the samples before
587
+ committing to the full datasets.
588
+
589
+ ### 10.1 Cross-link verification (using the samples)
590
+
591
+ ```python
592
+ import pyarrow.parquet as pq
593
+ import json
594
+
595
+ c = pq.read_table('samples/comments_sample.parquet')
596
+ n = pq.read_table('samples/news_sample.parquet')
597
+ nc = pq.read_table('samples/news_comments_sample.parquet')
598
+
599
+ sample_pids = set(c.column('pid').to_pylist())
600
+ print(f"Comment-sample PIDs: {sorted(sample_pids)}")
601
+ # {53, 218, 430, 704, 9828}
602
+
603
+ # Find news rows that reference these PIDs:
604
+ for i, rp in enumerate(n.column('related_pids').to_pylist()):
605
+ pids = set(int(p) for p in json.loads(rp) if p.isdigit())
606
+ if pids & sample_pids:
607
+ nid = n.column('nid').to_pylist()[i]
608
+ title = n.column('title').to_pylist()[i]
609
+ print(f" NID {nid} ({title[:60]}...) references PIDs {pids & sample_pids}")
610
+
611
+ # All news_comments NIDs are subset of news_sample NIDs:
612
+ sample_nids = set(n.column('nid').to_pylist())
613
+ nc_nids = set(nc.column('nid').to_pylist())
614
+ assert nc_nids <= sample_nids, "FK integrity holds in samples"
615
+ print(f"\nAll news_comments_sample NIDs link back to news_sample: {nc_nids <= sample_nids}")
616
+ ```
617
+
618
+ Running this script on the supplied samples will print a verification
619
+ trace and confirm relational integrity.
620
+
621
+ ---
622
+
623
+ ## 11. Versioning and updates
624
+
625
+ | Field | Value |
626
+ |---|---|
627
+ | Snapshot date | 2026-05-05 |
628
+ | Comments PID range | 1 — 130,121 |
629
+ | News NID range | 1 — 25,000 |
630
+ | Schema version | v1 (8 / 16 / 9 fields respectively) |
631
+ | Compression | zstd |
632
+ | Format | Parquet 2.x |
633
+
634
+ Updates to these datasets are produced as full snapshots; incremental
635
+ diffs (per-PID / per-NID delta exports) are available on request.
comments_sample.parquet ADDED
Binary file (15.5 kB). View file
 
news_comments_sample.parquet ADDED
Binary file (6.06 kB). View file
 
news_sample.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b845c176dcf4ca75e23041661f0443d4134308eee7f4ed463d62c1847418d5af
3
+ size 124859