Skip to content

Commit

Permalink
add model option for health system memory fix, true by default (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
acavelan authored Jul 15, 2024
1 parent 017ab1d commit 476e63a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
9 changes: 8 additions & 1 deletion model/Clinical/Episode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ void Episode::flush() {

void Episode::update (const Host::Human& human, Episode::State newState)
{
if( time + ClinicalModel::hsMemory() <= sim::ts0() ){
bool toReport = false;

if (healthSystemMemoryFix && (time + ClinicalModel::hsMemory() <= sim::ts0()))
toReport = true;
else if (!healthSystemMemoryFix && (time + ClinicalModel::hsMemory() < sim::ts0()))
toReport = true;

if(toReport) {
infectionType = human.withinHostModel->getInfectionType();

report ();
Expand Down
8 changes: 7 additions & 1 deletion model/Clinical/Episode.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "Host/WithinHost/Infection/Infection.h"
#include "mon/AgeGroup.h"
#include "mon/info.h"
#include "util/ModelOptions.h"
#include <ostream>

namespace OM {
Expand Down Expand Up @@ -85,7 +86,10 @@ class Episode{
ageGroup(),
cohortSet(0),
state(NONE)
{};
{
healthSystemMemoryFix = util::ModelOptions::option (util::HEALTH_SYSTEM_MEMORY_FIX);
};

~Episode();

/// Report anything pending, as on destruction
Expand Down Expand Up @@ -124,6 +128,8 @@ class Episode{
* hospital, i.e. with EVENT_IN_HOSPITAL, only), SEQUELAE and DIRECT_DEATH
* (both in and out of hospital). */
void report();

bool healthSystemMemoryFix = false;
};

} }
Expand Down
6 changes: 4 additions & 2 deletions model/util/ModelOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace OM { namespace util {
codeMap["INDIRECT_MORTALITY_FIX"] = INDIRECT_MORTALITY_FIX;
codeMap["VACCINE_GENOTYPE"] = VACCINE_GENOTYPE;
codeMap["CFR_PF_USE_HOSPITAL"] = CFR_PF_USE_HOSPITAL;
codeMap["HEALTH_SYSTEM_MEMORY_FIX"] = HEALTH_SYSTEM_MEMORY_FIX;
}

OptionCodes operator[] (const string s) {
Expand Down Expand Up @@ -120,8 +121,9 @@ namespace OM { namespace util {
// State of all default options:
bitset<NUM_OPTIONS> defaultOptSet;
defaultOptSet.set (MAX_DENS_CORRECTION);
defaultOptSet.set (INNATE_MAX_DENS);
defaultOptSet.set (INDIRECT_MORTALITY_FIX);
defaultOptSet.set (INNATE_MAX_DENS);
defaultOptSet.set (INDIRECT_MORTALITY_FIX);
defaultOptSet.set (HEALTH_SYSTEM_MEMORY_FIX);

// Set options to defaults, then override any given in the XML file:
options = defaultOptSet;
Expand Down
9 changes: 9 additions & 0 deletions model/util/ModelOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,15 @@ namespace OM { namespace util {
*/
VACCINE_GENOTYPE,

/** This makes the health system memory behaves as expected. With this
* option, specifying a health system memory of 30 days means that a
* new clinical case will be reported as early as 30 days after the
* initial case (6 time-steps), rather than 35d (7 time-steps)
* currently. Setting the health system memory to 5 days allows the
* model to report a new clinical case every time step.
*/
HEALTH_SYSTEM_MEMORY_FIX,


// Used by tests; should be 1 more than largest option
NUM_OPTIONS,
Expand Down
1 change: 1 addition & 0 deletions util/example/example_scenario.xml
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@
<ModelOptions>
<option name="INNATE_MAX_DENS" value="false"/> <!-- MANDATORY WITH THE BASE MODEL DO NOT REMOVE -->
<option name="INDIRECT_MORTALITY_FIX" value="false"/> <!-- MANDATORY WITH THE BASE MODEL DO NOT REMOVE -->
<option name="HEALTH_SYSTEM_MEMORY_FIX" value="false"/> <!-- MANDATORY WITH THE BASE MODEL DO NOT REMOVE -->
</ModelOptions>

<!-- Clinical model parameters.
Expand Down

0 comments on commit 476e63a

Please sign in to comment.