BDI-pathogens / OpenABM-Covid19

OpenABM-Covid19: an agent-based model for modelling the spread of SARS-CoV-2 (coronavirus) and control interventions for the Covid-19 epidemic
GNU General Public License v3.0
111 stars 76 forks source link

Household size #237

Closed sanderbroos closed 1 year ago

sanderbroos commented 1 year ago

Hi, I am trying to use a user's household size (number of people in their household) as an attribute for my research. At the moment I accomplish this by, at the start of every run, reading baseline_household_demographics.csv (which has household data per age group), summing over each row to get the total counts, and creating a new list which I then index into using the user's household id every time I need a user's household size. This feels like a bit of a workaround, so I was wondering if there is a simpler way to directly access this property per user.

Kind regards, Sander

roberthinch commented 1 year ago

At the moment we don't store the size of the household on the individual object, but we do store the household ID. The table of individual attributes (including household ID) can be obtained by using the method get_individuals on the model object (via either the Python or R interface). Generating a lookup table of household size should then be a one-liner in pandas/dataframe.