Tools

The command line and the library

Check records where they live: in a folder of exports, in CI before an import, or in your own software. The same code runs the editor, so a file gets the same answers everywhere.

orr, the command line

Validates a file against the JSON Schema and runs the editor's checks. Node.js 18 or newer:

npx open-repair-record check Q-1204.orr.json
orr check
$ npx open-repair-record check Q-1204.orr.json
Checking Q-1204.orr.json (Open Repair Record 1.0)
╭───────────────┬─────────┬────────────────────────────────────────────────────────────────────╮
│ Result        │ Where   │ Finding                                                            │
├───────────────┼─────────┼────────────────────────────────────────────────────────────────────┤
│ contradiction │ Closure │ Closed as "confirmed by the resident", but the resident's answer   │
│               │         │ is "No reply".                                                     │
│ missing       │ Check 1 │ Write what the check found.                                        │
╰───────────────┴─────────┴────────────────────────────────────────────────────────────────────╯
✗ Valid against the schema, but the record contradicts itself: 1 contradiction · 1 missing · 0 tips.
CommandDoes
orr check <file|folder|->Schema and checks. A folder means every *.json in it; - reads standard input.
orr validate <file|folder|->The JSON Schema only.
orr render <file> -o report.htmlThe readable report as one standalone HTML page, to print or save as PDF.
orr new -o file.jsonAn empty record to fill in.

--json gives machine-readable output; --strict also fails on missing parts. Exit code 1 means a file is invalid or contradicts itself, so orr check exports/ can stop a pipeline. Install it for good with npm install -g open-repair-record.

open-repair-record, the library

TypeScript types included, no dependencies; Node.js, browsers, Deno and Bun.

npm install open-repair-record
import { parse, check, residentRequest } from "open-repair-record";

const { record, errors } = parse(text);   // JSON text -> a record, or the schema errors in plain words
if (record) {
  for (const f of check(record)) {        // contradiction | warning | tip, with the part it is about
    console.log(f.level, f.section, f.message);
  }
  console.log(residentRequest(record));   // a neutral yes/no question for the resident
}

Also: validate, clean, emptyRecord, contractorRequest, the labels for every code and the JSON Schema (open-repair-record/schema). The validator is precompiled, so it needs no eval and runs under a strict Content-Security-Policy.

More