# Economics Paper 1 PDF → Bobby Belajar CSV — conversion guide for AI assistants

Version 1.0 · 2026-07-16 · lives at `/tools/pdf-to-csv-economics.md` in the Bobby Belajar site (teacher console ▸ Tools tab). If the site's CSV import ever changes, update this file in the same place.

## What this task is

You are given a **PDF of Economics Paper 1** (CIE 9708 "Multiple Choice", or pages extracted from one). You must produce **one CSV file** that the teacher (**ttan**) imports at **Question bank ▸ Import / export ▸ Import**. Every multiple-choice question in the PDF becomes one CSV row. Some questions also need a **cropped PNG** of their table or diagram.

You need the ability to read PDF pages visually and to crop regions of a page into PNG images. If you cannot see the pages (text extraction only), STOP and tell ttan you cannot classify tables/diagrams safely.

**Follow the steps in order. When this guide says ask ttan, ask and wait — never guess.**

## Golden rules (read first)

1. **Never invent content.** Every question stem and option must be copied from the PDF. If part of a question is cut off, unreadable, or missing its options, SKIP that question and report it to ttan by its printed number at the end.
2. **One CSV row = one complete question**: a stem plus exactly four options A–D. Paper 1 always has exactly four options.
3. **`Correct Answer` is one digit 1–4, never a letter.** A = 1, B = 2, C = 3, D = 4. Two digits (e.g. `1,3`) silently turns the question into multi-select — never do it.
4. **Ask ttan for the question-set name as the LAST step**, after everything else is ready. Do not ask at the start.
5. Bad rows do not stop the import — the site skips them and imports the rest. So a sloppy CSV half-imports and re-importing the fixed file **duplicates** the good rows. Get it right the first time using the checklist at the end.

## Step 1 — Filter the pages

Work page by page. **Skip a page entirely** when it is any of these:

- **Cover page** — says "READ THESE INSTRUCTIONS FIRST", "UNIVERSITY OF CAMBRIDGE", paper code/session, has no lettered A–D options.
- **BLANK PAGE** (printed literally).
- Copyright/acknowledgement pages, formula sheets, mark-scheme pages.

On every kept page, **ignore page furniture**: page numbers, the paper code footer (e.g. `9708/11/M/J/13`), `© UCLES`, `[Turn over`, site watermarks (e.g. `www.XtremePapers.com`), and any handwritten annotations (e.g. "1-8 done").

## Step 2 — Split into questions

A question is: an optional printed number, a stem (one or more paragraphs, possibly with a table or diagram), then four options labelled **A B C D**.

- **Strip the printed question number.** It must not appear anywhere in the CSV.
- **Strip the A/B/C/D labels** when copying option text (write `a store of value`, not `C a store of value`).
- A question may continue across a page break — reassemble it before judging it complete.
- If the PDF is an extract ("Pages from …") the first or last question may be cut in half. If a stem has no four options, or options have no stem: **skip it and report it**.

## Step 3 — Classify each question

Decide where the option content lives. Three cases:

**Case T — text-only** (no table, no diagram):
- Options 1–4 = the four option texts, letters stripped.
- Image Link = empty.

**Case V — has a visual, but the four options are ordinary text lines outside it** (e.g. a demand/supply diagram followed by four text options):
- Options 1–4 = the four option texts, letters stripped.
- Crop the visual → PNG → Image Link (Step 4).

**Case O — the option content IS the visual** (a table whose rows are labelled A–D, e.g. a from/to price table):
- Options 1–4 = literally `A`, `B`, `C`, `D` (single capital letters).
- Crop the table **including its A–D row labels** → PNG → Image Link.

Edge cases:
- Stem has a data table AND the options are text → Case V (crop the data table, options as text).
- Two visuals in one question (e.g. a table and a diagram): a question holds **only ONE image**, so stack both into a single PNG (one above the other, in reading order).
- Maths/symbols in text: keep Unicode exactly — en-dash minus `–2`, `%`, `$`, curly apostrophes. Subscripts like Y₁ may flatten to `Y1`; that is acceptable.

## Step 4 — Crop and store the images

**Crop spec:** render the page at high resolution (≈200 DPI), crop tightly around the table/diagram plus ~10 px margin, white background, save as **PNG**, target width ≤ 1400 px, file **must be under 2 MB** (the site rejects bigger).

Do NOT crop the whole page, the question number, the stem text (unless it is inside the diagram), or the footer.

**Getting the PNG into the site — pick ONE of these, in order of preference:**

1. **Upload via the API** (needs a logged-in teacher session): `POST /api/media/upload` with JSON body `{"data": "<base64 data URL of the PNG>"}`. The response is `{"url": "/api/media/<id>"}` — put that URL in the row's Image Link. Uploads over 2 MB are rejected.
2. **Hand the PNGs to ttan**: leave Image Link empty, save each image as `q01.png, q02.png, …` matching the CSV row order, and tell ttan to attach each one in the question editor after importing (Question bank ▸ edit question ▸ media).
3. A public `https://` image URL also works in Image Link (max 500 characters) — but the site hot-links it (it is NOT downloaded), so it breaks if the host removes it. Avoid unless ttan asks.

## Step 5 — The CSV contract

Header row, exactly once, at the top:

```
Subject,Question Sets,Difficulty,Question Text,Question Type,Option 1,Option 2,Option 3,Option 4,Option 5,Time in seconds,Correct Answer,Image Link,Incorrect Answers,Answer Explanation
```

| Column | What to put |
| --- | --- |
| Subject | `Economics` — every row |
| Question Sets | the set name ttan gives you in Step 7 — identical on every row |
| Difficulty | `3` unless ttan says otherwise (integers 1–5) |
| Question Text | the stem only — no question number, no options |
| Question Type | `Multiple Choice` — every row |
| Option 1–4 | Case T/V: the four option texts. Case O: `A`,`B`,`C`,`D` |
| Option 5 | always empty (Paper 1 has four options) |
| Time in seconds | empty unless ttan asks for timers (whole seconds 1–3600; empty = no timer) |
| Correct Answer | ONE digit 1–4 (A=1 B=2 C=3 D=4) |
| Image Link | `/api/media/<id>` from Step 4, or empty |
| Incorrect Answers | always empty |
| Answer Explanation | empty, unless ttan supplies explanations (max 2000 chars) |

**CSV formatting rules:**
- UTF-8. Preserve `–`, `%`, `$`, `’` exactly as printed.
- Quote any field containing a comma, a double-quote or a line break, with `"…"`. Double any internal quotes (`"` → `""`). Quoted line breaks are supported.
- Collapse mid-sentence line wraps from the PDF into single spaces. Keep a real line break only where the paper starts a new paragraph.
- All four options must be non-empty and in order (the importer rejects gaps).
- Maximum 1000 rows per import.

## Step 6 — The answer key

The question paper does **not** contain answers.

- If ttan gave you the **mark scheme PDF**, take each answer from it and convert the letter to a digit.
- Otherwise, **ask ttan now** (before Step 7): list the questions you extracted (short stem snippets, numbered in YOUR row order) and ask for the answer letters. Convert to digits.
- Never leave Correct Answer empty and never guess an answer.

## Step 7 — LAST: ask for the set name, then emit

1. Ask ttan: **"What should the Question Sets name be?"** — this is deliberately the final question.
2. If the name matches one of ttan's existing sets (case-insensitive), the rows are **appended** to that set. Mention this and confirm that's intended.
3. Fill the name into every row, save the file as `<set name>.csv` (strip characters that are invalid in filenames), and hand it over.
4. Tell ttan where to import: **teacher console ▸ Question bank ▸ Import / export ▸ choose the file ▸ Import**. The site replies with imported/failed counts.
5. Report anything you skipped, and (if using Step 4 option 2) list which PNG belongs to which question.

If the import reports `failed > 0`: the failed rows were skipped, the rest are already in. Fix ONLY the failed rows and import a CSV containing just those — re-importing the whole file duplicates everything else.

## Final checklist — verify EVERY line before handing over

- Header is exactly the 15-column line above, once, at the top.
- Row count = number of questions you extracted.
- Every row: Subject `Economics`, Type `Multiple Choice`, same set name.
- Every Correct Answer is a single digit 1–4. No letters. No blanks. No `1,3`.
- Case O rows: options are exactly `A,B,C,D` AND Image Link is filled.
- Case T/V rows: four non-empty option texts, no leading `A `/`B `/`C `/`D ` labels.
- Option 5, Incorrect Answers empty everywhere; Answer Explanation only if ttan supplied it.
- No printed question numbers inside Question Text.
- Every quoted field balanced; no stray unquoted commas (paste the CSV into a parser mentally or count columns per row = 15).
- Every uploaded image is PNG ≤ 2 MB and its `/api/media/…` URL came from a real upload response.
- Unicode intact: `–2` not `-2`? — keep whatever the paper printed.

## Worked examples (from 9708/11 May/June 2013)

**Case O** — printed Q7: stem, then a from/to price table whose rows are labelled A–D. Crop the table (with the A–D labels) and upload it; options are the four letters; the mark scheme gives C → `3`:

```
Economics,SET NAME HERE,3,"A fall in the price of cars causes the demand for petrol to rise by 20%. The cross-elasticity of demand between cars and petrol is –2. Which change in car prices has brought this about?",Multiple Choice,A,B,C,D,,,3,/api/media/e404f285-1d21-4550-99ac-801f5accb946,,
```

**Case V** — printed Q1: a production-possibility-curve diagram, then four text options. Crop only the diagram; options are the texts with letters stripped; mark scheme gives D → `4`:

```
Economics,SET NAME HERE,3,"The diagram shows the production possibility curve (PPC) of an economy that produces goods and services. What might cause the shift of the PPC from XY1 to XY2?",Multiple Choice,a decrease in the demand for services,a decrease in the efficiency in the production of services,a decrease in the opportunity cost of producing services,a decrease in the resources employed in services,,,4,/api/media/EXAMPLE-ID-FROM-YOUR-UPLOAD,,
```

**Case T** — text-only, no image (answer 0.02 → option 3):

```
Economics,SET NAME HERE,3,"In a town, bus fares fall by 50% and this leads to an increase in bus use by 30%. The effect on car use is very low with only a 1% reduction. What is the value of the cross-elasticity of demand between car travel and bus travel?",Multiple Choice,–0.60,–0.02,0.02,0.6,,,3,,,
```

## Things that break the site (never do these)

- A letter or blank in Correct Answer → that row errors out of the import.
- Two numbers in Correct Answer → the question silently becomes multi-select.
- A gap in the options (Option 2 empty while Option 3 filled) → row rejected.
- An image over 2 MB → upload rejected; over ~1400 px wide is wasteful.
- Unquoted commas/line breaks in a field → the columns shift and the row garbles.
- A second header row mid-file → imports as a junk question.
- Re-importing a whole file after a partial failure → duplicates.
