colregs 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PROVENANCE.md +4 -0
- package/README.md +109 -286
- package/data/applicability.json +13 -10
- package/data/images.json +570 -33
- package/data/rules.json +40 -20
- package/data/version.json +1 -1
- package/docs/adr/0001-name-and-jurisdiction-model.md +35 -2
- package/docs/adr/0003-language-as-a-dimension.md +1 -1
- package/docs/adr/0010-text-withheld-jurisdictions.md +123 -0
- package/docs/adr/0011-api-shape.md +173 -0
- package/docs/adr/0012-trace-and-rule2-departure-api.md +203 -0
- package/docs/budgets.json +6 -2
- package/docs/requirements.md +36 -6
- package/docs/verification/2026-09-09-text-slug-straw-man.md +264 -0
- package/fixtures/situation-fixtures.json +78 -0
- package/package.json +1 -1
- package/schema/images.schema.json +26 -1
- package/schema/rules.schema.json +75 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "colregs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "COLREGS 72 and its national amalgamations as language-neutral JSON — rule text, light definitions, and applicability predicates — with cross-implementation fixtures",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"additionalProperties": {
|
|
15
15
|
"type": "object",
|
|
16
16
|
"additionalProperties": false,
|
|
17
|
-
"required": ["file", "bytes", "sha256", "pixels", "source_url", "source", "retrieved", "rights"],
|
|
17
|
+
"required": ["file", "bytes", "sha256", "pixels", "source_url", "source", "retrieved", "rights", "transcript", "subjects", "description", "shapes"],
|
|
18
18
|
"properties": {
|
|
19
19
|
"file": { "type": "string", "minLength": 1 },
|
|
20
20
|
"bytes": { "type": "integer", "minimum": 0 },
|
|
@@ -44,6 +44,31 @@
|
|
|
44
44
|
"minItems": 1,
|
|
45
45
|
"items": { "type": "string", "minLength": 1 }
|
|
46
46
|
},
|
|
47
|
+
"depicts": {
|
|
48
|
+
"description": "Whether the figure shows the provision of the clauses it is mapped to, the exception they carve out, or both.",
|
|
49
|
+
"enum": ["provision", "exception", "mixed"]
|
|
50
|
+
},
|
|
51
|
+
"transcript": {
|
|
52
|
+
"description": "Every printed text block in the image, verbatim, in reading order. Empty when the image carries no text.",
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": { "type": "string", "minLength": 1 }
|
|
55
|
+
},
|
|
56
|
+
"subjects": {
|
|
57
|
+
"description": "What is drawn, one noun phrase per vessel or object, in plain maritime vocabulary, not the Convention's classes.",
|
|
58
|
+
"type": "array",
|
|
59
|
+
"minItems": 1,
|
|
60
|
+
"items": { "type": "string", "minLength": 1 }
|
|
61
|
+
},
|
|
62
|
+
"description": {
|
|
63
|
+
"description": "One paragraph of what the drawing contains: vessel type and its evidence, viewpoint, then the lights and shapes as drawn. No rule citations.",
|
|
64
|
+
"type": "string",
|
|
65
|
+
"minLength": 40
|
|
66
|
+
},
|
|
67
|
+
"shapes": {
|
|
68
|
+
"description": "The day shapes the figure draws, top to bottom, from the closed vocabulary. Empty when it draws none.",
|
|
69
|
+
"type": "array",
|
|
70
|
+
"items": { "enum": ["ball", "diamond", "cone-up", "cone-down", "cylinder", "basket", "flag-a"] }
|
|
71
|
+
},
|
|
47
72
|
"provenance_status": { "type": "string" },
|
|
48
73
|
"unmapped_reason": { "type": "string", "minLength": 1 }
|
|
49
74
|
}
|
package/schema/rules.schema.json
CHANGED
|
@@ -2,10 +2,37 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://github.com/mark-brannan/colregs/schema/rules.schema.json",
|
|
4
4
|
"title": "data/rules.json",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Rule text keyed by paragraph path, verbatim unless withheld under a licence bar. Structure only -- see docs/adr/0006-json-schema-and-identifier-diff.md and docs/adr/0010-text-withheld-jurisdictions.md.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": ["source", "paragraphs"],
|
|
9
|
+
"allOf": [
|
|
10
|
+
{
|
|
11
|
+
"$comment": "colregs#85: a withheld paragraph is a citation, not a reproduction (ADR 0010) -- 'retrieved' is when that citation was last checked against the primary source, so it can't be blank on a document that withholds text.",
|
|
12
|
+
"if": {
|
|
13
|
+
"properties": {
|
|
14
|
+
"paragraphs": {
|
|
15
|
+
"not": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"patternProperties": {
|
|
18
|
+
"^.*$": {
|
|
19
|
+
"not": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"properties": { "text_status": { "const": "withheld" } },
|
|
22
|
+
"required": ["text_status"]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"then": {
|
|
31
|
+
"properties": { "retrieved": { "type": "string" } },
|
|
32
|
+
"required": ["retrieved"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
],
|
|
9
36
|
"properties": {
|
|
10
37
|
"source": { "type": "string", "minLength": 1 },
|
|
11
38
|
"source_url": { "type": "string", "minLength": 1 },
|
|
@@ -30,13 +57,59 @@
|
|
|
30
57
|
"^[0-9]+(\\([a-z]\\))?(\\([ivx]+\\))?$": {
|
|
31
58
|
"type": "object",
|
|
32
59
|
"additionalProperties": false,
|
|
33
|
-
"required": ["path", "rule", "rule_title", "jurisdiction"
|
|
60
|
+
"required": ["path", "rule", "rule_title", "jurisdiction"],
|
|
61
|
+
"allOf": [
|
|
62
|
+
{
|
|
63
|
+
"$comment": "ADR 0010: a withheld paragraph is modelled but ships no text.",
|
|
64
|
+
"if": {
|
|
65
|
+
"properties": { "text_status": { "const": "withheld" } },
|
|
66
|
+
"required": ["text_status"]
|
|
67
|
+
},
|
|
68
|
+
"then": {
|
|
69
|
+
"properties": {
|
|
70
|
+
"text": false,
|
|
71
|
+
"withheld_reason": { "type": "string", "minLength": 1 }
|
|
72
|
+
},
|
|
73
|
+
"required": ["withheld_reason"]
|
|
74
|
+
},
|
|
75
|
+
"else": {
|
|
76
|
+
"$comment": "mirrors, text_digest and text_slug are open to verbatim paragraphs too; only withheld_reason is incoherent without a bar.",
|
|
77
|
+
"properties": {
|
|
78
|
+
"text": { "type": "string", "minLength": 1 },
|
|
79
|
+
"withheld_reason": false
|
|
80
|
+
},
|
|
81
|
+
"required": ["text"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
],
|
|
34
85
|
"properties": {
|
|
35
86
|
"path": { "type": "string", "pattern": "^[0-9]+(\\([a-z]\\))?(\\([ivx]+\\))?$" },
|
|
36
87
|
"rule": { "type": "string", "pattern": "^[0-9]+$" },
|
|
37
88
|
"rule_title": { "type": "string", "minLength": 1 },
|
|
38
89
|
"jurisdiction": { "type": "string", "pattern": "^[a-z]+(/[a-z]+)*$" },
|
|
39
90
|
"text": { "type": "string", "minLength": 1 },
|
|
91
|
+
"text_status": {
|
|
92
|
+
"$comment": "Absent means verbatim. 'withheld' means the text is not ours to publish -- ADR 0010.",
|
|
93
|
+
"enum": ["verbatim", "withheld"]
|
|
94
|
+
},
|
|
95
|
+
"withheld_reason": { "type": "string", "minLength": 1 },
|
|
96
|
+
"text_slug": {
|
|
97
|
+
"$comment": "Pencil, ADR 0010: sorted set of lemmatised key nouns and verbs, English counterparts where the source is not English. Defined so the option is not walled off; nothing writes it yet.",
|
|
98
|
+
"type": "array",
|
|
99
|
+
"items": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
|
|
100
|
+
"minItems": 1,
|
|
101
|
+
"uniqueItems": true
|
|
102
|
+
},
|
|
103
|
+
"text_digest": {
|
|
104
|
+
"$comment": "Pencil, ADR 0010: algorithm-qualified digest of the normalised text, e.g. 'sha256:<hex>'. Defined so the option is not walled off by additionalProperties; nothing writes it yet.",
|
|
105
|
+
"type": "string",
|
|
106
|
+
"pattern": "^[a-z0-9-]+:[A-Za-z0-9+/=]+$"
|
|
107
|
+
},
|
|
108
|
+
"mirrors": {
|
|
109
|
+
"$comment": "Paragraph path in intl this provision restates; display labelled as the international equivalent, never as this jurisdiction's text.",
|
|
110
|
+
"type": "string",
|
|
111
|
+
"pattern": "^[0-9]+(\\([a-z]\\))?(\\([ivx]+\\))?$"
|
|
112
|
+
},
|
|
40
113
|
"images": {
|
|
41
114
|
"type": "array",
|
|
42
115
|
"items": { "type": "string", "minLength": 1 },
|