Skip to content

Commit 4f6ebf4

Browse files
Merge pull request #17 from NextCenturyCorporation/validation-rules
added validation rules to the readme
2 parents ceb9dfb + 19063f4 commit 4f6ebf4

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,92 @@ The dependencies json lists specific rules for the validator to follow. When lis
7070
| `valueMatch` | "[field1] must match one of the values from [field2]" | An object in the form [field1]: [field2]. Each value of the object is a field name whose values form the complete list of valid values for the corresponding key, [field1]. The value of [field1] must match one of these values. |
7171
| `conditions` | An object containing specific conditions that must apply before the appropriate action is taken | An object containing keys such as `length`, `exists`, or `value`, where the value of that key is the length or value that must hold true for the key to be required or ignored, or to require/forbid keys based on the existence of another key |
7272

73+
74+
## Validator Rules
75+
In order for a yaml file to be considered "valid", the following conditions must be met:
76+
### General Formatting
77+
* The yaml must not contain duplicate keys at the same level
78+
* The yaml must be in valid yaml format. To check your yaml format, use [yamllint](https://www.yamllint.com/)
79+
### General Type Checking and Required Keys
80+
* All value types should follow the `api.yaml` file
81+
* All keys defined as required by `api.yaml` are required
82+
* Exceptions to the two rules above include the following:
83+
* `scenario.scenes` is required
84+
* Each action in `scene.action_mapping` requires `scene_id`
85+
* Each action in `scene.action_mapping` requires `choice`
86+
* All vitals properties are required
87+
* `conscious`
88+
* `avpu`
89+
* `mental_status`
90+
* `breathing`
91+
* `hrpmin`
92+
* `Spo2`
93+
* `injury.status` may only be `hidden`, `discoverable`, or `visible`
94+
* `restricted_actions` cannot include `end_scenario` or `tag_character`
95+
* `justification` is a prohibited key in `action`
96+
* `visited` is a prohibited key in `character`
97+
* `session_complete` is a prohibited key in `scenario`
98+
* `scenario_complete` is a prohibited key in `state`
99+
* `elapsed_time` is a prohibited key in `state`
100+
* In `scenes.state`:
101+
* Only one `unstructured` property is required in the whole object
102+
* `Mission`, `Environment`, `DecisionEnvironment`, and `SimEnvironment` only require the `unstructured` property
103+
* `type` is a prohibted key in `SimEnvironment`
104+
* `AidDelay` can be empty
105+
### Dependencies
106+
#### Conditional Requirements
107+
* If `scenes[n].action_mapping[m].conditions` has a length of 2 or more, `scenes[n].action_mapping[m].condition_semantics` is required
108+
* If `scenes[n].transitions` has a length of 2 or more, `scenes[n].transition_semantics` is required
109+
* If `state.characters[n].demographics.military_disposition` is "Allied US", `state.characters[n].demographics.military_branch` is required
110+
* If `state.characters[n].injuries[m].name` is "Burn", `state.characters[n].injuries[m].severity` is required
111+
* If `scenes[n].action_mapping[m].action_type` is "APPLY_TREATMENT", `scenes[n].action_mapping[m].character_id` is required
112+
* If `scenes[n].action_mapping[m].action_type` is "CHECK_ALL_VITALS", `scenes[n].action_mapping[m].character_id` is required
113+
* If `scenes[n].action_mapping[m].action_type` is "CHECK_PULSE", `scenes[n].action_mapping[m].character_id` is required
114+
* If `scenes[n].action_mapping[m].action_type` is "CHECK_RESPIRATION", `scenes[n].action_mapping[m].character_id` is required
115+
* If `scenes[n].action_mapping[m].action_type` is "MOVE_TO_EVAC", `scenes[n].action_mapping[m].character_id` is required
116+
* If `scenes[n].action_mapping[m].action_type` is "TAG_CHARACTER", `scenes[n].action_mapping[m].character_id` is required
117+
* If `scenes[n].action_mapping[m].action_type` is "TAG_CHARACTER", `scenes[n].action_mapping[m].parameters.category` is required
118+
119+
#### Conditional Prohibitions
120+
* If `scenes[].index` is 0, `scenes[].state` should _not_ be provided
121+
* If `state.characters[n].demographics.military_branch` does not exist, `state.characters[n].demographics.rank` *and* `state.characters[n].demographics.rank_title` should _not_ be provided
122+
123+
#### Dependency Allowed Valuese
124+
* If `state.characters[n].vitals.conscious` is "False", `state.characters[n].vitals.avpu` should be "UNRESPONSIVE" and `state.characters[n].vitals.mental_status` should be "UNRESPONSIVE"
125+
126+
#### Value Matching
127+
* `scenes[n].action_mapping.character_id` must be one of the `state.characters.character_id`'s
128+
* `scenes[n].tagging.probe_responses[n].character_id` must be one of the `state.characters.character_id`'s
129+
* `scenes[n].action_mapping.conditions.character_vitals.character_id `must be one of the `state.characters.character_id`'s
130+
* `scenes[n].tagging.reference` must be one of the `scenes[n].index`'s
131+
132+
#### Other Rules
133+
* `scenes[n].action_mapping[m].parameters.treatment` must come from `SupplyTypeEnum`
134+
* `scenes[n].action_mapping[m].parameters.location` must come from `InjuryLocationEnum`
135+
* `scenes[n].action_mapping[m].parameters.category` must come from `CharacterTagEnum`
136+
* If there are `N` `scenario.scenes`, then `scenario.scenes[0]` through `N-1` must contain transitions
137+
* `scenario.state.characters.demographics.mission_importance` must be consistent with `scenario.state.mission.character_importance `
138+
* Every character with `mission_importance` should be an entry in `character_importance`, and vice-versa
139+
* This does not include "normal", which is the default level of importance. For example, a character may not specify `mission_importance` and `character_importance` may explicitly specify the character with importance "normal", or a character may specify `mission_importance` with "normal" and `character_importance` may not list that character
140+
141+
#### Injury/Location Matches
142+
Injuries are only allowed to have specific locations. Please follow the table to create valid matches.
143+
| Injury name | Allowed Locations |
144+
| --- | --- |
145+
| `Ear Bleed` | `left face`, `right face` |
146+
| `Asthmatic` | `unspecified`, `internal` |
147+
| `Laceration` | `left forearm`, `right forearm`, `left stomach`, `right stomach`, `left thigh`, `right thigh`, `left calf`, `right calf`, `left wrist`, `right wrist` |
148+
| `Puncture` | `left neck`, `right neck`, `left bicep`, `right bicep`, `left shoulder`, `right shoulder`, `left stomach`, `right stomach`, `left side`, `right side`, `left thigh`, `right thigh` |
149+
| `Shrapnel` | `left face`, `right face`, `left calf`, `right calf` |
150+
| `Chest Collapse` | `left chest`, `right chest` |
151+
| `Amputation` | `left wrist`, `right wrist`, `left calf`, `right calf` |
152+
| `Burn` | `right forearm`, `left forearm`, `right calf`, `left calf`, `right thigh`, `left thigh`, `right stomach`, `left stomach`, `right bicep`, `left bicep`, `right shoulder`, `left shoulder`, `right side`, `left side`, `right chest`, `left chest`, `right wrist`, `left wrist`, `left face`, `right face`, `left neck`, `right neck`, `unspecified` |
153+
| `Abrasion` | `right forearm`, `left forearm`, `right calf`, `left calf`, `right thigh`, `left thigh`, `right stomach`, `left stomach`, `right bicep`, `left bicep`, `right shoulder`, `left shoulder`, `right side`, `left side`, `right chest`, `left chest`, `right wrist`, `left wrist`, `left face`, `right face`, `left neck`, `right neck`, `unspecified` |
154+
| `Broken Bone` | `right forearm`, `left forearm`, `right thigh`, `left thigh`, `right shoulder`, `left shoulder`, `right side`, `left side`, `right wrist`, `left wrist`, `left neck`, `right neck`, `unspecified` |
155+
| `Internal` | `internal` |
156+
157+
#### Military Branches, Ranks, and Rank Titles
158+
* `military_branch` is only allowed if `military_disposition` is "Allied US"
159+
* `rank` and `rank_title` are not allowed if `military_branch` is not provided
160+
* `military_branch`, `rank`, and `rank_title` must match the information found [here](https://www.military.com/join-military/military-ranks-everything-you-need-know.html)
161+

0 commit comments

Comments
 (0)