Esempio n. 1
0
 def setUp(self):
     try:
         site_lab_profiles.register(MpepuMaternalProfile())
     except AlreadyRegistered:
         pass
     MpepuAppConfiguration().prepare()
     site_lab_tracker.autodiscover()
     site_visit_schedules.autodiscover()
     site_visit_schedules.build_all()
     study_site = StudySiteFactory()
     MaternalConsent.objects.all().delete()
     self.maternal_consent1 = MaternalConsentFactory(study_site=study_site)
     print "Maternal Consent: {}".format(self.maternal_consent1)
     self.registered_subject1 = RegisteredSubject.objects.get(
         subject_identifier=self.maternal_consent1.subject_identifier)
     self.post_elibility1 = MaternalEligibilityPostFactory(
         maternal_consent=self.maternal_consent1,
         registered_subject=self.registered_subject1)
     self.maternal_consent2 = MaternalConsentFactory(study_site=study_site)
     print "Maternal Consent: {}".format(self.maternal_consent2)
     self.registered_subject2 = RegisteredSubject.objects.get(
         subject_identifier=self.maternal_consent2.subject_identifier)
     self.post_elibility2 = MaternalEligibilityPostFactory(
         maternal_consent=self.maternal_consent2,
         registered_subject=self.registered_subject2)
     self.maternal_consent3 = MaternalConsentFactory(study_site=study_site)
     print "Maternal Consent: {}".format(self.maternal_consent3)
     self.registered_subject3 = RegisteredSubject.objects.get(
         subject_identifier=self.maternal_consent3.subject_identifier)
     self.post_elibility3 = MaternalEligibilityPostFactory(
         maternal_consent=self.maternal_consent3,
         registered_subject=self.registered_subject3)
 def setUp(self):
     try:
         site_lab_profiles.register(MpepuMaternalProfile())
     except AlreadyRegistered:
         pass
     MpepuAppConfiguration().prepare()
     site_lab_tracker.autodiscover()
     site_visit_schedules.autodiscover()
     site_visit_schedules.build_all()
Esempio 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()
 def setUp(self):
     try:
         site_lab_profiles.register(HnsccSubjectProfile())
     except AlreadyRegistered:
         pass
     HnsccAppConfiguration().prepare()
     site_lab_tracker.autodiscover()
     site_visit_schedules.autodiscover()
     site_visit_schedules.build_all()
     print "assert appointment is created for enrolled subject"
     self.enrolled_subject = EnrolledSubjectFactory()
     self.appointment = Appointment.objects.get(registered_subject=self.enrolled_subject.registered_subject)
Esempio n. 5
0
 def setUp(self):
     try:
         site_lab_profiles.register(MpepuInfantProfile())
     except AlreadyRegistered:
         pass
     MpepuAppConfiguration().prepare()
     site_lab_tracker.autodiscover()
     site_visit_schedules.autodiscover()
     site_visit_schedules.build_all()
     study_site = StudySiteFactory()
     content_type_map = ContentTypeMap.objects.get(
         model='maternalconsent', app_label='mpepu_maternal')
     consent_catalogue = ConsentCatalogueFactory(
         content_type_map=content_type_map)
     consent_catalogue.add_for_app = 'mpepu_infant'
     consent_catalogue.save()
     delivery_days_ago = 20
     self.delivery_datetime = datetime.today() - timedelta(
         days=delivery_days_ago - 3)
     print "Consent a mother"
     self.maternal_consent = MaternalConsentFactory(
         study_site=study_site,
         consent_datetime=datetime.today() -
         timedelta(days=delivery_days_ago))
     print "Consent: {}".format(self.maternal_consent)
     m_registered_subject = RegisteredSubject.objects.get(
         subject_identifier=self.maternal_consent.subject_identifier)
     print 'check if mother is eligible'
     self.maternal_eligibility = MaternalEligibilityPostFactory(
         maternal_consent=self.maternal_consent,
         registered_subject=m_registered_subject,
         registration_datetime=datetime.today() -
         timedelta(days=delivery_days_ago))
     print 'get the 2000M visit'
     self.m_appointment = Appointment.objects.get(
         registered_subject=m_registered_subject,
         visit_definition__code='2000M')
     print 'create a maternal visit for the 2000M visit'
     self.maternal_visit = MaternalVisitFactory(
         appointment=self.m_appointment,
         report_datetime=datetime.today() -
         timedelta(days=delivery_days_ago))
     print 'create a maternal_lab_del registering 2 of 2 infants'
     self.maternal_lab_del = MaternalLabDelFactory(
         maternal_visit=self.maternal_visit,
         live_infants=1,
         live_infants_to_register=1,
         delivery_datetime=self.delivery_datetime,
         has_ga='Yes',
         ga=37,
     )
     print 'maternal lab del: {}'.format(self.maternal_lab_del)
Esempio n. 6
0
 def setUp(self):
     try:
         site_lab_profiles.register(MpepuInfantProfile())
     except AlreadyRegistered:
         pass
     MpepuAppConfiguration().prepare()
     site_lab_tracker.autodiscover()
     site_visit_schedules.autodiscover()
     site_visit_schedules.build_all()
     self.study_site = StudySiteFactory()
     content_type_map = ContentTypeMap.objects.get(model='maternalconsent', app_label='mpepu_maternal')
     consent_catalogue = ConsentCatalogueFactory(content_type_map=content_type_map)
     consent_catalogue.add_for_app = 'mpepu_infant'
     consent_catalogue.save()
Esempio n. 7
0
    def setUp(self):
        self.household_member = None
        self.subject_consent = None
        self.registered_subject = None
        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        bcpp_app_configuration.prepare()
        site_lab_tracker.autodiscover()
        site_visit_schedules.autodiscover()
        site_visit_schedules.build_all()

        self.survey = Survey.objects.current_survey()
        self.plot = PlotFactory(community='oodi', household_count=1, status='bcpp_clinic')
        self.household = HouseholdFactory(plot=self.plot)
        self.household_structure = HouseholdStructure.objects.get(household=self.household, survey=self.survey)
        self.study_site = StudySite.objects.get(site_code=site_mappers.get_current_mapper().map_code)
        self.intervention = site_mappers.get_current_mapper().intervention
        site_mappers.get_current_mapper().verify_survey_dates()
Esempio n. 8
0
 def setUp(self):
     try:
         site_lab_profiles.register(MpepuMaternalProfile())
     except AlreadyRegistered:
         pass
     MpepuAppConfiguration().prepare()
     site_lab_tracker.autodiscover()
     site_visit_schedules.autodiscover()
     site_visit_schedules.build_all()
     study_site = StudySiteFactory()
     print "Consenting a mother"
     MaternalConsent.objects.all().delete()
     self.maternal_consent = MaternalConsentFactory(study_site=study_site)
     print "Maternal Consent: {}".format(self.maternal_consent)
     print 'get maternal registered subject'
     self.registered_subject = RegisteredSubject.objects.get(
         subject_identifier=self.maternal_consent.subject_identifier)
     print "check if mother is eligible"
     self.post_elibility = MaternalEligibilityPostFactory(
         maternal_consent=self.maternal_consent,
         registered_subject=self.maternal_consent.registered_subject)
Esempio n. 9
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.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
    def setUp(self):
        try:
            site_lab_profiles.register(MpepuInfantProfile())
        except AlreadyRegistered:
            pass
        MpepuAppConfiguration().prepare()
        site_lab_tracker.autodiscover()
        site_visit_schedules.autodiscover()
        site_visit_schedules.build_all()
        admin.autodiscover()
        study_site = StudySiteFactory()
        content_type_map = ContentTypeMap.objects.get(
            model='maternalconsent', app_label='mpepu_maternal')
        consent_catalogue = ConsentCatalogueFactory(
            content_type_map=content_type_map)
        consent_catalogue.add_for_app = 'mpepu_infant'
        consent_catalogue.save()

        self.delivery_days_ago = 20
        self.delivery_datetime = datetime.today() - timedelta(
            days=self.delivery_days_ago - 3)
        print "Consent a mother"
        self.maternal_consent = MaternalConsentFactory(
            study_site=study_site,
            consent_datetime=datetime.today() -
            timedelta(days=self.delivery_days_ago))
        print "Consent: {}".format(self.maternal_consent)
        registered_subject = RegisteredSubject.objects.get(
            subject_identifier=self.maternal_consent.subject_identifier)
        print 'check if mother is eligible'
        maternal_eligibility = MaternalEligibilityPostFactory(
            maternal_consent=self.maternal_consent,
            registered_subject=registered_subject,
            registration_datetime=datetime.today() -
            timedelta(days=self.delivery_days_ago))
        print 'get the 2000M visit'
        appointment = Appointment.objects.get(
            registered_subject=registered_subject,
            visit_definition__code='2000M')
        print 'create a maternal visit for the 2000M visit'
        maternal_visit = MaternalVisitFactory(
            appointment=appointment,
            report_datetime=datetime.today() -
            timedelta(days=self.delivery_days_ago))
        print 'create a maternal_lab_del registering 2 of 2 infants'
        self.maternal_lab_del = MaternalLabDelFactory(
            maternal_visit=maternal_visit,
            live_infants=2,
            live_infants_to_register=2,
            delivery_datetime=self.delivery_datetime,
            has_ga='Yes',
            ga=37,
        )
        print 'maternal lab del: {}'.format(self.maternal_lab_del)
        print 'get registered subject of the first infant'
        self.registered_subject1 = RegisteredSubject.objects.filter(
            relative_identifier=self.maternal_consent.subject_identifier
        ).order_by('subject_identifier')[0]
        print 'first registered subject {}'.format(self.registered_subject1)
        self.infant_birth1 = InfantBirthFactory(
            registered_subject=self.registered_subject1,
            maternal_lab_del=self.maternal_lab_del,
            dob=self.delivery_datetime.date())
        print 'first infant birth {}'.format(self.infant_birth1)
        appointment1 = Appointment.objects.get(
            registered_subject=self.registered_subject1,
            visit_definition__code='2000')
        infant_visit1 = InfantVisitFactory(appointment=appointment1,
                                           report_datetime=datetime.today(),
                                           reason='scheduled',
                                           study_status='onstudy notrando')
        print 'get registered subject of the second infant'
        self.registered_subject2 = RegisteredSubject.objects.filter(
            relative_identifier=self.maternal_consent.subject_identifier
        ).order_by('subject_identifier')[1]
        print 'second registered subject {}'.format(self.registered_subject2)
        self.infant_birth2 = InfantBirthFactory(
            registered_subject=self.registered_subject2,
            maternal_lab_del=self.maternal_lab_del,
            dob=self.delivery_datetime.date())
        print 'second infant birth {}'.format(self.infant_birth2)
        appointment2 = Appointment.objects.get(
            registered_subject=self.registered_subject2,
            visit_definition__code='2000')
        infant_visit2 = InfantVisitFactory(appointment=appointment2,
                                           report_datetime=datetime.today(),
                                           reason='scheduled',
                                           study_status='onstudy notrando')
Esempio n. 11
0
    def setUp(self):
        try:
            site_lab_profiles.register(MpepuInfantProfile())
        except AlreadyRegistered:
            pass
        MpepuAppConfiguration().prepare()
        site_lab_tracker.autodiscover()
        site_visit_schedules.autodiscover()
        site_visit_schedules.build_all()
        study_site = StudySiteFactory()
        content_type_map = ContentTypeMap.objects.get(
            model='maternalconsent', app_label='mpepu_maternal')
        consent_catalogue = ConsentCatalogueFactory(
            content_type_map=content_type_map)
        consent_catalogue.add_for_app = 'mpepu_infant'
        consent_catalogue.save()

        delivery_days_ago = 20
        delivery_datetime = datetime.today() - timedelta(
            days=delivery_days_ago - 3)
        #         print "Consent a mother"
        self.maternal_consent = MaternalConsentFactory(
            study_site=study_site,
            consent_datetime=datetime.today() -
            timedelta(days=delivery_days_ago))
        #         print "Consent: {}".format(self.maternal_consent)
        self.registered_subject = RegisteredSubject.objects.get(
            subject_identifier=self.maternal_consent.subject_identifier)
        #         print 'check if mother is eligible'
        self.maternal_eligibility = MaternalEligibilityPostFactory(
            maternal_consent=self.maternal_consent,
            registered_subject=self.registered_subject,
            registration_datetime=datetime.today() -
            timedelta(days=delivery_days_ago))
        #         print 'get the 2000M visit'
        self.m_appointment = Appointment.objects.get(
            registered_subject=self.registered_subject,
            visit_definition__code='2000M')
        #         print 'create a maternal visit for the 2000M visit'
        self.maternal_visit = MaternalVisitFactory(
            appointment=self.m_appointment,
            report_datetime=datetime.today() -
            timedelta(days=delivery_days_ago))
        #         print 'create a maternal_lab_del registering 2 of 2 infants'
        self.maternal_lab_del = MaternalLabDelFactory(
            maternal_visit=self.maternal_visit,
            live_infants=1,
            live_infants_to_register=1,
            delivery_datetime=delivery_datetime,
            has_ga='Yes',
            ga=37,
        )
        #         print 'maternal lab del: {}'.format(self.maternal_lab_del)
        #         print 'get registered subject of the infant'
        self.registered_subject = RegisteredSubject.objects.filter(
            relative_identifier=self.maternal_consent.subject_identifier
        ).order_by('subject_identifier')[0]
        print 'infant registered subject {}'.format(self.registered_subject)
        self.infant_birth = InfantBirthFactory(
            registered_subject=self.registered_subject,
            maternal_lab_del=self.maternal_lab_del,
            dob=delivery_datetime.date())
        #         print 'infant birth {}'.format(self.infant_birth)
        self.appointment = Appointment.objects.get(
            registered_subject=self.registered_subject,
            visit_definition__code='2000')
        self.infant_visit = InfantVisitFactory(
            appointment=self.appointment,
            report_datetime=datetime.today(),
            reason='scheduled',
            study_status='onstudy notrando')
        self.infant_eligibility = InfantEligibilityFactory(
            infant_birth=self.infant_birth,
            registered_subject=self.registered_subject)
        #         print 'infant eligibility {}'.format(self.infant_eligibility)
        self.app_2010 = Appointment.objects.get(
            registered_subject=self.registered_subject,
            visit_definition__code='2010')
        self.visit_2010 = InfantVisitFactory(
            appointment=self.app_2010,
            report_datetime=datetime.today(),
            reason='scheduled',
            study_status='onstudy rando today')
        self.app_2020 = Appointment.objects.get(
            registered_subject=self.registered_subject,
            visit_definition__code='2020')
        self.visit_2020 = InfantVisitFactory(
            appointment=self.app_2020,
            report_datetime=datetime.today(),
            reason='scheduled',
            study_status='onstudy rando ondrug')
        self.app_2030 = Appointment.objects.get(
            registered_subject=self.registered_subject,
            visit_definition__code='2030')
        self.visit_2030 = InfantVisitFactory(
            appointment=self.app_2030,
            report_datetime=datetime.today(),
            reason='scheduled',
            study_status='onstudy rando ondrug')
Esempio n. 12
0
    def setUp(self):
        site_mappers.autodiscover()

        try:
            site_lab_profiles.register(BcppSubjectProfile())
        except AlreadyRegisteredLabProfile:
            pass
        mapper = site_mappers._registry_by_code.get('01')
        mapper.survey_dates = {
            'bcpp-year-1':
            SurveyDatesTuple(name='bhs',
                             start_date=date.today() +
                             relativedelta(years=-1) + relativedelta(days=-89),
                             full_enrollment_date=date.today() +
                             relativedelta(years=-1) + relativedelta(days=60),
                             end_date=date.today() + relativedelta(years=-1) +
                             relativedelta(days=89),
                             smc_start_date=date.today() +
                             relativedelta(years=-1) + relativedelta(days=89)),
            'bcpp-year-2':
            SurveyDatesTuple(name='t1',
                             start_date=date.today() + relativedelta(years=0) +
                             relativedelta(days=-89),
                             full_enrollment_date=date.today() +
                             relativedelta(years=0) + relativedelta(days=60),
                             end_date=date.today() + relativedelta(years=0) +
                             relativedelta(days=89),
                             smc_start_date=date.today() +
                             relativedelta(years=0) + relativedelta(days=89)),
        }

        bcpp_app_configuration.survey_setup = {
            'bcpp-year-1': {
                'survey_name':
                'BCPP Year 1',
                'survey_slug':
                'bcpp-year-1',
                'datetime_start':
                datetime.today() + relativedelta(years=-1) +
                relativedelta(days=-30),
                'datetime_end':
                datetime.today() + relativedelta(years=-1) +
                relativedelta(days=30)
            },
            'bcpp-year-2': {
                'survey_name': 'BCPP Year 2',
                'survey_slug': 'bcpp-year-2',
                'datetime_start': datetime.today() + relativedelta(days=-90),
                'datetime_end': datetime.today() + relativedelta(days=90)
            },
            'bcpp-year-3': {
                'survey_name':
                'BCPP Year 3',
                'survey_slug':
                'bcpp-year-3',
                'datetime_start':
                datetime.today() + relativedelta(years=1) +
                relativedelta(days=-30),
                'datetime_end':
                datetime.today() + relativedelta(years=1) +
                relativedelta(days=30)
            },
        }

        bcpp_app_configuration.prepare()
        site_lab_tracker.autodiscover()
        site_visit_schedules.autodiscover()
        site_visit_schedules.build_all()

        self.survey2 = Survey.objects.current_survey()
        self.survey1 = Survey.objects.previous_survey()
        plot = PlotFactory(community='test_community',
                           household_count=1,
                           status='residential_habitable')
        self.household = Household.objects.get(plot=plot)
        self.source_household_structure = HouseholdStructure.objects.get(
            household=self.household, survey=self.survey1)
        self.target_household_structure = HouseholdStructure.objects.get(
            household=self.household, survey=self.survey2)
        self.representative_eligibility = RepresentativeEligibilityFactory(
            household_structure=self.source_household_structure)
        self.study_site = StudySite.objects.get(
            site_code=site_mappers.get_current_mapper().map_code)
        self.intervention = site_mappers.get_current_mapper().intervention

        # add members to source
        HouseholdMemberFactory(
            household_structure=self.source_household_structure)
        HouseholdMemberFactory(
            household_structure=self.source_household_structure)
        HouseholdMemberFactory(
            household_structure=self.source_household_structure)
        HouseholdMemberFactory(
            household_structure=self.source_household_structure)
        HouseholdMemberFactory(
            household_structure=self.source_household_structure)
Esempio n. 13
0
from dajaxice.core import dajaxice_autodiscover, dajaxice_config

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
Esempio n. 14
0
    def setUp(self):
        try:
            site_lab_profiles.register(MpepuInfantProfile())
        except AlreadyRegistered:
            pass
        MpepuAppConfiguration().prepare()
        site_lab_tracker.autodiscover()
        site_visit_schedules.autodiscover()
        site_visit_schedules.build_all()
        study_site = StudySiteFactory()
        content_type_map = ContentTypeMap.objects.get(
            model='maternalconsent', app_label='mpepu_maternal')
        consent_catalogue = ConsentCatalogueFactory(
            content_type_map=content_type_map)
        consent_catalogue.add_for_app = 'mpepu_infant'
        consent_catalogue.save()

        print "register a mother "
        delivery_days_ago = 20
        delivery_datetime = datetime.today() - timedelta(
            days=delivery_days_ago - 3)
        maternal_consent = MaternalConsentFactory(
            study_site=study_site,
            consent_datetime=datetime.today() -
            timedelta(days=delivery_days_ago))
        print "Consent: {}".format(maternal_consent)
        m_registered_subject = RegisteredSubject.objects.get(
            subject_identifier=maternal_consent.subject_identifier)
        maternal_eligibility = MaternalEligibilityPostFactory(
            maternal_consent=maternal_consent,
            registered_subject=m_registered_subject,
            registration_datetime=datetime.today() -
            timedelta(days=delivery_days_ago))
        appointment = Appointment.objects.get(
            registered_subject=m_registered_subject,
            visit_definition__code='2000M')
        maternal_visit = MaternalVisitFactory(
            appointment=appointment,
            report_datetime=datetime.today() -
            timedelta(days=delivery_days_ago))
        print 'create a maternal_lab_del registering 2 of 2 infants'
        maternal_lab_del = MaternalLabDelFactory(
            maternal_visit=maternal_visit,
            live_infants=2,
            live_infants_to_register=2,
            delivery_datetime=delivery_datetime,
            has_ga='Yes',
            ga=37,
        )
        print 'maternal lab del: {}'.format(maternal_lab_del)
        print 'register infant 1 of 2'
        self.registered_subject1 = RegisteredSubject.objects.filter(
            relative_identifier=maternal_consent.subject_identifier).order_by(
                'subject_identifier')[0]
        print 'first registered subject {}'.format(self.registered_subject1)
        self.infant_birth1 = InfantBirthFactory(
            registered_subject=self.registered_subject1,
            maternal_lab_del=maternal_lab_del,
            dob=delivery_datetime.date())
        print 'first infant birth {}'.format(self.infant_birth1)
        self.infant_eligibility1 = InfantEligibilityFactory(
            infant_birth=self.infant_birth1,
            registered_subject=self.infant_birth1.registered_subject,
            clinical_jaundice='No',
            anemia_neutropenia='No',
            hiv_result_reference='PENDING',
            maternal_feeding_choice='BF',
            maternal_art_status='ON',
            rando_bf_duration='Yes',
            ctx_contra='No',
            congen_anomaly='No',
            randomization_site='Gaborone',
        )
        print 'First infant Eligibility {}'.format(self.infant_eligibility1)

        print "register infant 2 of 2"
        self.registered_subject2 = RegisteredSubject.objects.filter(
            relative_identifier=maternal_consent.subject_identifier).order_by(
                'subject_identifier')[1]
        print 'second registered subject {}'.format(self.registered_subject2)
        infant_birth2 = InfantBirthFactory(
            registered_subject=self.registered_subject2,
            maternal_lab_del=maternal_lab_del,
            dob=delivery_datetime.date())
        print 'second infant birth {}'.format(infant_birth2)
        self.registered_subject2.dob = infant_birth2.dob
        self.registered_subject2.gender = infant_birth2.gender
        self.registered_subject2.initials = infant_birth2.initials
        self.registered_subject2.relative_identifier = m_registered_subject.subject_identifier
        self.registered_subject2.save()