def test_metastatic_due(self): # hasn't taken, but still in OverallStatus.due period self.bless_with_basics(local_metastatic='metastatic', setdate=now) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=now) assert a_s.overall_status == OverallStatus.due # confirm list of expected intruments needing attention assert (metastatic_baseline_instruments == set(a_s.instruments_needing_full_assessment())) assert not a_s.instruments_in_progress() # metastatic indefinite should also be 'due' assert (metastatic_indefinite_instruments == set(a_s.instruments_needing_full_assessment('indefinite'))) assert not a_s.instruments_in_progress('indefinite')
def test_metastatic_due(self): # hasn't taken, but still in OverallStatus.due period self.bless_with_basics(local_metastatic='metastatic', setdate=now) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=now) assert a_s.overall_status == OverallStatus.due # confirm list of expected intruments needing attention assert (metastatic_baseline_instruments == set(a_s.instruments_needing_full_assessment())) assert not a_s.instruments_in_progress() # metastatic indefinite should also be 'due' assert (metastatic_indefinite_instruments == set(a_s.instruments_needing_full_assessment('indefinite'))) assert not a_s.instruments_in_progress('indefinite')
def test_localized_in_process(self): # User finished one, time remains for other self.bless_with_basics(local_metastatic='localized', setdate=now) mock_qr(instrument_id='eproms_add', timestamp=now) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=now) assert a_s.overall_status == OverallStatus.in_progress # confirm appropriate instruments assert (localized_instruments - set(a_s.instruments_needing_full_assessment('all')) == {'eproms_add'}) assert not a_s.instruments_in_progress()
def test_localized_in_process(self): # User finished one, time remains for other self.bless_with_basics(local_metastatic='localized', setdate=now) mock_qr(instrument_id='eproms_add', timestamp=now) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=now) assert a_s.overall_status == OverallStatus.in_progress # confirm appropriate instruments assert (localized_instruments - set(a_s.instruments_needing_full_assessment('all')) == {'eproms_add'}) assert not a_s.instruments_in_progress()
def test_metastatic_on_time(self): # User finished both on time self.bless_with_basics( local_metastatic='metastatic', setdate=now) for i in metastatic_baseline_instruments: mock_qr(instrument_id=i, timestamp=now) mi_qb = QuestionnaireBank.query.filter_by( name='metastatic_indefinite').first() mock_qr(instrument_id='irondemog', qb=mi_qb, timestamp=now) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=now) assert a_s.overall_status == OverallStatus.completed # shouldn't need full or any inprocess assert not a_s.instruments_needing_full_assessment('all') assert not a_s.instruments_in_progress('all')
def test_metastatic_on_time(self): # User finished both on time self.bless_with_basics( local_metastatic='metastatic', setdate=now) for i in metastatic_baseline_instruments: mock_qr(instrument_id=i, timestamp=now) mi_qb = QuestionnaireBank.query.filter_by( name='metastatic_indefinite').first() mock_qr(instrument_id='irondemog', qb=mi_qb, timestamp=now) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=now) assert a_s.overall_status == OverallStatus.completed # shouldn't need full or any inprocess assert not a_s.instruments_needing_full_assessment('all') assert not a_s.instruments_in_progress('all')
def test_localized_inprogress_on_time(self): # User finished both on time self.bless_with_basics(local_metastatic='localized', setdate=now) mock_qr( instrument_id='eproms_add', status='in-progress', doc_id='eproms_add', timestamp=now) mock_qr( instrument_id='epic26', status='in-progress', doc_id='epic26', timestamp=now) mock_qr( instrument_id='comorb', status='in-progress', doc_id='comorb', timestamp=now) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=now) assert a_s.overall_status == OverallStatus.in_progress # confirm appropriate instruments assert not a_s.instruments_needing_full_assessment() assert set(a_s.instruments_in_progress()) == localized_instruments
def test_localized_inprogress_on_time(self): # User finished both on time self.bless_with_basics(local_metastatic='localized', setdate=now) mock_qr( instrument_id='eproms_add', status='in-progress', doc_id='eproms_add', timestamp=now) mock_qr( instrument_id='epic26', status='in-progress', doc_id='epic26', timestamp=now) mock_qr( instrument_id='comorb', status='in-progress', doc_id='comorb', timestamp=now) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=now) assert a_s.overall_status == OverallStatus.in_progress # confirm appropriate instruments assert not a_s.instruments_needing_full_assessment() assert set(a_s.instruments_in_progress()) == localized_instruments
def test_metastatic_as_of_date(self): # backdating consent beyond expired and the status lookup date # within a valid window should show available assessments. backdate, nowish = associative_backdate( now=now, backdate=relativedelta(months=3)) self.bless_with_basics(setdate=backdate, local_metastatic='metastatic') # backdate so the baseline q's have expired mock_qr(instrument_id='epic23', status='in-progress', doc_id='doc-23', timestamp=backdate) self.test_user = db.session.merge(self.test_user) as_of_date = backdate + relativedelta(days=2) a_s = QB_Status(user=self.test_user, as_of_date=as_of_date) assert a_s.overall_status == OverallStatus.in_progress # with only epic26 started, should see results for both # instruments_needing_full_assessment and instruments_in_progress assert ['doc-23'] == a_s.instruments_in_progress() assert a_s.instruments_needing_full_assessment()
def test_metastatic_as_of_date(self): # backdating consent beyond expired and the status lookup date # within a valid window should show available assessments. backdate, nowish = associative_backdate( now=now, backdate=relativedelta(months=3)) self.bless_with_basics(setdate=backdate, local_metastatic='metastatic') # backdate so the baseline q's have expired mock_qr(instrument_id='epic23', status='in-progress', doc_id='doc-23', timestamp=backdate) self.test_user = db.session.merge(self.test_user) as_of_date = backdate + relativedelta(days=2) a_s = QB_Status(user=self.test_user, as_of_date=as_of_date) assert a_s.overall_status == OverallStatus.in_progress # with only epic26 started, should see results for both # instruments_needing_full_assessment and instruments_in_progress assert ['doc-23'] == a_s.instruments_in_progress() assert a_s.instruments_needing_full_assessment()
def test_localized_overdue(self): # if the user completed something on time, and nothing else # is due, should see the thank you message. backdate, nowish = associative_backdate( now=now, backdate=relativedelta(months=3, hours=1)) self.bless_with_basics( setdate=backdate, local_metastatic='localized') # backdate so the baseline q's have expired mock_qr( instrument_id='epic26', status='in-progress', timestamp=backdate) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=nowish) assert a_s.overall_status == OverallStatus.partially_completed # with all q's expired, # instruments_needing_full_assessment and instruments_in_progress # should be empty assert not a_s.instruments_needing_full_assessment() assert not a_s.instruments_in_progress()
def test_localized_overdue(self): # if the user completed something on time, and nothing else # is due, should see the thank you message. backdate, nowish = associative_backdate( now=now, backdate=relativedelta(months=3, hours=1)) self.bless_with_basics( setdate=backdate, local_metastatic='localized') # backdate so the baseline q's have expired mock_qr( instrument_id='epic26', status='in-progress', timestamp=backdate) self.test_user = db.session.merge(self.test_user) a_s = QB_Status(user=self.test_user, as_of_date=nowish) assert a_s.overall_status == OverallStatus.partially_completed # with all q's expired, # instruments_needing_full_assessment and instruments_in_progress # should be empty assert not a_s.instruments_needing_full_assessment() assert not a_s.instruments_in_progress()