Skip to content

Commit d82bfe8

Browse files
committed
feat(reporters): add "App. Div. 2d"/"App. Div. 3d" variations to A.D. (#258)
1 parent 3c5d6fc commit d82bfe8

3 files changed

Lines changed: 77 additions & 1 deletion

File tree

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- Other features (suggestions welcome)?
1212

1313
## Upcoming Changes
14-
-
14+
- Add no-trailing-period "App. Div. 2d"/"App. Div. 3d" variations to A.D. reporter (#258)
1515

1616

1717
## Current Version

CLAUDE.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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.

reporters_db/data/reporters.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@
109109
"App Div.": "A.D.",
110110
"App. Div": "A.D.",
111111
"App. Div.": "A.D.",
112+
"App. Div. 2d": "A.D.2d",
112113
"App. Div. 2d.": "A.D.2d",
114+
"App. Div. 3d": "A.D.3d",
113115
"App. Div. 3d.": "A.D.3d",
114116
"App. Div. Rep.": "A.D.",
115117
"App.Div.": "A.D.",

0 commit comments

Comments
 (0)