I do not know what the big technical issue is, in monitoring physical and mental capacity before entrusting someone with a task that needs to ensure the safety of hundreds of souls.
Devise a test that measures visual acuity, mental alertness, situational awareness, reaction time and decision making skills in 5 to 10 minutes in the crew lounge before departure.
Have a chip card that has your baseline values for the test, updated with natural improvement of skill values as you get more expert, each time you take the test.
Red flag anyone who cannot perform to 95% or whatever of their known baseline.
It's that simple.