Пример #1
0
 void HIVSimpleDiagnostic::ActOnResultsIfTime()
 {
     // This can happen immediately if days_to_diagnosis is initialized to zero.
     if ( days_to_diagnosis <= 0 )
     {
         if( result_of_positive_test )
         {
             LOG_DEBUG_F( "Individual %d tested positive.\n", parent->GetSuid().data );
             if( SMART_DRAW( treatment_fraction ) )
             {
                 positiveTestDistribute();
             }
             else
             {
                 // this person doesn't get the positive test result
                 // because they defaulted / don't want treatment
                 onPatientDefault();
                 expired = true;
             }
         }
         else
         {
             LOG_DEBUG_F( "Individual %d tested negative.\n", parent->GetSuid().data );
             onNegativeTestResult();
         }
     }
 }
Пример #2
0
    void GenericDrug::SimpleUpdate(float dt)
    {
        // Do everything based on fast_component ignoring slow_component
        LOG_DEBUG_F("Drug compartment = %0.2f\n", fast_component);

        // Time Decay
        if ( fast_component > 0 ) { fast_component -= dt; }

        // New Doses - remaining_doses = -1 implies infinite doses
        if ( remaining_doses != 0 )
        {
            dosing_timer -= dt;
            LOG_DEBUG_F("Remaining doses = %d, Dosing timer = %0.3f\n", remaining_doses, dosing_timer);
            if ( dosing_timer <= 0 )
            {
                // DJK: Remove or fix fraction_defaulters.  It only makes sense with remaining_doses=1 <ERAD-1854>
                if( SMART_DRAW( fraction_defaulters ) )
                {
                    // Assume uniformly distributed dropout times, cf. Fig 3 from Kruk 2008 Trop Med Int Health 13:703
                    fast_component = Probability::getInstance()->fromDistribution( DistributionFunction::UNIFORM_DURATION, 1, fast_decay_time_constant );
                    LOG_DEBUG_F("Individual dropout time = %0.2f\n", fast_component);
                }
                else
                {
                    fast_component = fast_decay_time_constant;
                }
                ResetForNextDose(dt);
                LOG_DEBUG_F("Distributed next dose: remaining doses = %d, Drug compartment = %0.2f, Dosing timer = %0.3f\n", remaining_doses, fast_component, dosing_timer);
            }
        }

        // Efficacy
        if ( fast_component > 0 )
        {
            current_efficacy = 1.0;
            current_concentration = 1.0;
        }
        else
        {
            LOG_DEBUG("Duration of drug effectiveness is finished.\n");
            current_efficacy = 0;
            current_concentration = 0.0;
            if (remaining_doses == 0) // remaining_doses = -1 implies infinite doses
            {
                LOG_DEBUG("Effectiveness of last dose is finished. Expiring drug.\n");
                Expire();
            }
        }
    }
Пример #3
0
    //if negative test result, either distribute the negative test intervention now, or note you got a negative test and count your days_to_diagnosis down
    void
    DiagnosticTreatNeg::onNegativeTestResult()
    {
        LOG_DEBUG("Negative test Result function\n");

        m_gets_positive_test_intervention = false;
        LOG_DEBUG_F("Reset test result flag to %d \n", m_gets_positive_test_intervention);

        if( !SMART_DRAW( getTreatmentFractionNegative() ) )
        {
            onPatientDefault();
            expired = true;         // this person doesn't get the negative intervention despite the negative test
        }
        else if ( days_to_diagnosis <= 0 ) 
        { 
            negativeTestDistribute(); // since there is no waiting time, distribute intervention right now
        }
        //else we have to wait for days_to_diagnosis to count down until person gets negative intervention
    }
Пример #4
0
    // private/protected
    bool
    NodeLevelHealthTriggeredIV::qualifiesToGetIntervention(
        const IIndividualHumanEventContext * const pIndividual
    )
    {
        bool retQualifies = demographic_restrictions.IsQualified( pIndividual );

        //OK they passed the property and age test, now check if they are part of the demographic coverage
        if (retQualifies)
        {
            LOG_DEBUG_F("demographic_coverage = %f\n", getDemographicCoverage());
            if( !SMART_DRAW( getDemographicCoverage() ) )
            {
                m_disqualified_by_coverage_only = true;
                LOG_DEBUG_F("Demographic coverage ruled this out, m_disqualified_by_coverage_only is %d \n", m_disqualified_by_coverage_only);
                retQualifies = false;
            }
        }

        LOG_DEBUG_F( "Returning %d from %s\n", retQualifies, __FUNCTION__ );
        return retQualifies;
    }