Skip to content

Community Object

Note

Community object is implemented on community.py.

The community object manages, from the highest architecture level, the social interactions and social interventions, the connection between the population, the city services and other modules. The main method in the class is the simulate() method. This method basically runs a list of other internal methods, which are added to the execution list (using the add_to_execution() method) at the community object initialization. Every method or function added to the execution list is given a priority number and a time of the day to be called, in each step all methods/functions, that are inside the time of the day window for that method/function, are called in crescent order of priority.

Below we have a simple description of some of these methods:

  • close_or_open_services(): According to the decisions set.
  • work(): Move particles to their respective workplace according to their shifts.
  • lockdown(): Handles lockdowns. It mainly works by temporarily altering (most likely increasing) the percentage of social isolation in the community.
  • isolation(): Handles social isolation in the community. In a simple way, this function sets a percentage of the community to stay at home during working hours.
  • services_visit(): Move particles to their respective chosen service according to the visitation period for that service.
  • update_position(): Makes all particles' movement according to social mechanics. Changes are previously made in particles' placement and activity states, which cause them be moved to or off services.
  • update_states(): Most important COMORBUSS method, population method that:
    • Generates all encounters masks,
    • Transition particles states using the disease mechanics,
    • Generates new infections using the encounters masks and the disease mechanics.
  • print_events(): prints to the standard output all new events generated by the simulation. Can be deactivated to generate a cleaner output with print_events set to False.

Other methods can be added to the execution list by loaded modules:

Warning

Broken links below!