Covasim must instantiate and manage a population of people, where the people are from the module people.py. The module population.py serves this purpose, but it consists of a number of functions in the module that are called directly by the user when initializing the Covasim simulation.
In choosing an aggregate, we observe a sort of “has-a” relationship between a population (which is initialized with certain demographic patterns) and the people within it; a person can belong to a population group, but their lifecycle is not bound to it. This is the foundation for an aggregate Population.
Description of Changes
This PR implements a Population aggregate in population.py, creating a Population class responsible for generating a population of People. Now, the Population aggregate can be instantiated with given parameters, and the people are stored as a field. For example, in the Sim class in sim.py, the initialization of people in init_people now creates the Population aggregate and accesses the people through the aggregate root, the people field.
Please note: this PR is part of a school project.
Why?
Covasim must instantiate and manage a population of people, where the people are from the module
people.py
. The modulepopulation.py
serves this purpose, but it consists of a number of functions in the module that are called directly by the user when initializing the Covasim simulation.In choosing an aggregate, we observe a sort of “has-a” relationship between a population (which is initialized with certain demographic patterns) and the people within it; a person can belong to a population group, but their lifecycle is not bound to it. This is the foundation for an aggregate
Population
.Description of Changes
This PR implements a
Population
aggregate inpopulation.py
, creating aPopulation
class responsible for generating a population ofPeople
. Now, thePopulation
aggregate can be instantiated with given parameters, and thepeople
are stored as a field. For example, in theSim
class insim.py
, the initialization of people ininit_people
now creates thePopulation
aggregate and accesses the people through the aggregate root, thepeople
field.