import json
from pathlib import Path
n=1000; error=100; sensitivity=.8; false_alarm=.1
true_positive=error*sensitivity; false_positive=(n-error)*false_alarm; missed=error-true_positive; true_negative=n-error-false_positive
r={'illustrative':True,'total':n,'errors':error,'true_positive':true_positive,'false_positive':false_positive,'missed_errors':missed,'true_negative':true_negative,'reviewed':true_positive+false_positive,'cleared':missed+true_negative,'negative_predictive_value':true_negative/(missed+true_negative),'review_hours':(true_positive+false_positive)*6/60,'blanket_review_hours':n*6/60,'gross_hours_avoided_before_overheads':(n-true_positive-false_positive)*6/60}
Path(__file__).with_name('results.json').write_text(json.dumps(r,indent=2)+'\n')
print(json.dumps(r))
