colregs 0.2.2 → 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 +42 -18
- package/data/images.json +570 -33
- package/data/rules.json +40 -20
- package/data/version.json +3 -0
- 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/0009-data-version-stamp.md +47 -0
- 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 +7 -2
- package/docs/requirements.md +36 -6
- package/docs/verification/2026-09-09-text-slug-straw-man.md +264 -0
- package/fixtures/applicability-fixtures.json +49 -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/schema/version.schema.json +16 -0
|
@@ -3664,6 +3664,84 @@
|
|
|
3664
3664
|
}
|
|
3665
3665
|
}
|
|
3666
3666
|
}
|
|
3667
|
+
},
|
|
3668
|
+
{
|
|
3669
|
+
"name": "13(d) latch: 13(a)'s sector test suppressed on the newly-gaining vessel",
|
|
3670
|
+
"status": "binding",
|
|
3671
|
+
"narrative": "Own already holds 13(d)'s latch from an earlier overtaking. Since then the pair has closed again from the other direction: the other now sits dead astern of own, gaining at three knots -- 13(a)'s sector test, read on her geometry alone, would newly name her give-way too. The latch forbids it: only own, the latch-holder, gives way (Q-47).",
|
|
3672
|
+
"expect": [
|
|
3673
|
+
"4",
|
|
3674
|
+
"11",
|
|
3675
|
+
"7d1",
|
|
3676
|
+
"8f3",
|
|
3677
|
+
"13a",
|
|
3678
|
+
"13b-overtaken",
|
|
3679
|
+
"13d"
|
|
3680
|
+
],
|
|
3681
|
+
"situation": {
|
|
3682
|
+
"own": {
|
|
3683
|
+
"fact": {
|
|
3684
|
+
"fact:propulsion": "propulsion:power",
|
|
3685
|
+
"fact:activity": "activity:none",
|
|
3686
|
+
"fact:position": "position:underway",
|
|
3687
|
+
"fact:making_way": true,
|
|
3688
|
+
"fact:length_m": 28
|
|
3689
|
+
},
|
|
3690
|
+
"kin": {
|
|
3691
|
+
"kin:position": {
|
|
3692
|
+
"latitude": 50.0,
|
|
3693
|
+
"longitude": -1.4
|
|
3694
|
+
},
|
|
3695
|
+
"kin:heading_deg": 0,
|
|
3696
|
+
"kin:sog_kn": 10,
|
|
3697
|
+
"kin:rot_deg_min": 0,
|
|
3698
|
+
"kin:dynamics": "dynamics:cargo"
|
|
3699
|
+
},
|
|
3700
|
+
"geo": {
|
|
3701
|
+
"geo:rel_bearing_deg": 180
|
|
3702
|
+
},
|
|
3703
|
+
"hist": {
|
|
3704
|
+
"hist:was_overtaking": true,
|
|
3705
|
+
"hist:latched_at_s": 900
|
|
3706
|
+
}
|
|
3707
|
+
},
|
|
3708
|
+
"other": {
|
|
3709
|
+
"fact": {
|
|
3710
|
+
"fact:propulsion": "propulsion:power",
|
|
3711
|
+
"fact:activity": "activity:none",
|
|
3712
|
+
"fact:position": "position:underway",
|
|
3713
|
+
"fact:making_way": true,
|
|
3714
|
+
"fact:length_m": 16
|
|
3715
|
+
},
|
|
3716
|
+
"kin": {
|
|
3717
|
+
"kin:position": {
|
|
3718
|
+
"latitude": 49.995503,
|
|
3719
|
+
"longitude": -1.4
|
|
3720
|
+
},
|
|
3721
|
+
"kin:heading_deg": 0,
|
|
3722
|
+
"kin:sog_kn": 13,
|
|
3723
|
+
"kin:rot_deg_min": 0,
|
|
3724
|
+
"kin:dynamics": "dynamics:ferry"
|
|
3725
|
+
},
|
|
3726
|
+
"geo": {
|
|
3727
|
+
"geo:rel_bearing_deg": 0
|
|
3728
|
+
},
|
|
3729
|
+
"hist": {
|
|
3730
|
+
"hist:was_overtaking": false,
|
|
3731
|
+
"hist:latched_at_s": null
|
|
3732
|
+
}
|
|
3733
|
+
},
|
|
3734
|
+
"pair": {
|
|
3735
|
+
"geo": {
|
|
3736
|
+
"geo:range_m": 500,
|
|
3737
|
+
"geo:bearing_change_deg_min": 0.0,
|
|
3738
|
+
"geo:cpa_m": 0,
|
|
3739
|
+
"geo:tcpa_s": 324.0,
|
|
3740
|
+
"geo:in_sight": true,
|
|
3741
|
+
"geo:risk_of_collision": true
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3667
3745
|
}
|
|
3668
3746
|
],
|
|
3669
3747
|
"override_note": "`expect` names every entry whose predicate the situation satisfies, including entries that a rel:overrides then displaces. Applicability and resolution are two steps: 18(a)(iv) really does apply to a WIG craft near the surface -- she is a power-driven vessel underway -- and 18(f)(i) overriding it is what the engine does next. A fixture that hid the overridden entry would make the override unobservable and the relation untestable.",
|
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 },
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/version.schema.json",
|
|
4
|
+
"title": "data/version.json",
|
|
5
|
+
"description": "The single version stamp for all of data/ and fixtures/, mirroring package.json's version at release time. One source of truth -- see docs/adr/0009-data-version-stamp.md (release-please's extra-files generic JSON updater keeps this in sync; never hand-edit). Structure only -- see docs/adr/0006-json-schema-and-identifier-diff.md.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["version"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"version": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+$",
|
|
13
|
+
"description": "Matches package.json's version at release time (REQ-VERIFY; docs/adr/0009-data-version-stamp.md). Not hand-edited -- release-please's extra-files JSON updater stamps it on every release."
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|