Example #1
0
    def test_metastatic_overdue(self):
        # if the user completed something on time, and nothing else
        # is due, should see the thankyou message.

        # backdate so the baseline q's have expired
        mock_qr(user_id=TEST_USER_ID,
                instrument_id='epic26',
                status='in-progress')
        self.bless_with_basics(backdate=timedelta(days=31))
        self.mark_metastatic()
        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user)
        self.assertEquals(a_s.overall_status, "Partially Completed")

        # with all q's from baseline expired,
        # instruments_needing_full_assessment and insturments_in_progress
        # should be empty
        self.assertFalse(a_s.instruments_needing_full_assessment('baseline'))
        self.assertFalse(a_s.instruments_in_progress('baseline'))

        # mock completing the indefinite QB and expect to see 'thank you'
        mock_qr(user_id=TEST_USER_ID, instrument_id='irondemog')
        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user)
        self.assertTrue(a_s.enrolled_in_classification('indefinite'))
        self.assertFalse(a_s.instruments_needing_full_assessment('indefinite'))
        self.assertFalse(a_s.instruments_in_progress('indefinite'))
    def test_localized_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)
        self.mark_localized()
        # backdate so the baseline q's have expired
        mock_qr(instrument_id='epic26',
                status='in-progress',
                doc_id='doc-26',
                timestamp=backdate)

        self.test_user = db.session.merge(self.test_user)
        as_of_date = backdate + relativedelta(days=2)
        a_s = AssessmentStatus(user=self.test_user, as_of_date=as_of_date)
        assert a_s.overall_status == "In Progress"

        # with only epic26 started, should see results for both
        # instruments_needing_full_assessment and insturments_in_progress
        assert \
            {'eproms_add', 'comorb'} ==\
            set(a_s.instruments_needing_full_assessment())
        assert ['doc-26'] == a_s.instruments_in_progress()
Example #3
0
    def test_localized_using_org(self):
        self.bless_with_basics()
        self.mark_localized()
        self.test_user = db.session.merge(self.test_user)

        # confirm appropriate instruments
        a_s = AssessmentStatus(user=self.test_user)
        self.assertEquals(
            set(a_s.instruments_needing_full_assessment('baseline')),
            localized_instruments)

        # check due date access
        for questionnaire in a_s.questionnaire_data.baseline():
            self.assertTrue(questionnaire.get('by_date') > datetime.utcnow())

        self.assertFalse(a_s.instruments_in_progress('baseline'))
        self.assertFalse(a_s.instruments_in_progress('all'))
    def test_metastatic_due(self):
        # hasn't taken, but still in "Due" period
        self.bless_with_basics()  # pick up a consent, etc.
        self.mark_metastatic()
        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user, as_of_date=now)
        assert a_s.overall_status == "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')
Example #5
0
    def test_metastatic_due(self):
        # hasn't taken, but still in "Due" period
        self.bless_with_basics()  # pick up a consent, etc.
        self.mark_metastatic()
        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user)
        self.assertEquals(a_s.overall_status, "Due")

        # confirm list of expected intruments needing attention
        a_s.instruments_needing_full_assessment('baseline')
        self.assertEquals(
            metastatic_baseline_instruments,
            set(a_s.instruments_needing_full_assessment('baseline')))
        self.assertFalse(a_s.instruments_in_progress('baseline'))

        # metastatic indefinite should also be 'due'
        self.assertEquals(
            metastatic_indefinite_instruments,
            set(a_s.instruments_needing_full_assessment('indefinite')))
        self.assertFalse(a_s.instruments_in_progress('indefinite'))
Example #6
0
    def test_localized_on_time(self):
        # User finished both on time
        self.bless_with_basics()  # pick up a consent, etc.
        self.mark_localized()
        mock_qr(user_id=TEST_USER_ID, instrument_id='eproms_add')
        mock_qr(user_id=TEST_USER_ID, instrument_id='epic26')
        mock_qr(user_id=TEST_USER_ID, instrument_id='comorb')

        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user)
        self.assertEquals(a_s.overall_status, "Completed")

        # confirm appropriate instruments
        self.assertFalse(a_s.instruments_needing_full_assessment('all'))
        self.assertFalse(a_s.instruments_in_progress('baseline'))
Example #7
0
    def test_localized_in_process(self):
        # User finished one, time remains for other
        self.bless_with_basics()  # pick up a consent, etc.
        self.mark_localized()
        mock_qr(user_id=TEST_USER_ID, instrument_id='eproms_add')

        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user)
        self.assertEquals(a_s.overall_status, "In Progress")

        # confirm appropriate instruments
        self.assertEquals(
            localized_instruments -
            set(a_s.instruments_needing_full_assessment('all')),
            set(['eproms_add']))
        self.assertFalse(a_s.instruments_in_progress('baseline'))
    def test_localized_in_process(self):
        # User finished one, time remains for other
        self.bless_with_basics()  # pick up a consent, etc.
        self.mark_localized()
        mock_qr(instrument_id='eproms_add')

        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user, as_of_date=now)
        assert a_s.overall_status == "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()  # pick up a consent, etc.
        self.mark_metastatic()
        for i in metastatic_baseline_instruments:
            mock_qr(instrument_id=i)
        mi_qb = QuestionnaireBank.query.filter_by(
            name='metastatic_indefinite').first()
        mock_qr(instrument_id='irondemog', qb=mi_qb)

        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user, as_of_date=now)
        assert a_s.overall_status == "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()  # pick up a consent, etc.
        self.mark_localized()
        mock_qr(instrument_id='eproms_add',
                status='in-progress',
                doc_id='eproms_add')
        mock_qr(instrument_id='epic26', status='in-progress', doc_id='epic26')
        mock_qr(instrument_id='comorb', status='in-progress', doc_id='comorb')

        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user, as_of_date=now)
        assert a_s.overall_status == "In Progress"

        # confirm appropriate instruments
        assert not a_s.instruments_needing_full_assessment()
        assert set(a_s.instruments_in_progress()) == localized_instruments
Example #11
0
    def test_metastatic_on_time(self):
        # User finished both on time
        self.bless_with_basics()  # pick up a consent, etc.
        mock_qr(user_id=TEST_USER_ID, instrument_id='eortc')
        mock_qr(user_id=TEST_USER_ID, instrument_id='ironmisc')
        mock_qr(user_id=TEST_USER_ID, instrument_id='factfpsi')
        mock_qr(user_id=TEST_USER_ID, instrument_id='epic26')
        mock_qr(user_id=TEST_USER_ID, instrument_id='prems')
        mock_qr(user_id=TEST_USER_ID, instrument_id='irondemog')

        self.mark_metastatic()
        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user)
        self.assertEquals(a_s.overall_status, "Completed")

        # shouldn't need full or any inprocess
        self.assertFalse(a_s.instruments_needing_full_assessment('all'))
        self.assertFalse(a_s.instruments_in_progress('all'))
    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)
        self.mark_localized()
        # backdate so the baseline q's have expired
        mock_qr(instrument_id='epic26', status='in-progress')

        self.test_user = db.session.merge(self.test_user)
        a_s = AssessmentStatus(user=self.test_user, as_of_date=nowish)
        assert a_s.overall_status == "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()