27 #include <boost/property_tree/ptree.hpp> 37 SurveySeeder::SurveySeeder(
const ptree& config,
RnMan& rnMan) : m_config(config), m_rn_man(rnMan) {}
41 const string logLevel =
m_config.get<
string>(
"run.contact_log_level",
"None");
42 if (logLevel !=
"None") {
46 const auto popCount =
static_cast<unsigned int>(population.
size() - 1);
47 const auto numSurveyed =
m_config.get<
unsigned int>(
"run.num_participants_survey");
49 assert((popCount >= 1U) &&
"SurveySeeder> Population count zero unacceptable.");
50 assert((popCount >= numSurveyed) &&
"SurveySeeder> Pop count has to exceeed number of surveyed.");
57 while (numSamples < numSurveyed) {
58 Person& p = population[generator()];
65 const auto pHH = p.
GetPoolId(Id::Household);
66 const auto pK12 = p.
GetPoolId(Id::K12School);
68 const auto pW = p.
GetPoolId(Id::Workplace);
69 const auto pPC = p.
GetPoolId(Id::PrimaryCommunity);
70 const auto pSC = p.
GetPoolId(Id::SecondaryCommunity);
71 logger->info(
"[PART] {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}", p.
GetId(),
72 p.
GetAge(), pHH, pK12, pC, pW, h.IsSusceptible(), h.IsInfected(), h.IsInfectious(),
73 h.IsRecovered(), h.IsImmune(), h.GetStartInfectiousness(), h.GetStartSymptomatic(),
74 h.GetEndInfectiousness(), h.GetEndSymptomatic(),
75 poolSys.CRefPools<Id::Household>()[pHH].GetPool().size(),
76 poolSys.CRefPools<Id::K12School>()[pK12].GetPool().size(),
77 poolSys.CRefPools<Id::College>()[pC].GetPool().size(),
78 poolSys.CRefPools<Id::Workplace>()[pW].GetPool().size(),
79 poolSys.CRefPools<Id::PrimaryCommunity>()[pPC].GetPool().size(),
80 poolSys.CRefPools<Id::SecondaryCommunity>()[pSC].GetPool().size());
Health & GetHealth()
Return person's health status.
bool IsSurveyParticipant() const
Does this person participates in the social contact study?
unsigned int GetPoolId(const ContactType::Id &poolType) const
Get ID of contactpool_type.
Utilities for the project.
unsigned int GetId() const
Get the id.
const ContactPoolSys & CRefPoolSys() const
The ContactPoolSys of the simulator.
float GetAge() const
Get the age.
std::function< int()> GetUniformIntGenerator(int a, int b, unsigned int i=0U)
Return a generator for uniform ints in [a, b[ (a < b) using i-th random stream.
Key Data structure: container for (a) all individuals in the population (b) the ContactPoolSys wchich...
util::RnMan & m_rn_man
Random number manager.
const boost::property_tree::ptree & m_config
Run config.
Header file for the SurveySeeder class.
Header file for the core Population class.
std::shared_ptr< spdlog::logger > & RefContactLogger()
Return the contactlogger.
std::size_t size() const
Returns the number of elements.
std::shared_ptr< Population > Seed(std::shared_ptr< Population > pop)
Seeds the population with survey participants.
Store and handle person data.
Namespace for the simulator and related classes.
Namespace to manage types of ContactPool.
void ParticipateInSurvey()
Participate in social contact study and log person details.