🔬 Research

Dataset Codebook from a CSV Description

Build a data dictionary and codebook from a CSV header, sample rows, or column notes: types, missingness, units, and pitfalls. No invented values.

0.0
0Reviews
P
August 24, 2026

Prompt

Act as a data librarian writing a codebook a colleague can join on. Use only the columns and samples in Inputs. Do not invent value labels, means, or PII examples.

Inputs:
- Dataset name: [Name, owner, date]
- File: [Filename, delimiter, encoding if known]
- Header: [Column names]
- Sample rows: [Paste 2-10 rows, or none]
- Column notes: [Anything the collector said]
- Population: [Who or what a row is]
- Sensitive fields: [Known PII]
- Intended use: [Analysis I want]
- Unknowns: [What I still need from the collector]

Generate:
1. Dataset identity: One paragraph. Grain (what one row is). Time range if visible. Files.
2. Codebook table: For each column: name, guessed type, unit, allowed values if visible, missing code, PII flag, notes. Mark GUESS when Sample rows are thin.
3. Derived pitfalls: Dates as strings, leading zeros on IDs, mixed currencies, one-to-many disguised as one row, leakage into Intended use.
4. Missingness: Which columns look empty in the sample. Do not invent a % for the full file.
5. Joins and keys: Likely primary key. Collision risk. Columns that look like keys but are not.
6. Sensitive handling: What to hash, drop, or restrict. If Sensitive fields is empty, still flag columns that look like PII.
7. Collector questions: 8 precise questions. No "tell me about the data."
8. Starter analysis that is safe: 3 descriptives you can run without overclaiming. 2 analyses to refuse until Unknowns are answered.

Constraints:
- No em dashes. No fake row counts for the full CSV.
- Do not fill value labels you did not see (e.g. do not invent that status=3 means "churned").
- Do not create example emails or SSNs.
- If Header is empty, stop.
- Write for an analyst who will be blamed if a join doubles revenue.

Instructions

Replace every [bracket] with your details before running. Works on ChatGPT, Claude, and Gemini.

Examples

Example Input

Dataset name: trial_workspace_events, owner data-eng, snapshot 2026-08-20
File: trial_workspace_events.csv, comma, UTF-8
Header: workspace_id, admin_email, created_at, plan_code, dashboards_14d, pages_processed, last_seen_at, country, sso_flag, nrr_flag
Sample rows:
ws_9182, a***@bankprairie.example, 2026-07-02T14:03:11Z, trial, 0, 12, 2026-07-04T09:11:00Z, US, 0, 
ws_9188, b***@acme-regional.example, 2026-07-08T18:22:00Z, trial, 1, 0, 2026-07-09T12:00:00Z, US, 1, 0
ws_9201, c***@example.com, 2026-07-19T08:01:44Z, trial, 3, 4400, 2026-08-18T16:40:00Z, DE, 0, 1
Column notes: dashboards_14d is count of dashboards created in first 14 days. pages_processed is lifetime in the snapshot. sso_flag 1 means SSO was provisioned. nrr_flag was a join from finance and is often blank. Emails in this paste are already masked.
Population: one row per trial workspace created in July 2026 (collector said; not proven from three rows)
Sensitive fields: admin_email is PII
Intended use: describe stalled trials (0-1 dashboards in 14 days) vs country and SSO
Unknowns: full row count, whether workspace_id is unique, whether DE row is GDPR-restricted, meaning of nrr_flag 0 vs 1 vs blank, timezone of last_seen_at

Example Output

1. Identity
trial_workspace_events.csv (comma, UTF-8), snapshot 2026-08-20, owner data-eng. Grain (collector): one trial workspace created in July 2026. Three sample rows cannot prove uniqueness or that all July trials are present. Time in sample: created_at 2026-07-02 to 2026-07-19, last_seen_at through 2026-08-18.

2. Codebook (GUESS from 3 rows + notes)
workspace_id: string, id, values like ws_9182, missing none in sample, not PII. Likely key. GUESS unique.
admin_email: string, masked in paste, PII yes. Do not unmask in notes.
created_at: datetime string, UTC Z visible, ISO-8601. Unit: timestamp.
plan_code: string. Seen: trial. Do not invent other codes.
dashboards_14d: integer count, first 14 days (collector). Sample 0,1,3.
pages_processed: integer, lifetime in snapshot (collector), not 14-day. Sample 12, 0, 4400. Not a rate.
last_seen_at: datetime Z. Timezone of "last seen" unknown beyond Z suffix.
country: string ISO-like. Seen US, DE. Do not assume full ISO list.
sso_flag: 0/1. Collector: 1 = SSO provisioned. Not "customer wanted SSO."
nrr_flag: 0/1/blank. Finance join, often blank. Do not label 0 as churned.

3. Pitfalls
Do not treat pages_processed as 14-day (leak into stall definition). nrr_flag blank vs 0 are different. Emails as join keys will break on role change. Country DE may be a GDPR class. created_at vs dashboards_14d window: if snapshot logic is wrong, stall is wrong.

4. Missingness
nrr_flag blank on ws_9182 in sample. No full-file %.

5. Keys
workspace_id is the only plausible primary key. Collision unknown. admin_email looks like a key and is not (PII, can change). nrr_flag is not a key.

6. Sensitive
Drop or hash admin_email for the stall table. Restrict DE until GDPR question is answered. Do not print full emails. This paste is already masked; keep it that way.

7. Collector questions
Is workspace_id unique in the file. How many rows. Exact rule for dashboards_14d (created vs published). Is pages_processed reset on trial. last_seen_at timezone and event. nrr_flag 0 vs 1 vs null codebook. Are non-US rows legal to use. Was July 2026 complete or a late-arriving extract.

8. Safe starters
Count of sample-like stalls: dashboards_14d in {0,1} only on this extract after you have the full file. Crosstab sso_flag vs stall, still not causal. List missingness of nrr_flag.
Refuse until unknowns: NRR commentary, country comparison that includes DE, revenue joins on email.

Reviews (0)

Please login to leave a review.
Loading reviews...