Chapter 8 · section 4 of 5
In production
The deployed lookups read a database rather than an array, and the database is where two of the chapter’s details come from.
The laws table has a section column, derived at the time the rows are written by the same sectionOf, and indexed with the state. A section lookup is one query, and it asks for its sections as a single JSON array rather than one bound parameter each, because the database refuses a query with more than a hundred parameters and the nationwide path asks for fifty-one states’ worth at once:
`SELECT id, state, kind, law, question, concept, citation, as_of FROM laws
WHERE state = ? AND section IN (SELECT value FROM json_each(?))
ORDER BY rowid` The schedule lookup is by the whole key and never a prefix. A fine joined to § 16-1130 when § 16-113 was asked about would be a figure stated under a citation that does not say it, and the design document names that as the fault its test exists to catch.
The rows themselves come from npm run penalties:fetch, which reads each state’s schedule where one exists, a PDF table, a PDF printed one offence to a row, a statute’s list or an HTML table, through one small adapter per shape, and writes a row only when its quote is a substring of the fetched text. A row that fails is not written, and is named in the output. A state whose courts set fines locally, within a range the code gives, is recorded as such, and its rows say “set by the court” with the range and no figure. There is no model in that script; the script that uses a model for the agency’s pages is Chapter 9’s.
The family lookup is the third. When Chapter 6’s rephraser names a family, test-and-retake, say, the deployed pipeline adds that family’s page rows for the state to the pool before the reranker reads it, by key, whether or not any search found them; and when the reranker chooses none of them, the family’s best row by shared words is given beside the three. Texas’s minimum-insurance and passenger questions and Virginia’s permit question were answered right from the manual and never from the page before that, because the reranker had the manual’s line and no reason to take a second one saying the same.