|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +## Adding a new reporter (or variation) |
| 4 | + |
| 5 | +Reporters live in `reporters_db/data/reporters.json`. The top-level key is the |
| 6 | +canonical Blue Book citation abbreviation; its value is a **list** of reporter |
| 7 | +objects (a list because the same abbreviation can refer to more than one |
| 8 | +reporter historically). |
| 9 | + |
| 10 | +### Data shape |
| 11 | + |
| 12 | +```json |
| 13 | +"Citation Abbrev.": [ |
| 14 | + { |
| 15 | + "cite_type": "federal", |
| 16 | + "editions": { |
| 17 | + "Citation Abbrev.": { "start": "1750-01-01T00:00:00", "end": null, "regexes": [] } |
| 18 | + }, |
| 19 | + "examples": ["12 Citation Abbrev. 432"], |
| 20 | + "variations": { "Citation Abbrev": "Citation Abbrev." }, |
| 21 | + "mlz_jurisdiction": ["us;federal"], |
| 22 | + "name": "Full Name Of The Reporter", |
| 23 | + "href": "https://...", // optional |
| 24 | + "notes": "...", // optional |
| 25 | + "publisher": "..." // optional |
| 26 | + } |
| 27 | +] |
| 28 | +``` |
| 29 | + |
| 30 | +### Rules |
| 31 | + |
| 32 | +- **Required fields:** `cite_type`, `editions`, `mlz_jurisdiction`, `name`, `variations`. |
| 33 | +- **`cite_type`** must be one of: `federal`, `neutral`, `scotus_early`, |
| 34 | + `specialty`, `specialty_west`, `specialty_lexis`, `state`, `state_regional`. |
| 35 | +- **Editions:** every reporter must have an edition keyed by the reporter's own |
| 36 | + abbreviation (the top-level key must appear in `editions`). Multiple series go |
| 37 | + here (e.g. `A.`, `A.2d`, `A.3d`). |
| 38 | +- **Dates:** ISO-8601 datetimes or `null`. `1750-01-01` = unknown start; `null` |
| 39 | + end = unknown/ongoing. `start <= end`. |
| 40 | +- **Variations:** a dict mapping the variant string → the canonical edition key. |
| 41 | + A variation must **not** equal the key it maps to, and must map to an edition |
| 42 | + that exists. |
| 43 | +- **Do not add whitespace-only variations.** Forms that differ from an existing |
| 44 | + abbreviation *only* in inter-token spacing (e.g. `N. Y. S. 2d` vs `N.Y.S.2d`, |
| 45 | + `F. R. D.` vs `F.R.D.`) are handled downstream by eyecite, which makes |
| 46 | + inter-token whitespace optional while keeping periods mandatory (see |
| 47 | + [eyecite#307](https://github.com/freelawproject/eyecite/pull/307)). Only add |
| 48 | + variations that differ in *spelling* (e.g. `App. Div.` → `A.D.`) or |
| 49 | + punctuation, not in spacing alone. |
| 50 | +- **Examples:** required only if custom `regexes` are provided. If regexes exist, |
| 51 | + every regex must match at least one example and every example must match at |
| 52 | + least one regex. |
| 53 | +- **Field hygiene:** strings are ASCII-ish (see allowed chars in `tests.py`), |
| 54 | + trimmed, no non-space whitespace. |
| 55 | + |
| 56 | +### Regexes (optional) |
| 57 | + |
| 58 | +The `regexes` list (per edition) holds raw regexes or placeholders substituted |
| 59 | +from `reporters_db/data/regexes.json` (Python `Template` syntax), e.g. |
| 60 | +`"$full_cite"`, `"$volume $reporter $page"`. Each regex must expose named |
| 61 | +`<reporter>` and `<page>` groups. Tip: `pip install exrex` and run tests with no |
| 62 | +examples to see what a new regex would match. |
| 63 | + |
| 64 | +### Workflow |
| 65 | + |
| 66 | +1. Branch off `main`, named `<issue>-<court-id>-variation` (e.g. `257-bia-variation`). |
| 67 | +2. Edit `reporters_db/data/reporters.json`. Keep keys sorted — JSON must equal |
| 68 | + `json.dumps(..., indent=4, ensure_ascii=False, sort_keys=True)`. Run tests |
| 69 | + with `FIX_JSON=1` to auto-reformat. |
| 70 | +3. Add a one-line entry under **Upcoming Changes** in `CHANGES.md`. Do **not** |
| 71 | + bump the version in `pyproject.toml` unless cutting a release. |
| 72 | +4. Run tests: `uv run --with jsonschema python tests.py` (all must pass). |
| 73 | +5. `reporters_db/data/reporters.csv` is regenerated separately (`make_csv.py`) |
| 74 | + on its own cadence — leave it alone in routine reporter/variation PRs. |
0 commit comments