def tests_hiv_result8(self):
     """Other record confirms a verbal positive as evidence of HIV infection not on ART."""
     self.startup()
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Microtube',
             entry_status=REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Research Blood Draw',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Viral Load',
             entry_status=NOT_REQUIRED).count() == 1)
     site_rule_groups.autodiscover()
     HivTestingHistoryFactory(subject_visit=self.subject_visit_male,
                              verbal_hiv_result='NEG',
                              has_record='No',
                              other_record='No')
     self.assertTrue(
         ScheduledEntryMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             entry__model_name='hivresult',
             entry_status=REQUIRED).count() == 1)
     self.assertTrue(
         ScheduledEntryMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             entry__model_name='pima',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Microtube',
             entry_status=REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Research Blood Draw',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Viral Load',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Venous (HIV)',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='ELISA',
             entry_status=NOT_REQUIRED).count() == 1)
     site_rule_groups._registry = {}
Exemplo n.º 2
0
 def setUp(self):
     try:
         site_lab_profiles.register(BcppSubjectProfile())
     except AlreadyRegisteredLabProfile:
         pass
     BcppAppConfiguration().prepare()
     site_lab_tracker.autodiscover()
     BcppSubjectVisitSchedule().build()
     site_rule_groups.autodiscover()
Exemplo n.º 3
0
 def __init__(self):
     self._model = None
     self._fields = None
     self._model_admin = None
     self._model_fields = None
     self._visit_definition = None
     admin.autodiscover()
     site_visit_schedules.autodiscover()
     site_visit_schedules.build_all()
     site_rule_groups.autodiscover()
Exemplo n.º 4
0
    def setUp(self):
        site_mappers.autodiscover()
        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        self.app_config = BcppAppConfiguration()
        self.app_config.prepare()
        site_lab_tracker.autodiscover()
        BcppSubjectVisitSchedule().build()
        site_rule_groups.autodiscover()
        self.mapper = site_mappers.get_current_mapper()
#         self.app_config.prep_survey_for_tests()

        self.community = 'test_community'
        plot = PlotFactory(community=self.community, household_count=1, status='residential_habitable')

        survey = Survey.objects.all().order_by('datetime_start')[0]

        self.study_site = StudySite.objects.get(site_code='01')

        self.household_structure = HouseholdStructure.objects.get(household__plot=plot, survey=survey)
        RepresentativeEligibilityFactory(household_structure=self.household_structure)

        self.male_dob = date.today() - relativedelta(years=25)
        self.male_age_in_years = 25
        self.male_first_name = 'ERIK'
        self.male_initials = "EW"

        self.household_member_male_T0 = HouseholdMemberFactory(
            household_structure=self.household_structure, gender='M',
            age_in_years=self.male_age_in_years, first_name=self.male_first_name,
            initials=self.male_initials
        )

        EnrollmentChecklistFactory(
            household_member=self.household_member_male_T0,
            gender='M',
            citizen='Yes',
            dob=self.male_dob,
            guardian='No',
            initials=self.household_member_male_T0.initials,
            part_time_resident='Yes'
        )

        self.subject_consent_male = SubjectConsentFactory(household_member=self.household_member_male_T0, study_site=self.study_site, gender='M', dob=self.male_dob, first_name=self.male_first_name, initials=self.male_initials)

        self.registered_subject_male = RegisteredSubject.objects.get(subject_identifier=self.subject_consent_male.subject_identifier)

        self.appointment_male_T0 = Appointment.objects.get(registered_subject=self.registered_subject_male, visit_definition__code='T0')

        self.subject_visit_male_T0 = SubjectVisitFactory(appointment=self.appointment_male_T0, household_member=self.household_member_male_T0)
        SubjectLocatorFactory(registered_subject=self.subject_visit_male_T0.appointment.registered_subject, subject_visit=self.subject_visit_male_T0)
        self.household_member_T1 = None
        self.update_call_list_class = UpdateCallList()
    def setUp(self):

        site_mappers.autodiscover()

        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        bcpp_app_configuration.prepare()
        site_lab_tracker.autodiscover()
        BcppSubjectVisitSchedule().build()
        site_rule_groups.autodiscover()

        self.household_structure = None
        self.registered_subject = None
        self.representative_eligibility = None
        self.study_site = None
        self.intervention = None

        self.community = site_mappers.get_current_mapper().map_area
        self.study_site = StudySite.objects.get(
            site_code=site_mappers.get_current_mapper().map_code)
        self.site_code = self.study_site
        self.intervention = site_mappers.get_current_mapper().intervention
        self.survey1 = Survey.objects.get(
            survey_name='BCPP Year 1')  # see app_configuration
        self.survey2 = Survey.objects.get(
            survey_name='BCPP Year 2')  # see app_configuration
        plot = PlotFactory(community=self.community,
                           household_count=1,
                           status='residential_habitable')
        household = Household.objects.get(plot=plot)
        self.create_baseline(household)

        self.data = {
            'household_member': self.household_member_male.id,
            'report_datetime': datetime.today(),
            'first_name': 'SETS',
            'initials': 'SA',
            'dob': datetime.today() + relativedelta(years=-20),
            'guardian': NO,
            'gender': MALE,
            'has_identity': YES,
            'identity': '317918515',
            'identity_type': 'OMANG',
            'citizen': YES,
            'part_time_resident': YES,
            'literacy': YES,
            'guardian': YES,
            'inability_to_participate': 'N/A',
            'hiv_status': 'NEG',
            'legal_marriage': 'N/A',
            'marriage_certificate': 'N/A'
        }
    def startup(self):

        site_mappers.autodiscover()

        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        bcpp_app_configuration.prepare()
        site_lab_tracker.autodiscover()
        BcppSubjectVisitSchedule().build()
        site_rule_groups.autodiscover()
        #         site_visit_schedules.autodiscover()
        #         site_visit_schedules.build_all()

        self.household_structure = None
        self.registered_subject = None
        self.representative_eligibility = None
        self.study_site = None
        self.intervention = None
        #         try:
        #             site_lab_profiles.register(BcppSubjectProfile())
        #         except AlreadyRegisteredLabProfile:
        #             pass
        #         BcppAppConfiguration()
        #         site_lab_tracker.autodiscover()
        #         BcppSubjectVisitSchedule().build()

        self.community = site_mappers.get_current_mapper().map_area
        self.study_site = StudySite.objects.get(
            site_code=site_mappers.get_current_mapper().map_code)
        self.site_code = self.study_site
        self.intervention = site_mappers.get_current_mapper().intervention
        self.survey1 = Survey.objects.get(
            survey_name='BCPP Year 1')  # see app_configuration
        self.survey2 = Survey.objects.get(
            survey_name='BCPP Year 2')  # see app_configuration
        plot = PlotFactory(community=self.community,
                           household_count=1,
                           status='residential_habitable')
        household = Household.objects.get(plot=plot)
        self.create_baseline(household)
        self.create_annual(household)
Exemplo n.º 7
0
    def setUp(self):
        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        BcppAppConfiguration().prepare()
        site_lab_tracker.autodiscover()
        BcppSubjectVisitSchedule().build()
        site_rule_groups.autodiscover()
        self.study_site = StudySite.objects.get(site_code='01')
        self.survey = Survey.objects.all()[0]
        plot = PlotFactory(community=self.community,
                           household_count=1,
                           status='residential_habitable')
        survey = Survey.objects.all().order_by('datetime_start')[0]
        next_survey = Survey.objects.all().order_by('datetime_start')[1]

        self.household_structure = HouseholdStructure.objects.get(
            household__plot=plot, survey=survey)
        self.household_structure_y2 = HouseholdStructure.objects.get(
            household__plot=plot, survey=next_survey)
        RepresentativeEligibilityFactory(
            household_structure=self.household_structure)
        RepresentativeEligibilityFactory(
            household_structure=self.household_structure_y2)

        self.female_dob = date(1989, 10, 10)
        self.female_age_in_years = relativedelta(date.today(),
                                                 self.female_dob).years
        self.female_first_name = 'ERIKA'
        self.female_last_name = 'WAXON'
        self.female_initials = "EW"

        self.household_member_female_T0 = HouseholdMemberFactory(
            household_structure=self.household_structure,
            gender='F',
            age_in_years=self.female_age_in_years,
            first_name=self.female_first_name,
            initials=self.female_initials)
        self.household_member_female_T0.member_status = 'BHS_SCREEN'
        self.household_member_female_T0.save()
        self.assertEqual(self.household_member_female_T0.member_status,
                         'BHS_SCREEN')
        self.enrollment_checklist_female = EnrollmentChecklistFactory(
            household_member=self.household_member_female_T0,
            gender='F',
            citizen='Yes',
            dob=self.female_dob,
            guardian='No',
            initials=self.household_member_female_T0.initials,
            part_time_resident='Yes')
        self.subject_consent_female = SubjectConsentFactory(
            household_member=self.household_member_female_T0,
            study_site=self.study_site,
            gender='F',
            dob=self.female_dob,
            first_name=self.female_first_name,
            last_name=self.female_last_name,
            initials=self.female_initials)
        self.registered_subject_female = RegisteredSubject.objects.get(
            subject_identifier=self.subject_consent_female.subject_identifier)

        enumeration_helper = EnumerationHelper(
            self.household_structure.household, survey, next_survey)
        self.household_member_female = enumeration_helper.create_member_on_target(
            self.household_member_female_T0)
        self.appointment_female = Appointment.objects.get(
            registered_subject=self.registered_subject_female,
            visit_definition__code='T1')
        self.appointment_female_T0 = Appointment.objects.get(
            registered_subject=self.registered_subject_female,
            visit_definition__code='T0')
        self.subject_visit_female_T0 = SubjectVisitFactory(
            appointment=self.appointment_female_T0,
            household_member=self.household_member_female_T0)
        self.subject_visit_female = SubjectVisitFactory(
            appointment=self.appointment_female,
            household_member=self.household_member_female)
        self.locator_female_T0 = SubjectLocatorFactory(
            subject_visit=self.subject_visit_female_T0,
            registered_subject=self.registered_subject_female)
        self.residency_mobility_female_T0 = ResidencyMobilityFactory(
            subject_visit=self.subject_visit_female_T0)
        microtube_panel = Panel.objects.get(name='Microtube')
        aliquot_type = AliquotType.objects.all()[0]
        self.subject_requisition_T0 = SubjectRequisitionFactory(
            subject_visit=self.subject_visit_female_T0,
            panel=microtube_panel,
            aliquot_type=aliquot_type)
        self.hiv_result_today_T0 = HivResultFactory(
            subject_visit=self.subject_visit_female_T0, hiv_result=NEG)
Exemplo n.º 8
0
from edc.lab.lab_profile.classes import site_lab_profiles
from edc.dashboard.subject.views import additional_requisition
from edc.map.classes import site_mappers
from edc.subject.lab_tracker.classes import site_lab_tracker
from edc.subject.rule_groups.classes import site_rule_groups
from edc.subject.visit_schedule.classes import site_visit_schedules

from bhp066.apps.bcpp.app_configuration.classes import bcpp_app_configuration

site_lab_profiles.autodiscover()
dajaxice_autodiscover()
site_mappers.autodiscover()
bcpp_app_configuration.prepare()
site_visit_schedules.autodiscover()
site_visit_schedules.build_all()
site_rule_groups.autodiscover()
site_lab_tracker.autodiscover()
data_manager.prepare()
site_sections.autodiscover()
site_sections.update_section_lists()
admin.autodiscover()

site_mappers.get_current_mapper().verify_survey_dates()

for model in get_models():
    try:
        django_databrowse.site.register(model)
    except:
        pass

APP_NAME = settings.APP_NAME
    def setUp(self):
        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        BcppAppConfiguration().prepare()
        site_lab_tracker.autodiscover()
        BcppSubjectVisitSchedule().build()
        site_rule_groups.autodiscover()

        plot = PlotFactory(community=self.community,
                           household_count=1,
                           status='residential_habitable')

        survey_T0 = Survey.objects.get(survey_slug='bcpp-year-1')
        survey_T1 = Survey.objects.get(survey_slug='bcpp-year-2')
        survey_T2 = Survey.objects.get(survey_slug='bcpp-year-3')

        self.study_site = StudySite.objects.get(site_code='01')

        self.household_structure = HouseholdStructure.objects.get(
            household__plot=plot, survey=survey_T0)
        self.household_structure_y2 = HouseholdStructure.objects.get(
            household__plot=plot, survey=survey_T1)
        self.household_structure_y3 = HouseholdStructure.objects.get(
            household__plot=plot, survey=survey_T2)
        RepresentativeEligibilityFactory(
            household_structure=self.household_structure)
        RepresentativeEligibilityFactory(
            household_structure=self.household_structure_y2)
        RepresentativeEligibilityFactory(
            household_structure=self.household_structure_y3)
        HouseholdMemberFactory(household_structure=self.household_structure)
        #HouseholdMemberFactory(household_structure=self.household_structure)
        #HouseholdMemberFactory(household_structure=self.household_structure)

        male_dob = date.today() - relativedelta(years=25)
        male_age_in_years = 25
        male_first_name = 'ERIK'
        male_initials = "EW"
        female_dob = date.today() - relativedelta(years=35)
        female_age_in_years = 35
        female_first_name = 'ERIKA'
        female_initials = "EW"
        registered_subject = RegisteredSubjectFactory(
            registration_identifier='123456467')
        self.household_member_female_T0 = HouseholdMemberFactory(
            household_structure=self.household_structure,
            gender='F',
            age_in_years=female_age_in_years,
            first_name=female_first_name,
            initials=female_initials,
            registered_subject=registered_subject)
        registered_subject = RegisteredSubjectFactory(
            registration_identifier='123456468')
        self.household_member_male_T0 = HouseholdMemberFactory(
            household_structure=self.household_structure,
            gender='M',
            age_in_years=male_age_in_years,
            first_name=male_first_name,
            initials=male_initials,
            registered_subject=registered_subject)
        self.household_member_female_T0.member_status = 'BHS_SCREEN'
        self.household_member_male_T0.member_status = 'BHS_SCREEN'
        self.household_member_female_T0.save()
        self.household_member_male_T0.save()
        EnrollmentChecklistFactory(
            household_member=self.household_member_female_T0,
            gender='F',
            citizen=YES,
            dob=female_dob,
            guardian=NO,
            initials=self.household_member_female_T0.initials,
            part_time_resident=YES)
        EnrollmentChecklistFactory(
            household_member=self.household_member_male_T0,
            gender='M',
            citizen=YES,
            dob=male_dob,
            guardian=NO,
            initials=self.household_member_male_T0.initials,
            part_time_resident=YES)
        subject_consent_female = SubjectConsentFactory(
            household_member=self.household_member_female_T0,
            confirm_identity='101129811',
            identity='101129811',
            study_site=self.study_site,
            gender='F',
            dob=female_dob,
            first_name=female_first_name,
            initials=female_initials)
        subject_consent_male = SubjectConsentFactory(
            household_member=self.household_member_male_T0,
            confirm_identity='101119811',
            identity='101119811',
            study_site=self.study_site,
            gender='M',
            dob=male_dob,
            first_name=male_first_name,
            initials=male_initials)
        self.assertEqual(
            HouseholdStructure.objects.filter(
                household=self.household_structure.household,
                survey=survey_T0,
                enumerated=True,
                enrolled=True).count(), 1)

        enumeration_helper_T2 = EnumerationHelper(
            self.household_structure.household, survey_T0, survey_T1)
        enumeration_helper_T2.add_members_from_survey()
        self.household_member_female = HouseholdMember.objects.get(
            internal_identifier=self.household_member_female_T0.
            internal_identifier,
            household_structure__survey=survey_T1)
        self.household_member_male = HouseholdMember.objects.get(
            internal_identifier=self.household_member_male_T0.
            internal_identifier,
            household_structure__survey=survey_T1)
        self.assertEqual(
            HouseholdStructure.objects.filter(
                household=self.household_structure_y2.household,
                survey=survey_T1,
                enumerated=True,
                enrolled=True).count(), 1)

        enumeration_helper_T3 = EnumerationHelper(
            self.household_structure.household, survey_T1, survey_T2)
        enumeration_helper_T3.add_members_from_survey()
        self.household_member_female_T2 = HouseholdMember.objects.get(
            internal_identifier=self.household_member_female.
            internal_identifier,
            household_structure__survey=survey_T2)
        self.household_member_male_T2 = HouseholdMember.objects.get(
            internal_identifier=self.household_member_male.internal_identifier,
            household_structure__survey=survey_T2)
        self.assertEqual(
            HouseholdStructure.objects.filter(
                household=self.household_structure_y3.household,
                survey=survey_T2,
                enumerated=True,
                enrolled=True).count(), 1)

        self.registered_subject_female = RegisteredSubject.objects.get(
            subject_identifier=subject_consent_female.subject_identifier)
        self.registered_subject_male = RegisteredSubject.objects.get(
            subject_identifier=subject_consent_male.subject_identifier)
        self.appointment_female = Appointment.objects.get(
            registered_subject=self.registered_subject_female,
            visit_definition__code='T1')
        self.appointment_female_T0 = Appointment.objects.get(
            registered_subject=self.registered_subject_female,
            visit_definition__code='T0')
        self.appointment_female_T2 = Appointment.objects.get(
            registered_subject=self.registered_subject_female,
            visit_definition__code='T2')
        self.subject_visit_female_T0 = SubjectVisitFactory(
            appointment=self.appointment_female_T0,
            household_member=self.household_member_female_T0)
        self.subject_visit_female = SubjectVisitFactory(
            appointment=self.appointment_female,
            household_member=self.household_member_female)
        self.subject_visit_female_T2 = SubjectVisitFactory(
            appointment=self.appointment_female_T2,
            household_member=self.household_member_female_T2)
        self.appointment_male = Appointment.objects.get(
            registered_subject=self.registered_subject_male,
            visit_definition__code='T1')
        self.appointment_male_T0 = Appointment.objects.get(
            registered_subject=self.registered_subject_male,
            visit_definition__code='T0')
        self.appointment_male_T2 = Appointment.objects.get(
            registered_subject=self.registered_subject_male,
            visit_definition__code='T2')
        self.subject_visit_male_T0 = SubjectVisitFactory(
            appointment=self.appointment_male_T0,
            household_member=self.household_member_male_T0)
        self.subject_visit_male = SubjectVisitFactory(
            appointment=self.appointment_male,
            household_member=self.household_member_male)
        self.subject_visit_male_T2 = SubjectVisitFactory(
            appointment=self.appointment_male_T2,
            household_member=self.household_member_male_T2)
Exemplo n.º 10
0
    def setUp(self):
        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        BcppAppConfiguration().prepare()
        site_lab_tracker.autodiscover()
        BcppSubjectVisitSchedule().build()
        site_rule_groups.autodiscover()

        plot = PlotFactory(community=self.community,
                           household_count=1,
                           status='residential_habitable')

        survey = Survey.objects.all().order_by('datetime_start')[0]

        self.study_site = StudySite.objects.get(site_code='14')

        self.household_structure = HouseholdStructure.objects.get(
            household__plot=plot, survey=survey)
        RepresentativeEligibilityFactory(
            household_structure=self.household_structure)
        HouseholdMemberFactory(household_structure=self.household_structure)

        self.male_dob = date.today() - relativedelta(years=25)
        self.male_age_in_years = 25
        self.male_first_name = 'ERIK'
        self.male_initials = "EW"
        female_dob = date.today() - relativedelta(years=35)
        female_age_in_years = 35
        female_first_name = 'ERIKA'
        female_initials = "EW"

        self.household_member_female_T0 = HouseholdMemberFactory(
            household_structure=self.household_structure,
            gender='F',
            age_in_years=female_age_in_years,
            first_name=female_first_name,
            initials=female_initials)
        self.household_member_male_T0 = HouseholdMemberFactory(
            household_structure=self.household_structure,
            gender='M',
            age_in_years=self.male_age_in_years,
            first_name=self.male_first_name,
            initials=self.male_initials)

        EnrollmentChecklistFactory(
            household_member=self.household_member_male_T0,
            gender='M',
            citizen='Yes',
            dob=self.male_dob,
            guardian='No',
            initials=self.household_member_male_T0.initials,
            part_time_resident='Yes')

        EnrollmentChecklistFactory(
            household_member=self.household_member_female_T0,
            gender='F',
            citizen='Yes',
            dob=female_dob,
            guardian='No',
            initials=self.household_member_female_T0.initials,
            part_time_resident='Yes')

        subject_consent_female = SubjectConsentFactory(
            household_member=self.household_member_female_T0,
            study_site=self.study_site,
            gender='F',
            dob=female_dob,
            first_name=female_first_name,
            initials=female_initials)
        self.subject_consent_male = SubjectConsentFactory(
            household_member=self.household_member_male_T0,
            study_site=self.study_site,
            gender='M',
            dob=self.male_dob,
            first_name=self.male_first_name,
            initials=self.male_initials)

        self.registered_subject_male = RegisteredSubject.objects.get(
            subject_identifier=self.subject_consent_male.subject_identifier)
        self.registered_subject_female = RegisteredSubject.objects.get(
            subject_identifier=subject_consent_female.subject_identifier)

        self.appointment_male_T0 = Appointment.objects.get(
            registered_subject=self.registered_subject_male,
            visit_definition__code='T0')
        self.appointment_female_T0 = Appointment.objects.get(
            registered_subject=self.registered_subject_female,
            visit_definition__code='T0')

        self.subject_visit_male_T0 = SubjectVisitFactory(
            appointment=self.appointment_male_T0,
            household_member=self.household_member_male_T0)
        self.subject_visit_female_T0 = SubjectVisitFactory(
            appointment=self.appointment_female_T0,
            household_member=self.household_member_female_T0)

        Quota.objects.create(app_label='bcpp_subject',
                             model_name='PimaVl',
                             target=1,
                             expires_datetime=timezone.now() +
                             timedelta(days=1))
        self.assertEqual(1, Quota.objects.all().count())
    def setUp(self):
        site_mappers.autodiscover()
        from bhp066.apps.bcpp_subject.visit_schedule import BcppSubjectVisitSchedule
        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        self.app_config = BcppAppConfiguration()
        self.app_config.prepare()
        self.app_config.prep_survey_for_tests()
        site_lab_tracker.autodiscover()
        BcppSubjectVisitSchedule().build()
        site_rule_groups.autodiscover()

        plot = PlotFactory(community=self.community,
                           household_count=1,
                           status='residential_habitable')

        self.survey_bhs = Survey.objects.get(survey_slug='bcpp-year-1')

        self.survey_ahs = Survey.objects.get(survey_slug='bcpp-year-2')

        self.study_site = StudySite.objects.get(site_code='01')

        self.household_structure_bhs = HouseholdStructure.objects.get(
            household__plot=plot, survey=self.survey_bhs)
        self.household_structure_ahs = HouseholdStructure.objects.get(
            household__plot=plot, survey=self.survey_ahs)
        self.create_household_log_entry(self.household_structure_bhs)

        RepresentativeEligibilityFactory(
            household_structure=self.household_structure_bhs)

        self.male_dob = date.today() - relativedelta(years=25)
        self.male_age_in_years = 25
        self.male_first_name = 'ERIK'
        self.male_last_name = 'HIEWAI'
        self.male_initials = "EW"

        self.household_member_male_T0 = HouseholdMemberFactory(
            household_structure=self.household_structure_bhs,
            gender='M',
            age_in_years=self.male_age_in_years,
            first_name=self.male_first_name,
            initials=self.male_initials)
        HeadHouseholdEligibilityFactory(
            household_member=self.household_member_male_T0,
            household_structure=self.household_structure_bhs)
        self.household_member_male_T0.eligible_hoh = True
        self.household_member_male_T0.save()

        HouseholdInfoFactory(household_member=self.household_member_male_T0,
                             household_structure=self.household_structure_bhs,
                             registered_subject=self.household_member_male_T0.
                             registered_subject)

        self.enrollment = EnrollmentChecklistFactory(
            household_member=self.household_member_male_T0,
            gender='M',
            citizen='Yes',
            dob=self.male_dob,
            guardian='No',
            initials=self.household_member_male_T0.initials,
            part_time_resident='Yes')
        self.subject_consent_male = SubjectConsentFactory(
            household_member=self.household_member_male_T0,
            confirm_identity='101119811',
            identity='101119811',
            study_site=self.study_site,
            gender='M',
            dob=self.male_dob,
            first_name=self.male_first_name,
            initials=self.male_initials)
        self.data = {
            'last_name':
            'WIZZY',
            'is_minor':
            'No',
            'witness_name':
            None,
            'is_literate':
            'Yes',
            'subject_type':
            'subject',
            'consent_copy':
            'Yes',
            'is_verified':
            False,
            'consent_signature':
            None,
            'first_name':
            'ERIK',
            'dm_comment':
            None,
            'is_dob_estimated':
            None,
            'verified_by':
            None,
            'user_modified':
            u'',
            'is_signed':
            True,
            'is_verified_datetime':
            None,
            'subject_identifier_aka':
            None,
            'version':
            u'4',
            'citizen':
            'Yes',
            'legal_marriage':
            u'N/A',
            'assessment_score':
            'Yes',
            'is_incarcerated':
            'No',
            'consent_reviewed':
            'Yes',
            'study_questions':
            'Yes',
            'sid':
            None,
            'study_site_id':
            self.study_site.id,
            'may_store_samples':
            YES,
            'consent_version_recent':
            None,
            'subject_identifier':
            self.household_member_male_T0.registered_subject.
            subject_identifier,
            'subject_identifier_as_pk':
            self.household_member_male_T0.registered_subject.id,
            'community':
            u'test_community',
            'using':
            'default',
            'marriage_certificate_no':
            None,
            'identity':
            '317918515',
            'confirm_identity':
            '317918515',
            'registered_subject_id':
            self.household_member_male_T0.registered_subject.id,
            'identity_type':
            'OMANG',
            'language':
            u'not specified',
            'guardian_name':
            None,
            'gender':
            'M',
            'household_member':
            self.household_member_male_T0.id,
            'marriage_certificate':
            u'N/A',
            'dob':
            self.male_dob,
            'study_site':
            self.study_site.id,
            'initials':
            'EW',
            'language':
            'en',
            'is_dob_estimated':
            '-',
            'consent_signature':
            YES,
            'consent_datetime':
            datetime.today(),
            'version':
            1
        }
    def setUp(self):
        site_mappers.autodiscover()
        from bhp066.apps.bcpp_subject.visit_schedule import BcppSubjectVisitSchedule
        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        self.app_config = BcppAppConfiguration()
        self.app_config.prepare()
        self.app_config.prep_survey_for_tests()
        site_lab_tracker.autodiscover()
        BcppSubjectVisitSchedule().build()
        site_rule_groups.autodiscover()

        plot = PlotFactory(community=self.community,
                           household_count=1,
                           status='residential_habitable')

        self.survey_bhs = Survey.objects.get(survey_slug='bcpp-year-1')

        self.survey_ahs = Survey.objects.get(survey_slug='bcpp-year-2')

        self.study_site = StudySite.objects.get(site_code='01')

        self.household_structure_bhs = HouseholdStructure.objects.get(
            household__plot=plot, survey=self.survey_bhs)
        self.household_structure_ahs = HouseholdStructure.objects.get(
            household__plot=plot, survey=self.survey_ahs)
        self.create_household_log_entry(self.household_structure_bhs)

        RepresentativeEligibilityFactory(
            household_structure=self.household_structure_bhs)

        self.male_dob = date.today() - relativedelta(years=25)
        self.male_age_in_years = 25
        self.male_first_name = 'ERIK'
        self.male_last_name = 'HIEWAI'
        self.male_initials = "EW"

        self.household_member_male_T0 = HouseholdMemberFactory(
            household_structure=self.household_structure_bhs,
            gender='M',
            age_in_years=self.male_age_in_years,
            first_name=self.male_first_name,
            initials=self.male_initials)
        HeadHouseholdEligibilityFactory(
            household_member=self.household_member_male_T0,
            household_structure=self.household_structure_bhs)
        self.household_member_male_T0.eligible_hoh = True
        self.household_member_male_T0.save()

        HouseholdInfoFactory(household_member=self.household_member_male_T0,
                             household_structure=self.household_structure_bhs,
                             registered_subject=self.household_member_male_T0.
                             registered_subject)

        self.enrollment = EnrollmentChecklistFactory(
            household_member=self.household_member_male_T0,
            gender='M',
            citizen='Yes',
            dob=self.male_dob,
            guardian='No',
            initials=self.household_member_male_T0.initials,
            part_time_resident='Yes')
        self.subject_consent_male = SubjectConsentFactory(
            household_member=self.household_member_male_T0,
            confirm_identity='101119811',
            identity='101119811',
            study_site=self.study_site,
            gender='M',
            dob=self.male_dob,
            first_name=self.male_first_name,
            initials=self.male_initials)
        self.appointment = Appointment.objects.get(
            registered_subject=self.household_member_male_T0.
            registered_subject,
            visit_definition__code='T0')

        self.subject_visit = SubjectVisitFactory(
            household_member=self.household_member_male_T0,
            appointment=self.appointment)

        self.registered_subject = RegisteredSubject.objects.get(
            subject_identifier=self.subject_consent_male.subject_identifier)

        self.sexual_data = {
            'subject_visit': self.subject_visit.id,
            'alcohol_sex': 'Myself',
            'report_datetime': datetime.today(),
            'condom': NO,
            'more_sex': NO,
            'ever_sex': YES,
            'first_sex': 20,
            'last_year_partners': None,
            'lifetime_sex_partners': 1,
            'more_sex': None,
            'subject_visit_id': None,
            'user_modified': u'',
        }
        self.data = {
            'subject_visit': self.subject_visit.id,
            'concurrent': NO,
            'first_partner_live': None,
            'first_condom_freq': u'Sometimes',
            'first_disclose': u'Yes',
            'first_exchange': u'30-39',
            'first_first_sex': u'Years',
            'first_first_sex_calc': 3L,
            'first_haart': None,
            'first_partner_arm': None,
            'first_partner_cp': u'No',
            'first_partner_hiv': u'not_sure',
            'first_relationship': u'Long-term partner',
            'first_sex_current': u'Yes',
            'first_sex_freq': None,
            'goods_exchange': u'No',
            'partner_hiv_test': u'not_sure',
            'past_year_sex_freq': u'About once a month',
            'report_datetime': datetime.today(),
            'sex_partner_community': u'N/A',
            'subject_visit_id': None,
            'third_last_sex': u'Days',
            'third_last_sex_calc': 7L,
            'user_modified': u''
        }
Exemplo n.º 13
0
from edc.data_manager.classes import data_manager
from edc.dashboard.section.classes import site_sections
from edc.lab.lab_profile.classes import site_lab_profiles
from edc.dashboard.subject.views import additional_requisition
from edc.subject.lab_tracker.classes import site_lab_tracker
from edc.subject.rule_groups.classes import site_rule_groups
from edc.subject.visit_schedule.classes import site_visit_schedules

from apps.hnscc.app_configuration.classes import HnsccAppConfiguration

site_lab_profiles.autodiscover()
dajaxice_autodiscover()
HnsccAppConfiguration().prepare()
site_visit_schedules.autodiscover()
site_visit_schedules.build_all()
site_rule_groups.autodiscover()
site_lab_tracker.autodiscover()
data_manager.prepare()
site_sections.autodiscover()
site_sections.update_section_lists()
admin.autodiscover()

for model in get_models():
    try:
        django_databrowse.site.register(model)
    except:
        pass

APP_NAME = settings.APP_NAME

urlpatterns = patterns(
 def tests_hiv_result10(self):
     """Other record confirms a verbal positive as evidence of HIV infection not on ART."""
     self.startup()
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Microtube',
             entry_status=REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Research Blood Draw',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Viral Load',
             entry_status=NOT_REQUIRED).count() == 1)
     site_rule_groups.autodiscover()
     HivTestingHistoryFactory(subject_visit=self.subject_visit_male,
                              verbal_hiv_result='NEG',
                              has_record='No',
                              other_record='No')
     panel = Panel.objects.get(name='Microtube')
     SubjectRequisitionFactory(
         subject_visit=self.subject_visit_male,
         site=self.site_code,
         panel=panel,
         aliquot_type=AliquotType.objects.get(alpha_code='WB'))
     HivResultFactory(
         subject_visit=self.subject_visit_male,
         hiv_result='POS',
         hiv_result_datetime=datetime.today(),
     )
     self.assertTrue(
         ScheduledEntryMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             entry__model_name='hicenrollment',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         ScheduledEntryMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             entry__model_name='hivresult',
             entry_status=KEYED).count() == 1)
     self.assertTrue(
         ScheduledEntryMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             entry__model_name='pima',
             entry_status=REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Microtube',
             entry_status=KEYED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Research Blood Draw',
             entry_status=REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Viral Load',
             entry_status=REQUIRED).count() == 1)
     site_rule_groups._registry = {}
 def tests_hiv_result7(self):
     """Other record confirms a verbal positive as evidence of HIV infection not on ART."""
     self.startup()
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Microtube',
             entry_status=REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Research Blood Draw',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Viral Load',
             entry_status=NOT_REQUIRED).count() == 1)
     site_rule_groups.autodiscover()
     today_date = date.today()
     last_year_date = today_date - timedelta(days=365)
     HivTestingHistoryFactory(subject_visit=self.subject_visit_male,
                              verbal_hiv_result='POS',
                              has_record='No',
                              other_record='Yes')
     subject_referral_helper = SubjectStatusHelper(self.subject_visit_male)
     self.assertEqual('POS', subject_referral_helper.hiv_result)
     self.assertEqual(False, subject_referral_helper.new_pos)
     self.assertTrue(subject_referral_helper.on_art is None)
     HivCareAdherenceFactory(subject_visit=self.subject_visit_male,
                             on_arv='Yes',
                             arv_evidence='No',
                             ever_taken_arv='Yes')
     subject_referral_helper = SubjectStatusHelper(self.subject_visit_male)
     self.assertEqual('POS', subject_referral_helper.hiv_result)
     self.assertFalse(subject_referral_helper.new_pos)
     self.assertTrue(subject_referral_helper.on_art)
     hiv_result_documentation = HivResultDocumentationFactory(
         subject_visit=self.subject_visit_male,
         result_recorded='POS',
         result_date=last_year_date,
         result_doc_type='ART Prescription')
     subject_referral_helper = SubjectStatusHelper(self.subject_visit_male)
     self.assertEqual('POS', subject_referral_helper.hiv_result)
     self.assertFalse(subject_referral_helper.new_pos)
     self.assertTrue(subject_referral_helper.on_art)
     self.assertEqual(hiv_result_documentation.result_date,
                      subject_referral_helper.hiv_result_datetime.date())
     self.assertTrue(
         ScheduledEntryMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             entry__model_name='hivresult',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         ScheduledEntryMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             entry__model_name='pima',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Microtube',
             entry_status=NOT_REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Research Blood Draw',
             entry_status=REQUIRED).count() == 1)
     self.assertTrue(
         RequisitionMetaData.objects.filter(
             appointment=self.subject_visit_male.appointment,
             lab_entry__requisition_panel__name='Viral Load',
             entry_status=REQUIRED).count() == 1)
     site_rule_groups._registry = {}