Ejemplo n.º 1
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()

        # persons
        self.client1 = get_tst_client('c1', {'town': self.town1})
        self.client2 = get_tst_client('c2', {'town': self.town1})
        self.anonym = Anonymous.objects.get(sex=SEXES.MALE,
                                            drug_user_type=ANONYMOUS_TYPES.IV)

        # services
        create_service(Address, self.client1, date(2011, 11, 1), self.town1)
        create_service(Address, self.client2, date(2011, 11, 1), self.town1)
        create_service(Address, self.client1, date(2011, 12, 1), self.town1)
        create_service(Address, self.client1, date(2011, 11, 1), self.town2)
        create_service(Address, self.anonym, date(2011, 11, 1), self.town1)
        create_service(PhoneUsage,
                       self.client1,
                       date(2011, 11, 1),
                       self.town1,
                       is_by_phone=True)
        create_service(PhoneUsage,
                       self.anonym,
                       date(2011, 11, 1),
                       self.town1,
                       is_by_phone=True)

        self.report = MockMonthlyReport()
Ejemplo n.º 2
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()
        self.drug = DRUGS.HEROIN

        # clients
        self.client1 = get_tst_client('c1', {'town': self.town1, })
        self.client2 = get_tst_client('c2', {'town': self.town1, })
        self.client3 = get_tst_client('c3', {'town': self.town1, 'primary_drug_usage': DRUG_APPLICATION_TYPES.SMOKING,
                                             'primary_drug': self.drug})

        create_encounter(self.client1, date(2011, 11, 1))
        create_encounter(self.client1, date(2011, 11, 1), self.town2)
        create_encounter(self.client1, date(2011, 11, 1))
        create_encounter(self.client2, date(2011, 11, 1), self.town2)
        create_encounter(self.client2, date(2011, 12, 1), self.town2)
        create_encounter(self.client3, date(2011, 12, 1), self.town2)

        # anonymous
        self.anonym1 = Anonymous.objects.get(sex=SEXES.MALE, drug_user_type=ANONYMOUS_TYPES.IV)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town2)

        self.monthly_report = MockMonthlyReport()
        self.yearly_report = MockYearlyReport()
Ejemplo n.º 3
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()

        # clients
        self.client1 = get_tst_client('c1', {
            'town': self.town1,
        })
        self.client2 = get_tst_client('c2', {
            'town': self.town1,
        })

        hr_kwargs = {
            'in_count': 5,
            'out_count': 17,
        }
        create_service(HarmReduction, self.client1, date(2011, 11, 1),
                       self.town1, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 11, 1),
                       self.town1, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 11, 1),
                       self.town2, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 12, 1),
                       self.town1, hr_kwargs)

        self.monthly_report = MockMonthlyReport()
        self.yearly_report = MockYearlyReport()
Ejemplo n.º 4
0
 def setUp(self):
     drug = DRUGS.HEROIN
     self.town1 = get_tst_town()
     self.town2 = get_tst_town()
     self.client1 = get_tst_client('c1', {
         'town': self.town1,
         'primary_drug': drug
     })
     self.client2 = get_tst_client('c2', {
         'town': self.town1,
         'primary_drug': drug
     })
     create_service(Address, self.client1, date(2011, 11, 1), self.town1)
     create_service(Address, self.client1, date(2011, 11, 3), self.town1)
     create_service(Address, self.client2, date(2011, 11, 1), self.town1)
     create_service(UtilityWork, self.client1, date(2011, 11, 1),
                    self.town2)
     social_work_kwargs = {'other': True}
     create_service(SocialWork, self.client1, date(2012, 11, 1), self.town1,
                    social_work_kwargs)
     create_service(SocialWork, self.client1, date(2011, 11, 1), self.town1)
     create_service(InformationService, self.client1, date(2011, 11, 1),
                    self.town1)
     harm_reduction_kwargs = {'in_count': 87, 'condoms': True}
     create_service(HarmReduction, self.client1, date(2011, 11, 1),
                    self.town1, harm_reduction_kwargs)
Ejemplo n.º 5
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()
        self.drug = DRUGS.HEROIN

        # persons
        self.client1 = get_tst_client('c1', {'town': self.town1, 'primary_drug': self.drug})
        self.client2 = get_tst_client('c2', {'town': self.town2, 'primary_drug': self.drug})
        self.client3 = get_tst_client('c3', {'town': self.town1})
        self.client4 = get_tst_client('c4', {'town': self.town1, 'primary_drug': self.drug,
                                             'primary_drug_usage': DRUG_APPLICATION_TYPES.VEIN_INJECTION})

        self.anonym1 = Anonymous.objects.get(sex=SEXES.MALE, drug_user_type=ANONYMOUS_TYPES.IV)
        self.anonym2 = Anonymous.objects.get(sex=SEXES.MALE, drug_user_type=ANONYMOUS_TYPES.NON_USER)

        # services - addresses
        create_service(Address, self.client1, date(2011, 11, 1), self.town1)
        create_service(Address, self.client1, date(2011, 11, 1), self.town2)
        create_service(Address, self.client1, date(2011, 12, 1), self.town2)
        create_service(Address, self.client3, date(2011, 11, 1), self.town1)
        create_service(Address, self.anonym1, date(2011, 11, 1), self.town1)
        create_service(Address, self.anonym1, date(2011, 11, 1), self.town1)
        create_service(Address, self.anonym2, date(2011, 11, 1), self.town1)

        # services - income examinations
        create_service(IncomeExamination, self.client1, date(2011, 11, 1), self.town1)
        create_service(IncomeExamination, self.client3, date(2011, 11, 1), self.town2)
        create_service(IncomeExamination, self.client4, date(2011, 11, 1), self.town1)
        create_service(IncomeExamination, self.anonym1, date(2011, 11, 1), self.town1)
        create_service(IncomeExamination, self.anonym2, date(2011, 11, 1), self.town1)
        create_service(IncomeExamination, self.client2, date(2011, 12, 1), self.town1)

        # services - harm reduction
        hr_kwargs = {
            'in_count': 5,
            'out_count': 10,
        }
        create_service(HarmReduction, self.client1, date(2011, 11, 1), self.town1, hr_kwargs)
        create_service(HarmReduction, self.client2, date(2011, 11, 1), self.town1, hr_kwargs)
        create_service(HarmReduction, self.client2, date(2011, 11, 1), self.town1, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 12, 1), self.town1, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 11, 1), self.town2, hr_kwargs)

        # services - disease tests
        create_service(DiseaseTest, self.client1, date(2011, 11, 1), self.town1, {'disease': DISEASES.VHC})
        create_service(DiseaseTest, self.client1, date(2011, 12, 1), self.town1, {'disease': DISEASES.VHC})
        create_service(DiseaseTest, self.client1, date(2011, 11, 1), self.town2, {'disease': DISEASES.VHC})
        create_service(DiseaseTest, self.client1, date(2011, 11, 1), self.town2, {'disease': DISEASES.HIV})

        self.report = MockMonthlyReport()
Ejemplo n.º 6
0
 def setUp(self):
     drug = DRUGS.HEROIN
     self.town1 = get_tst_town()
     self.town2 = get_tst_town()
     self.client1 = get_tst_client("c1", {"town": self.town1, "primary_drug": drug})
     self.client2 = get_tst_client("c2", {"town": self.town1, "primary_drug": drug})
     create_service(Address, self.client1, date(2011, 11, 1), self.town1)
     create_service(Address, self.client1, date(2011, 11, 3), self.town1)
     create_service(Address, self.client2, date(2011, 11, 1), self.town1)
     create_service(UtilityWork, self.client1, date(2011, 11, 1), self.town2)
     social_work_kwargs = {"other": True}
     create_service(SocialWork, self.client1, date(2012, 11, 1), self.town1, social_work_kwargs)
     create_service(SocialWork, self.client1, date(2011, 11, 1), self.town1)
     create_service(InformationService, self.client1, date(2011, 11, 1), self.town1)
     harm_reduction_kwargs = {"in_count": 87, "condoms": True}
     create_service(HarmReduction, self.client1, date(2011, 11, 1), self.town1, harm_reduction_kwargs)
Ejemplo n.º 7
0
 def setUp(self):
     drug = DRUGS.HEROIN
     self.town1 = get_tst_town()
     self.client1 = get_tst_client("c1", {"town": self.town1, "primary_drug": drug})
     self.harm_reduction = create_service(HarmReduction, self.client1, date(2011, 11, 1), self.town1)
     self.encounter = Encounter.objects.filter(person=self.client1)[0]
     handler = ServerHandler(sys.stdin, sys.stdout, sys.stderr, {"REQUEST_METHOD": "POST"})
     handler.setup_environ()
     self.request = WSGIRequest(handler.environ)
Ejemplo n.º 8
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()

        # clients
        self.client1 = get_tst_client('c1', {'town': self.town1, })
        self.client2 = get_tst_client('c2', {'town': self.town1, })

        hr_kwargs = {
            'in_count': 5,
            'out_count': 17,
        }
        create_service(HarmReduction, self.client1, date(2011, 11, 1), self.town1, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 11, 1), self.town1, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 11, 1), self.town2, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 12, 1), self.town1, hr_kwargs)

        self.monthly_report = MockMonthlyReport()
        self.yearly_report = MockYearlyReport()
Ejemplo n.º 9
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()

        # persons
        self.client1 = get_tst_client('c1', {'town': self.town1})
        self.client2 = get_tst_client('c2', {'town': self.town1})
        self.anonym = Anonymous.objects.get(sex=SEXES.MALE, drug_user_type=ANONYMOUS_TYPES.IV)

        # services
        create_service(Address, self.client1, date(2011, 11, 1), self.town1)
        create_service(Address, self.client2, date(2011, 11, 1), self.town1)
        create_service(Address, self.client1, date(2011, 12, 1), self.town1)
        create_service(Address, self.client1, date(2011, 11, 1), self.town2)
        create_service(Address, self.anonym, date(2011, 11, 1), self.town1)
        create_service(PhoneUsage, self.client1, date(2011, 11, 1), self.town1, is_by_phone=True)
        create_service(PhoneUsage, self.anonym, date(2011, 11, 1), self.town1, is_by_phone=True)

        self.report = MockMonthlyReport()
Ejemplo n.º 10
0
 def setUp(self):
     drug = DRUGS.HEROIN
     self.town1 = get_tst_town()
     self.client1 = get_tst_client('c1', {
         'town': self.town1,
         'primary_drug': drug
     })
     self.harm_reduction = create_service(HarmReduction, self.client1,
                                          date(2011, 11, 1), self.town1)
     self.encounter = Encounter.objects.filter(person=self.client1)[0]
     handler = ServerHandler(sys.stdin, sys.stdout, sys.stderr,
                             {'REQUEST_METHOD': 'POST'})
     handler.setup_environ()
     self.request = WSGIRequest(handler.environ)
Ejemplo n.º 11
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()
        self.drug = DRUGS.HEROIN

        # clients
        self.client1 = get_tst_client('c1', {
            'town': self.town1,
        })
        self.client2 = get_tst_client('c2', {
            'town': self.town1,
        })
        self.client3 = get_tst_client(
            'c3', {
                'town': self.town1,
                'primary_drug_usage': DRUG_APPLICATION_TYPES.SMOKING,
                'primary_drug': self.drug
            })

        create_encounter(self.client1, date(2011, 11, 1))
        create_encounter(self.client1, date(2011, 11, 1), self.town2)
        create_encounter(self.client1, date(2011, 11, 1))
        create_encounter(self.client2, date(2011, 11, 1), self.town2)
        create_encounter(self.client2, date(2011, 12, 1), self.town2)
        create_encounter(self.client3, date(2011, 12, 1), self.town2)

        # anonymous
        self.anonym1 = Anonymous.objects.get(sex=SEXES.MALE,
                                             drug_user_type=ANONYMOUS_TYPES.IV)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town2)

        self.monthly_report = MockMonthlyReport()
        self.yearly_report = MockYearlyReport()
Ejemplo n.º 12
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()
        self.drug = DRUGS.HEROIN

        # clients
        self.client1 = get_tst_client('c1', {'town': self.town1, 'primary_drug': self.drug})
        self.client2 = get_tst_client('c2', {'town': self.town1, 'primary_drug': self.drug,
                                             'primary_drug_usage': DRUG_APPLICATION_TYPES.VEIN_INJECTION})
        self.client3 = get_tst_client('c3', {'town': self.town1, 'sex': SEXES.FEMALE, 'close_person': True})
        self.client4 = get_tst_client('c4', {'town': self.town1})
        self.client5 = get_tst_client('c5', {'town': self.town2})
        self.client6 = get_tst_client('c6', {'town': self.town2})
        self.client7 = get_tst_client('c7', {'town': self.town2, 'sex_partner': True})

        create_encounter(self.client1, date(2011, 11, 1))
        create_encounter(self.client1, date(2011, 11, 1))
        create_encounter(self.client1, date(2011, 12, 1))
        create_encounter(self.client2, date(2011, 11, 1))
        create_encounter(self.client3, date(2011, 11, 1))
        create_encounter(self.client3, date(2011, 11, 1))
        create_encounter(self.client4, date(2011, 12, 1))
        create_encounter(self.client5, date(2011, 11, 1))
        create_encounter(self.client5, date(2011, 11, 1))
        create_encounter(self.client5, date(2011, 11, 1))
        create_encounter(self.client6, date(2010, 11, 1))
        create_encounter(self.client6, date(2011, 7, 1))
        create_encounter(self.client6, date(2011, 11, 1))
        create_encounter(self.client7, date(2011, 11, 1))

        # anonymous
        self.anonym1 = Anonymous.objects.get(sex=SEXES.MALE, drug_user_type=ANONYMOUS_TYPES.IV)
        self.anonym2 = Anonymous.objects.get(sex=SEXES.FEMALE, drug_user_type=ANONYMOUS_TYPES.IV)
        self.anonym3 = Anonymous.objects.get(sex=SEXES.MALE, drug_user_type=ANONYMOUS_TYPES.NON_USER_PARENT)

        create_encounter(self.anonym1, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym2, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym3, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym2, date(2011, 12, 1), self.town1)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town2)

        self.report = MockMonthlyReport()
Ejemplo n.º 13
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()
        self.drug = DRUGS.HEROIN

        # persons
        self.client1 = get_tst_client('c1', {
            'town': self.town1,
            'primary_drug': self.drug
        })
        self.client2 = get_tst_client('c2', {
            'town': self.town2,
            'primary_drug': self.drug
        })
        self.client3 = get_tst_client('c3', {'town': self.town1})
        self.client4 = get_tst_client(
            'c4', {
                'town': self.town1,
                'primary_drug': self.drug,
                'primary_drug_usage': DRUG_APPLICATION_TYPES.VEIN_INJECTION
            })

        self.anonym1 = Anonymous.objects.get(sex=SEXES.MALE,
                                             drug_user_type=ANONYMOUS_TYPES.IV)
        self.anonym2 = Anonymous.objects.get(
            sex=SEXES.MALE, drug_user_type=ANONYMOUS_TYPES.NON_USER)

        # services - addresses
        create_service(Address, self.client1, date(2011, 11, 1), self.town1)
        create_service(Address, self.client1, date(2011, 11, 1), self.town2)
        create_service(Address, self.client1, date(2011, 12, 1), self.town2)
        create_service(Address, self.client3, date(2011, 11, 1), self.town1)
        create_service(Address, self.anonym1, date(2011, 11, 1), self.town1)
        create_service(Address, self.anonym1, date(2011, 11, 1), self.town1)
        create_service(Address, self.anonym2, date(2011, 11, 1), self.town1)

        # services - income examinations
        create_service(IncomeExamination, self.client1, date(2011, 11, 1),
                       self.town1)
        create_service(IncomeExamination, self.client3, date(2011, 11, 1),
                       self.town2)
        create_service(IncomeExamination, self.client4, date(2011, 11, 1),
                       self.town1)
        create_service(IncomeExamination, self.anonym1, date(2011, 11, 1),
                       self.town1)
        create_service(IncomeExamination, self.anonym2, date(2011, 11, 1),
                       self.town1)
        create_service(IncomeExamination, self.client2, date(2011, 12, 1),
                       self.town1)

        # services - harm reduction
        hr_kwargs = {
            'in_count': 5,
            'out_count': 10,
        }
        create_service(HarmReduction, self.client1, date(2011, 11, 1),
                       self.town1, hr_kwargs)
        create_service(HarmReduction, self.client2, date(2011, 11, 1),
                       self.town1, hr_kwargs)
        create_service(HarmReduction, self.client2, date(2011, 11, 1),
                       self.town1, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 12, 1),
                       self.town1, hr_kwargs)
        create_service(HarmReduction, self.client1, date(2011, 11, 1),
                       self.town2, hr_kwargs)

        # services - disease tests
        create_service(DiseaseTest, self.client1, date(2011, 11, 1),
                       self.town1, {'disease': DISEASES.VHC})
        create_service(DiseaseTest, self.client1, date(2011, 12, 1),
                       self.town1, {'disease': DISEASES.VHC})
        create_service(DiseaseTest, self.client1, date(2011, 11, 1),
                       self.town2, {'disease': DISEASES.VHC})
        create_service(DiseaseTest, self.client1, date(2011, 11, 1),
                       self.town2, {'disease': DISEASES.HIV})

        self.report = MockMonthlyReport()
Ejemplo n.º 14
0
 def setUp(self):
     self.my_client = get_tst_client()
     self.user = get_tst_usr()
Ejemplo n.º 15
0
 def setUp(self):
     self.client1 = get_tst_client('aaa', {'birthdate': date(2000, 11, 20)})
     self.client2 = get_tst_client('bbb', {'birthdate': date(2010, 11, 1)})
     self.client3 = get_tst_client('ccc', {'birthdate': None})
     self.client4 = get_tst_client('ddd', {'birthdate_year_only': 1, 'birthdate': date(1993, 1, 1)})
     self.client5 = get_tst_client('eee', {'birthdate': date(2016, 12, 1)})
Ejemplo n.º 16
0
    def setUp(self):
        install_views('')
        self.town1 = get_tst_town()
        self.town2 = get_tst_town()
        self.drug = DRUGS.HEROIN

        # clients
        self.client1 = get_tst_client('c1', {
            'town': self.town1,
            'primary_drug': self.drug
        })
        self.client2 = get_tst_client(
            'c2', {
                'town': self.town1,
                'primary_drug': self.drug,
                'primary_drug_usage': DRUG_APPLICATION_TYPES.VEIN_INJECTION
            })
        self.client3 = get_tst_client('c3', {
            'town': self.town1,
            'sex': SEXES.FEMALE,
            'close_person': True
        })
        self.client4 = get_tst_client('c4', {'town': self.town1})
        self.client5 = get_tst_client('c5', {'town': self.town2})
        self.client6 = get_tst_client('c6', {'town': self.town2})
        self.client7 = get_tst_client('c7', {
            'town': self.town2,
            'sex_partner': True
        })

        create_encounter(self.client1, date(2011, 11, 1))
        create_encounter(self.client1, date(2011, 11, 1))
        create_encounter(self.client1, date(2011, 12, 1))
        create_encounter(self.client2, date(2011, 11, 1))
        create_encounter(self.client3, date(2011, 11, 1))
        create_encounter(self.client3, date(2011, 11, 1))
        create_encounter(self.client4, date(2011, 12, 1))
        create_encounter(self.client5, date(2011, 11, 1))
        create_encounter(self.client5, date(2011, 11, 1))
        create_encounter(self.client5, date(2011, 11, 1))
        create_encounter(self.client6, date(2010, 11, 1))
        create_encounter(self.client6, date(2011, 7, 1))
        create_encounter(self.client6, date(2011, 11, 1))
        create_encounter(self.client7, date(2011, 11, 1))

        # anonymous
        self.anonym1 = Anonymous.objects.get(sex=SEXES.MALE,
                                             drug_user_type=ANONYMOUS_TYPES.IV)
        self.anonym2 = Anonymous.objects.get(sex=SEXES.FEMALE,
                                             drug_user_type=ANONYMOUS_TYPES.IV)
        self.anonym3 = Anonymous.objects.get(
            sex=SEXES.MALE, drug_user_type=ANONYMOUS_TYPES.NON_USER_PARENT)

        create_encounter(self.anonym1, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym2, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym3, date(2011, 11, 1), self.town1)
        create_encounter(self.anonym2, date(2011, 12, 1), self.town1)
        create_encounter(self.anonym1, date(2011, 11, 1), self.town2)

        self.report = MockMonthlyReport()
Ejemplo n.º 17
0
 def setUp(self):
     self.my_client = get_tst_client()
     self.user = get_tst_usr()