Skip to content

Test and trace

TestAndTrace

Class to track testing and contact tracing information for a person. This separates testing and tracing from the infection mechanics.

Source code in june/epidemiology/test_and_trace.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class TestAndTrace:
    """Class to track testing and contact tracing information for a person.
    This separates testing and tracing from the infection mechanics.

    """
    def __init__(self):
        self.disease_config = GlobalContext.get_disease_config()

        # Contact tracing information
        self.notification_time = None
        self.scheduled_test_time = None
        self.contacts_traced = False

        # Testing information
        self.time_of_testing = None
        self.time_of_result = None
        self.pending_test_result = None
        self.test_result = None

        #Event flags
        self.emited_quarantine_start_event = None 
        self.emited_quarantine_end_event = None 

        #Isolation information
        self.isolation_start_time = None
        self.isolation_end_time = None

        # Contact tracing source information
        self.tracer_id = None  # ID of the person who caused this person to be traced
        self.contact_reason = None  # Reason for contact (e.g., 'housemate', 'colleague', 'leisure')

        self.debug = False
        if self.debug:
            print(f"TestAndTrace.__init__ called ")
            print(f"Successfully created TestAndTrace object with scheduled_test_time={self.scheduled_test_time}")


    def __repr__(self):
        return (f"TestAndTrace(status={self.status}, "
                f"notified_at={self.notification_time}, "
                f"scheduled_test={self.scheduled_test_time}, "
                f"test_result={self.test_result})")