bool DiagnosticTreatNeg::positiveTestResult()
    {
        LOG_DEBUG_F("Individual %d is taking the test \n", parent->GetSuid().data);
        
        //This test is the same as smear, but if you are smear neg you can get a different intervention

        // Apply diagnostic test with given specificity/sensitivity
        IIndividualHumanTB2* tb_ind = nullptr;
        if(parent->QueryInterface( GET_IID( IIndividualHumanTB2 ), (void**)&tb_ind ) != s_OK)
        {
            LOG_WARN("DiagnosticTreatNeg works with TB sims ONLY");
            throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "parent", "IIndividualHumanTB2", "IIndividualHuman" );
        }

        bool activeinf = tb_ind->HasActiveInfection() && !tb_ind->HasActivePresymptomaticInfection();

        if (activeinf)
        {
            // True positive (sensitivity), or False positive (1-specificity)
            bool smearpos = tb_ind->IsSmearPositive();
            bool positiveTest = applySensitivityAndSpecificity( smearpos );
            LOG_DEBUG_F("Individual %d is active %d, smearpos %d, Test sensitivity is %f, result is %d \n", parent->GetSuid().data, activeinf, smearpos, (float) base_sensitivity, positiveTest);
            return positiveTest;
        }
        else
        { 
            LOG_DEBUG("Got a negative result \n");
            return false;
        }
    }
    bool StiCoInfectionDiagnostic::positiveTestResult()
    {
        LOG_DEBUG("Positive test Result function\n");

        IIndividualHumanSTI* sti_ind = nullptr;
        if(parent->QueryInterface( GET_IID( IIndividualHumanSTI ), (void**)&sti_ind ) != s_OK)
        {
            throw QueryInterfaceException( __FILE__, __LINE__, __FUNCTION__, "parent", "IIndividualHumanSTI", "IIndividualHuman" );
        }
        bool activeinf = sti_ind->HasSTICoInfection();

        // always return negative if the person is not infected, intended to be used with GroupEventCoordinator
        // TODO: allow to distribute Smear diagnostic to non-infected individuals?

        bool positiveTest = applySensitivityAndSpecificity( activeinf );
        return positiveTest;

    }
Beispiel #3
0
    bool HIVSimpleDiagnostic::positiveTestResult()
    {

#ifdef ENABLE_TBHIV    
        IIndividualHumanHIV* HIVpersonptr = nullptr;

        if (parent->QueryInterface(GET_IID(IIndividualHumanHIV), (void**)&HIVpersonptr) != s_OK)
        {
            throw QueryInterfaceException(__FILE__, __LINE__, __FUNCTION__, "parent", "IIndividualHumanHIV", "IIndividualHumanContext");
        }

        // Apply diagnostic test with given specificity/sensitivity
        bool  infected = HIVpersonptr->HasHIV();

        // True positive (sensitivity), or False positive (1-specificity)

        return applySensitivityAndSpecificity(infected);

        
#else
        return SimpleDiagnostic::positiveTestResult();
#endif

    }