forked from ChelseaKR/nearmiss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathofficial-outcome.schema.json
More file actions
104 lines (104 loc) · 2.93 KB
/
Copy pathofficial-outcome.schema.json
File metadata and controls
104 lines (104 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/ChelseaKR/nearmiss/main/schema/official-outcome.schema.json",
"title": "nearmiss official road-safety outcome",
"description": "Canonical record for an official crash or injury outcome. This is deliberately separate from the self-reported near-miss intake contract.",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"id",
"source_record_id",
"occurred_on",
"location",
"outcome_type",
"maximum_injury_severity",
"fatality_count"
],
"properties": {
"schema_version": {
"type": "string",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
},
"id": {
"type": "string",
"format": "uuid",
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
},
"source_record_id": {
"description": "Source-defined record identity, unique within that official source. Adapters qualify year-scoped identifiers before emitting them.",
"type": "string",
"minLength": 1
},
"occurred_on": {
"type": "string",
"format": "date"
},
"occurred_time_local": {
"description": "Local civil time as reported by the source. No timezone is inferred.",
"type": "string",
"pattern": "^(?:[01][0-9]|2[0-3]):[0-5][0-9]$"
},
"location": {
"type": "object",
"additionalProperties": false,
"required": ["lat", "lon"],
"properties": {
"lat": {"type": "number", "minimum": -90, "maximum": 90},
"lon": {"type": "number", "minimum": -180, "maximum": 180}
}
},
"outcome_type": {
"type": "string",
"enum": ["motor_vehicle_traffic_crash"]
},
"maximum_injury_severity": {
"type": "string",
"enum": [
"fatal",
"suspected_serious_injury",
"suspected_minor_injury",
"possible_injury",
"no_apparent_injury",
"unknown"
]
},
"fatality_count": {
"type": "integer",
"minimum": 0
},
"involved_modes": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"enum": ["motor_vehicle", "motorcyclist", "cyclist", "pedestrian", "other_nonoccupant"]
}
},
"state_code": {
"description": "Source-native state code; no unsupported name mapping is inferred.",
"type": "string",
"minLength": 1
}
},
"allOf": [
{
"if": {
"properties": {"maximum_injury_severity": {"const": "fatal"}},
"required": ["maximum_injury_severity"]
},
"then": {
"properties": {"fatality_count": {"minimum": 1}}
}
},
{
"if": {
"properties": {"fatality_count": {"minimum": 1}},
"required": ["fatality_count"]
},
"then": {
"properties": {"maximum_injury_severity": {"const": "fatal"}}
}
}
]
}