broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if x['age'] < 16 or x['gcs'] < 15:
        return {'decision': 'NOT_APPLICABLE'}
    if x['age'] > 65 or x['dangerous_mechanism'] or x['paresthesias']:
        return {'decision': 'IMAGE'}
    low = [x['simple_rear_end'], x['sitting'], x['ambulatory'], x['delayed_onset'], x['no_midline_tenderness']]
    if not any(low):
        return {'decision': 'IMAGE'}
    if x['rotate_left'] >= 45 and x['rotate_right'] >= 45:
        return {'decision': 'NO_IMAGE'}
    return {'decision': 'IMAGE'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 51,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 61},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 31,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 21,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 31,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 26,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 52,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 62},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 32,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 22,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 32,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 27,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 53,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 63},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 33,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 23,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 33,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 28,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 54,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 64},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 34,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 24,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 34,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 29,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 55,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 65},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 25,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 35,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 30,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if x['age'] < 16 or x['gcs'] < 15:
        return {'decision': 'NOT_APPLICABLE'}
    if (x['age'] >= 65 and x['dangerous_mechanism']) or x['dangerous_mechanism'] or x['paresthesias']:
        return {'decision': 'IMAGE'}
    low = [x['simple_rear_end'], x['sitting'], x['ambulatory'], x['delayed_onset'], x['no_midline_tenderness']]
    if not any(low):
        return {'decision': 'IMAGE'}
    if x['rotate_left'] >= 45 and x['rotate_right'] >= 45:
        return {'decision': 'NO_IMAGE'}
    return {'decision': 'IMAGE'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 51,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 61},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 31,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 21,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 31,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 26,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 52,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 62},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 32,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 22,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 32,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 27,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 53,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 63},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 33,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 23,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 33,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 28,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 54,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 64},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 34,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 24,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 34,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 29,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 55,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 65},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 25,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 35,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 30,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A 65-year-old is assessed for range of motion instead of being imaged.

Input {age, gcs, dangerous_mechanism, paresthesias, simple_rear_end, sitting, ambulatory, delayed_onset, no_midline_tenderness, rotate_left, rotate_right (degrees)}. Toy rule: age < 16 or gcs < 15 NOT_APPLICABLE. High risk (age >= 65, dangerous mechanism or paresthesias) -> IMAGE. If none of the low-risk factors (simple rear-end collision, sitting, ambulatory, delayed onset, no midline tenderness) is present -> IMAGE. Otherwise NO_IMAGE when active rotation reaches 45 degrees both left and right, else IMAGE. Return {decision}.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if x['age'] < 16 or x['gcs'] < 15:
        return {'decision': 'NOT_APPLICABLE'}
    if x['age'] >= 65 or x['dangerous_mechanism'] or x['paresthesias']:
        return {'decision': 'IMAGE'}
    low = [x['simple_rear_end'], x['sitting'], x['ambulatory'], x['delayed_onset'], x['no_midline_tenderness']]
    if not all(low):
        return {'decision': 'IMAGE'}
    if x['rotate_left'] >= 45 and x['rotate_right'] >= 45:
        return {'decision': 'NO_IMAGE'}
    return {'decision': 'IMAGE'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 51,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 61},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 31,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 21,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 31,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 26,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 52,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 62},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 32,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 22,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 32,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 27,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 53,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 63},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 33,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 23,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 33,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 28,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 54,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 64},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 34,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 24,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 34,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 29,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 55,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 65},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 25,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 35,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 30,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if x['age'] < 16 or x['gcs'] < 15:
        return {'decision': 'NOT_APPLICABLE'}
    if x['age'] >= 65 or x['dangerous_mechanism'] or x['paresthesias']:
        return {'decision': 'IMAGE'}
    low = [x['simple_rear_end'], x['sitting'], x['ambulatory'], x['delayed_onset'], x['no_midline_tenderness']]
    if sum(low) < 2:
        return {'decision': 'IMAGE'}
    if x['rotate_left'] >= 45 and x['rotate_right'] >= 45:
        return {'decision': 'NO_IMAGE'}
    return {'decision': 'IMAGE'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 51,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 61},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 31,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 21,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 31,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 26,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 52,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 62},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 32,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 22,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 32,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 27,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 53,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 63},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 33,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 23,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 33,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 28,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 54,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 64},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 34,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 24,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 34,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 29,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})],
 [('age exactly 65',
   {'age': 65,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('age 64 with low-risk factors',
   {'age': 64,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('single low-risk factor',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 55,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('two low-risk factors',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 65},
   {'decision': 'NO_IMAGE'}),
  ('all low-risk factors',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': True,
    'sitting': True,
    'ambulatory': True,
    'delayed_onset': True,
    'no_midline_tenderness': True,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NO_IMAGE'}),
  ('rotation exactly 45 both ways',
   {'age': 25,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 45,
    'rotate_right': 45},
   {'decision': 'NO_IMAGE'}),
  ('rotation limited to one side',
   {'age': 40,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 35,
    'rotate_right': 70},
   {'decision': 'IMAGE'}),
  ('paresthesias in ambulatory patient',
   {'age': 30,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('paresthesias non-ambulatory',
   {'age': 35,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': True,
    'simple_rear_end': False,
    'sitting': True,
    'ambulatory': False,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'IMAGE'}),
  ('adolescent below applicability',
   {'age': 15,
    'gcs': 15,
    'dangerous_mechanism': False,
    'paresthesias': False,
    'simple_rear_end': False,
    'sitting': False,
    'ambulatory': True,
    'delayed_onset': False,
    'no_midline_tenderness': False,
    'rotate_left': 60,
    'rotate_right': 60},
   {'decision': 'NOT_APPLICABLE'})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Patients with a single low-risk factor are imaged without a rotation test.

Input {age, gcs, dangerous_mechanism, paresthesias, simple_rear_end, sitting, ambulatory, delayed_onset, no_midline_tenderness, rotate_left, rotate_right (degrees)}. Toy rule: age < 16 or gcs < 15 NOT_APPLICABLE. High risk (age >= 65, dangerous mechanism or paresthesias) -> IMAGE. If none of the low-risk factors (simple rear-end collision, sitting, ambulatory, delayed onset, no midline tenderness) is present -> IMAGE. Otherwise NO_IMAGE when active rotation reaches 45 degrees both left and right, else IMAGE. Return {decision}.

split: open-access