Example #1
0
 def test_schedule_bad_crf_model(self):
     site_visit_schedules._registry = {}
     visit_schedule = VisitSchedule(
         name="visit_schedule",
         verbose_name="Visit Schedule",
         offstudy_model="visit_schedule_app.subjectoffstudy",
         death_report_model="visit_schedule_app.deathreport",
     )
     schedule = Schedule(
         name="schedule",
         onschedule_model="visit_schedule_app.onschedule",
         offschedule_model="visit_schedule_app.offschedule",
         appointment_model="edc_appointment.appointment",
         consent_model="visit_schedule_app.subjectconsent",
     )
     crfs = FormsCollection(
         Crf(show_order=10, model="blah.CrfOne"),
         Crf(show_order=20, model="blah.CrfTwo"),
         Crf(show_order=30, model="blah.CrfThree"),
     )
     visit = Visit(
         code="1000",
         rbase=relativedelta(days=0),
         rlower=relativedelta(days=0),
         rupper=relativedelta(days=6),
         facility_name="default",
         crfs=crfs,
         timepoint=1,
     )
     schedule.add_visit(visit)
     visit_schedule.add_schedule(schedule)
     site_visit_schedules.register(visit_schedule)
     errors = visit_schedule_check(app_configs=django_apps.get_app_configs())
     self.assertEqual(len(errors), 1)
     self.assertEqual("edc_visit_schedule.visits", errors[0].id)
Example #2
0
 def test_forms_collection_excludes_by_site_id3(self):
     crfs = []
     for i in range(0, 5):
         crfs.append(Crf(show_order=i, model=f"x.{i}"))
     for i in range(6, 11):
         crfs.append(Crf(show_order=i, model=f"x.{i}"))
     forms = FormsCollection(*crfs)
     self.assertEqual(len(forms.forms), 10)
Example #3
0
 def test_forms_collection_order(self):
     crfs = []
     for i in range(0, 10):
         crfs.append(Crf(show_order=i, model="x.x"))
     try:
         FormsCollection(*crfs)
     except FormsCollectionError as e:
         self.fail(f"FormsCollectionError unexpectedly raised. Got {e}")
     crfs.append(Crf(show_order=0, model="x.x"))
     self.assertRaises(FormsCollectionError, FormsCollection, *crfs)
from edc_visit_schedule.schedule import Schedule
from edc_visit_schedule.visit import FormsCollection, Crf, Visit
from edc_visit_schedule.visit_schedule import VisitSchedule

from dateutil.relativedelta import relativedelta

crfs = FormsCollection(
    Crf(show_order=1, model=f'edc_reference.crfone', required=True), )

visit0 = Visit(code='1000',
               title='Day 1',
               timepoint=0,
               rbase=relativedelta(days=0),
               rlower=relativedelta(days=0),
               rupper=relativedelta(days=6),
               crfs=crfs,
               facility_name='default')

schedule = Schedule(name='schedule',
                    onschedule_model='edc_reference.onschedule',
                    offschedule_model='edc_reference.offschedule',
                    appointment_model='edc_appointment.appointment',
                    consent_model='edc_reference.subjectconsent')

schedule.add_visit(visit0)

visit_schedule = VisitSchedule(name='visit_schedule',
                               offstudy_model='edc_reference.subjectoffstudy',
                               death_report_model='edc_reference.deathreport')

visit_schedule.add_schedule(schedule)
Example #5
0
 def test_forms_collection_empty(self):
     crfs = []
     try:
         FormsCollection(*crfs)
     except FormsCollectionError as e:
         self.fail(f"FormsCollectionError unexpectedly raised. Got {e}")
Example #6
0
 def test_forms_collection_none1(self):
     crfs = None
     try:
         FormsCollection(crfs)
     except FormsCollectionError as e:
         self.fail(f"FormsCollectionError unexpectedly raised. Got {e}")
from edc_visit_schedule.visit import Crf, FormsCollection

app_label = 'bcpp_clinic_subject'

crfs = FormsCollection(
    Crf(show_order=1, model=f'{app_label}.questionnaire'),
    Crf(show_order=2, model=f'{app_label}.viralloadtracking'),
    Crf(show_order=3, model=f'{app_label}.vlresult'))
from dateutil.relativedelta import relativedelta

from edc_visit_schedule.schedule import Schedule
from edc_visit_schedule.visit import Crf, FormsCollection, Visit
from edc_visit_schedule.visit_schedule import VisitSchedule

crfs = FormsCollection(Crf(show_order=1, model=f"visit_schedule_app.crfone", required=True))

visit0 = Visit(
    code="1000",
    title="Day 1",
    timepoint=0,
    rbase=relativedelta(days=0),
    rlower=relativedelta(days=0),
    rupper=relativedelta(days=6),
    crfs=crfs,
)

visit1 = Visit(
    code="2000",
    title="Day 2",
    timepoint=1,
    rbase=relativedelta(days=1),
    rlower=relativedelta(days=0),
    rupper=relativedelta(days=6),
    crfs=crfs,
)

visit2 = Visit(
    code="3000",
    title="Day 3",
Example #9
0
from dateutil.relativedelta import relativedelta
from edc_visit_schedule.schedule import Schedule
from edc_visit_schedule.visit import Crf, FormsCollection, Visit
from edc_visit_schedule.visit_schedule import VisitSchedule

crfs = FormsCollection(Crf(show_order=1, model=f"edc_crf.crf", required=True))

visit0 = Visit(
    code="1000",
    title="Day 1",
    timepoint=0,
    rbase=relativedelta(days=0),
    rlower=relativedelta(days=0),
    rupper=relativedelta(days=6),
    crfs=crfs,
)

visit1 = Visit(
    code="2000",
    title="Day 2",
    timepoint=1,
    rbase=relativedelta(days=1),
    rlower=relativedelta(days=0),
    rupper=relativedelta(days=6),
    crfs=crfs,
)

visit2 = Visit(
    code="3000",
    title="Day 3",
    timepoint=2,
Example #10
0
from dateutil.relativedelta import relativedelta
from edc_visit_schedule.schedule import Schedule
from edc_visit_schedule.site_visit_schedules import site_visit_schedules
from edc_visit_schedule.visit import Crf, FormsCollection, Visit
from edc_visit_schedule.visit_schedule import VisitSchedule

crfs = FormsCollection(
    Crf(show_order=1, model=f"reference_app.crfone", required=True))

visit0 = Visit(
    code="1000",
    title="Day 1",
    timepoint=0,
    rbase=relativedelta(days=0),
    rlower=relativedelta(days=0),
    rupper=relativedelta(days=6),
    crfs=crfs,
    facility_name="default",
)

visit1 = Visit(
    code="2000",
    title="Day 2",
    timepoint=1,
    rbase=relativedelta(days=7),
    rlower=relativedelta(days=6),
    rupper=relativedelta(days=6),
    crfs=crfs,
    facility_name="default",
)
from edc_visit_schedule.visit import Requisition, FormsCollection, Panel

RESEARCH_BLOOD_DRAW = 'Research Blood Draw'
VIRAL_LOAD = 'Viral Load'

rdb_panel = Panel(name=RESEARCH_BLOOD_DRAW)
viral_load_panel = Panel(name=VIRAL_LOAD)

app_label = 'bcpp_clinic_subject'

requisitions = FormsCollection(
    Requisition(
        show_order=10, model=f'{app_label}.subjectrequisition',
        panel=rdb_panel, required=True, additional=False),
    Requisition(
        show_order=20, model=f'{app_label}.subjectrequisition',
        panel=viral_load_panel, additional=False),
)
Example #12
0
crfs_bhs = FormsCollection(
    Crf(show_order=20, model=f'{app_label}.residencymobility', required=True),
    Crf(show_order=30, model=f'{app_label}.communityengagement',
        required=True),
    Crf(show_order=40, model=f'{app_label}.demographics', required=True),
    Crf(show_order=50, model=f'{app_label}.education', required=True),
    Crf(show_order=60, model=f'{app_label}.hivtestinghistory', required=True),
    Crf(show_order=70, model=f'{app_label}.hivtestreview', required=True),
    Crf(show_order=80,
        model=f'{app_label}.hivresultdocumentation',
        required=True),
    Crf(show_order=90, model=f'{app_label}.hivtested', required=True),
    Crf(show_order=100, model=f'{app_label}.hivuntested', required=True),
    Crf(show_order=110, model=f'{app_label}.hivcareadherence', required=True),
    Crf(show_order=120, model=f'{app_label}.sexualbehaviour', required=True),
    Crf(show_order=130, model=f'{app_label}.recentpartner', required=True),
    Crf(show_order=140, model=f'{app_label}.secondpartner', required=True),
    Crf(show_order=150, model=f'{app_label}.thirdpartner', required=True),
    Crf(show_order=170, model=f'{app_label}.hivmedicalcare', required=True),
    Crf(show_order=180, model=f'{app_label}.circumcision', required=True),
    Crf(show_order=190, model=f'{app_label}.circumcised', required=True),
    Crf(show_order=200, model=f'{app_label}.uncircumcised', required=True),
    Crf(show_order=210, model=f'{app_label}.reproductivehealth',
        required=True),
    Crf(show_order=220, model=f'{app_label}.pregnancy', required=True),
    Crf(show_order=230, model=f'{app_label}.nonpregnancy', required=True),
    Crf(show_order=240, model=f'{app_label}.medicaldiagnoses', required=True),
    Crf(show_order=250, model=f'{app_label}.heartattack', required=True),
    Crf(show_order=260, model=f'{app_label}.cancer', required=True),
    Crf(show_order=270, model=f'{app_label}.hivrelatedillness', required=True),
    Crf(show_order=280, model=f'{app_label}.tuberculosis', required=True),
    Crf(show_order=290, model=f'{app_label}.tbsymptoms', required=True),
    Crf(show_order=300, model=f'{app_label}.substanceuse', required=True),
    Crf(show_order=320, model=f'{app_label}.stigma', required=True),
    Crf(show_order=330, model=f'{app_label}.stigmaopinion', required=True),
    Crf(show_order=340,
        model=f'{app_label}.positiveparticipant',
        required=True),
    Crf(show_order=350, model=f'{app_label}.accesstocare', required=False),
    Crf(show_order=370, model=f'{app_label}.hivresult', required=True),
    Crf(show_order=380,
        model=f'{app_label}.elisahivresult',
        required=False,
        additional=True),
    Crf(show_order=390,
        model=f'{app_label}.pimacd4',
        required=False,
        additional=True),
    Crf(show_order=400,
        model=f'{app_label}.hicenrollment',
        required=False,
        additional=True),
    Crf(show_order=410, model=f'{app_label}.subjectreferral', required=True),
)