Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delay between symptom onset and hospitalization #97

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/source/usage/how_to_run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ The following inputs specify the disease parameters:
* ``disease.incubation_length_beta`` (`float`, default ``0.2``)
Beta parameter for the incubation length Gamma distribution. The incubation length is the length of time in days after exposure until agents develop symptoms.
For a Gamma distribution, the mean is alpha*beta and the variance is alpha*beta^2.
* ``disease.hospital_delay_length_alpha`` (`float`, default ``1.0``)
Alpha parameter for the hospital_delay length Gamma distribution. The hospital_delay length is the length of time in days after agents develop symptoms that they seek treatment.
For a Gamma distribution, the mean is alpha*beta and the variance is alpha*beta^2.
* ``disease.hospital_delay_length_beta`` (`float`, default ``1.0``)
Beta parameter for the hospital_delay length Gamma distribution. The hospital_delay length is the length of time in days after agents develop symptoms that they seek treatment.
For a Gamma distribution, the mean is alpha*beta and the variance is alpha*beta^2.
* ``disease.hospitalization_days`` (`list of float`, default ``3.0 8.0 7.0``)
Number of hospitalization days for age groups: under 50, 50-64, 65 and over.
* ``disease.xmit_comm`` (`list of float`, default ``0.000018125 0.000054375 0.000145 0.000145 0.000145 0.0002175``)
Expand Down
2 changes: 2 additions & 0 deletions docs/source/usage/utilities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Data is either written as an ``int`` or a ``real``.

- ``incubation_period``: Symptom development period length (known as incubation period in some contexts), i.e. time between exposure and symptoms appearing.

- ``hospital_delay``: Delay after symptom appearance for agents to seek treatment.

- Every day (time-varying)

- Int data
Expand Down
4 changes: 4 additions & 0 deletions examples/inputs.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ disease.infectious_length_beta = 0.17
disease.incubation_length_alpha = 25.0
# Beta parameter for the incubation length Gamma distribution. The incubation length is the length in days from the time of infection until symptoms develop.
disease.incubation_length_beta = 0.2
# Alpha parameter for the hospital_delay length Gamma distribution. The hospital_delay length is the length in days after developing symptoms that agents seek treatment.
disease.hospital_delay_length_alpha = 1.0
# Beta parameter for the hospital_delay length Gamma distribution. The hospital_delay length is the length in days after developing symptoms that agents seek treatment.
disease.hospital_delay_length_beta = 1.0

# Number of days in hospital for the age groups under 50, 50 to 64 and over 64.
disease.hospitalization_days = 3 8 7
Expand Down
3 changes: 2 additions & 1 deletion src/AgentContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ void AgentContainer::infectAgents ()
auto latent_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::latent_period).data();
auto infectious_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::infectious_period).data();
auto incubation_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::incubation_period).data();
auto hospital_delay_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::hospital_delay).data();

const auto lparm = m_d_parm[d];

Expand All @@ -722,7 +723,7 @@ void AgentContainer::infectAgents ()
status_ptr[i] == Status::susceptible ) {
if (amrex::Random(engine) < prob_ptr[i]) {
setInfected(&(status_ptr[i]), &(counter_ptr[i]), &(latent_period_ptr[i]), &(infectious_period_ptr[i]),
&(incubation_period_ptr[i]), engine, lparm);
&(incubation_period_ptr[i]), &(hospital_delay_ptr[i]), engine, lparm);
return;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/AgentDefinitions.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct RealIdxDisease
latent_period, /*!< Time until infectious, which could be before symptoms appear */
infectious_period, /*!< Length of time infectious */
incubation_period, /*!< Time until symptoms appear */
hospital_delay, /*!< Delay after symptom onset until hospital treatment is sought */
nattribs /*!< number of real-type attribute*/
};
};
Expand Down
7 changes: 7 additions & 0 deletions src/DiseaseParm.H
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ struct DiseaseParm
Real incubation_length_alpha = Real(25.0); /*! alpha parameter for gamma distribution*/
Real incubation_length_beta = Real(0.2); /*! beta parameter for gamma distribution*/

Real hospital_delay_length_alpha = Real(1.0); /*! alpha parameter for gamma distribution*/
Real hospital_delay_length_beta = Real(1.0); /*! beta parameter for gamma distribution*/

/*! number of hospitalization days by age group (#AgeGroups_Hosp); note that the
* age groups here are under 50, 50-64, and over 65, and *not* the age groups
* used in other parts of the code (#AgeGroups) */
Expand Down Expand Up @@ -164,6 +167,7 @@ void setInfected ( int* status,
amrex::ParticleReal* latent_period,
amrex::ParticleReal* infectious_period,
amrex::ParticleReal* incubation_period,
amrex::ParticleReal* hospital_delay,
amrex::RandomEngine const& engine,
const DiseaseParm* lparm)
{
Expand All @@ -175,9 +179,12 @@ void setInfected ( int* status,
static_cast<ParticleReal>(amrex::RandomGamma(lparm->infectious_length_alpha, lparm->infectious_length_beta, engine));
*incubation_period =
static_cast<ParticleReal>(amrex::RandomGamma(lparm->incubation_length_alpha, lparm->incubation_length_beta, engine));
*hospital_delay =
static_cast<ParticleReal>(amrex::RandomGamma(lparm->hospital_delay_length_alpha, lparm->hospital_delay_length_beta, engine));
if (*latent_period < 0) { *latent_period = amrex::Real(0);}
if (*infectious_period < 0) { *infectious_period = amrex::Real(0);}
if (*incubation_period < 0) { *incubation_period = amrex::Real(0);}
if (*hospital_delay < 0) { *hospital_delay = amrex::Real(0);}
if (*incubation_period > (*infectious_period + *latent_period)) {
*incubation_period = std::floor(*infectious_period + *latent_period);
}
Expand Down
2 changes: 2 additions & 0 deletions src/DiseaseParm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ void DiseaseParm::readInputs ( const std::string& a_pp_str /*!< Parmparse string
pp.query("latent_length_alpha", latent_length_alpha);
pp.query("infectious_length_alpha", infectious_length_alpha);
pp.query("incubation_length_alpha", incubation_length_alpha);
pp.query("hospital_delay_length_alpha", hospital_delay_length_alpha);

pp.query("latent_length_beta", latent_length_beta);
pp.query("infectious_length_beta", infectious_length_beta);
pp.query("incubation_length_beta", incubation_length_beta);
pp.query("hospital_delay_length_beta", hospital_delay_length_beta);

pp.query("immune_length_alpha", immune_length_alpha);
pp.query("immune_length_beta", immune_length_beta);
Expand Down
11 changes: 11 additions & 0 deletions src/DiseaseStatus.H
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ void DiseaseStatus<AC,ACT,ACTD,A>::updateAgents(AC& a_agents, /*!< Agent contain
auto latent_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::latent_period).data();
auto infectious_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::infectious_period).data();
auto incubation_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::incubation_period).data();
auto hospital_delay_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::hospital_delay).data();

auto* disease_parm_d = a_agents.getDiseaseParameters_d(d);
auto* disease_parm_h = a_agents.getDiseaseParameters_h(d);
Expand Down Expand Up @@ -168,6 +169,16 @@ void DiseaseStatus<AC,ACT,ACTD,A>::updateAgents(AC& a_agents, /*!< Agent contain
if (symptomatic_withdraw_compliance > 0.0_rt && (Random(engine) < symptomatic_withdraw_compliance)) {
withdrawn_ptr[i] = 1;
}
if (Math::floor(hospital_delay_ptr[i]) == 0) {
disease_parm_d->check_hospitalization(&(timer_ptr[i]),
&(marked_for_ICU_ptr[i]),
&(marked_for_vent_ptr[i]),
age_group_ptr[i],
engine); }
if (timer_ptr[i] > 0) { marked_for_hosp_ptr[i] = 1; }
}
} else if ((Math::floor(hospital_delay_ptr[i]) > 0) && (Math::floor(counter_ptr[i]) == Math::floor(incubation_period_ptr[i]) + Math::floor(hospital_delay_ptr[i]))) {
if (symptomatic_ptr[i] == SymptomStatus::symptomatic) {
disease_parm_d->check_hospitalization(&(timer_ptr[i]),
&(marked_for_ICU_ptr[i]),
&(marked_for_vent_ptr[i]),
Expand Down
2 changes: 2 additions & 0 deletions src/IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ void writePlotFile (const AgentContainer& pc, /*!< Agent (particle) container */
real_varnames.push_back("latent_period"); write_real_comp.push_back(static_cast<int>(step==0));
real_varnames.push_back("infectious_period"); write_real_comp.push_back(static_cast<int>(step==0));
real_varnames.push_back("incubation_period"); write_real_comp.push_back(static_cast<int>(step==0));
real_varnames.push_back("hospital_delay"); write_real_comp.push_back(static_cast<int>(step==0));
int_varnames.push_back ("status"); write_int_comp.push_back(1);
int_varnames.push_back ("symptomatic"); write_int_comp.push_back(1);
} else {
Expand All @@ -145,6 +146,7 @@ void writePlotFile (const AgentContainer& pc, /*!< Agent (particle) container */
real_varnames.push_back(disease_names[d]+"_latent_period"); write_real_comp.push_back(static_cast<int>(step==0));
real_varnames.push_back(disease_names[d]+"_infectious_period"); write_real_comp.push_back(static_cast<int>(step==0));
real_varnames.push_back(disease_names[d]+"_incubation_period"); write_real_comp.push_back(static_cast<int>(step==0));
real_varnames.push_back(disease_names[d]+"_hospital_delay"); write_real_comp.push_back(static_cast<int>(step==0));
int_varnames.push_back (disease_names[d]+"_status"); write_int_comp.push_back(1);
int_varnames.push_back (disease_names[d]+"_symptomatic"); write_int_comp.push_back(1);
}
Expand Down
3 changes: 2 additions & 1 deletion src/InitializeInfections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ static int infect_random_community (AgentContainer& pc, /*!< Agent container (pa
auto latent_period_ptr = soa.GetRealData(r_RT+r0(d_idx)+RealIdxDisease::latent_period).data();
auto infectious_period_ptr = soa.GetRealData(r_RT+r0(d_idx)+RealIdxDisease::infectious_period).data();
auto incubation_period_ptr = soa.GetRealData(r_RT+r0(d_idx)+RealIdxDisease::incubation_period).data();
auto hospital_delay_ptr = soa.GetRealData(r_RT+r0(d_idx)+RealIdxDisease::hospital_delay).data();

auto comm_arr = comm_mf[mfi].array();

Expand Down Expand Up @@ -113,7 +114,7 @@ static int infect_random_community (AgentContainer& pc, /*!< Agent container (pa
}
} else {
setInfected(&(status_ptr[pindex]), &(counter_ptr[pindex]), &(latent_period_ptr[pindex]),
&(infectious_period_ptr[pindex]), &(incubation_period_ptr[pindex]), engine, lparm);
&(infectious_period_ptr[pindex]), &(incubation_period_ptr[pindex]), &(hospital_delay_ptr[i]), engine, lparm);
++ni;
}
}
Expand Down