interventions.diagnostics

interventions.diagnostics

Diagnostic products and delivery for TB testing.

Classes

Name Description
CAD CAD chest X-ray – simple, no age/HIV stratification.
Dx TB diagnostic product defined by a DataFrame of state-to-result probabilities.
DxDelivery Delivers a diagnostic product to eligible agents.
FujiLAM FujiLAM – HIV-stratified, age-stratified.
OralSwab Oral swab – age-stratified, TB-state-stratified.
Xpert Xpert MTB/RIF – age-stratified (child/adult), TB-state-stratified.

CAD

interventions.diagnostics.CAD(df=None, datafile=None, **kwargs)

CAD chest X-ray – simple, no age/HIV stratification.

Dx

interventions.diagnostics.Dx(df, hierarchy=None, **kwargs)

TB diagnostic product defined by a DataFrame of state-to-result probabilities.

Parameters

Name Type Description Default
df DataFrame with required columns (state, result, probability) and optional filter columns (age_min, age_max, hiv). Only include filter columns relevant to the specific diagnostic. required
hierarchy List of result strings in priority order, e.g. [‘positive’, ‘negative’]. Agents in states not listed in df get the last entry (default negative). None

DxDelivery

interventions.diagnostics.DxDelivery(
    product,
    coverage=1.0,
    eligibility=None,
    result_state='diagnosed',
    care_seeking_multiplier=1.0,
    result_validity=None,
    **kwargs,
)

Delivers a diagnostic product to eligible agents.

Handles eligibility (default: sought care, not yet diagnosed, alive), coverage filtering, result-state setting, and false-negative retry logic.

Parameters

Name Type Description Default
product A Dx product instance. required
coverage Fraction of eligible agents tested (float or ss.Dist). Default 1.0. 1.0
eligibility Callable (sim) -> uids. Default: sought_care & ~diagnosed & alive. None
result_state People-state name set True on positive result. Default ‘diagnosed’. 'diagnosed'
care_seeking_multiplier Multiplier on care-seeking rate for false negatives. Default 1.0. 1.0

Methods

Name Description
shrink Delete temporary results
step Main step method: see submethods for details.
step_administer Administer diagnostic product to selected UIDs and return results.
step_expire_results Reset result states that have exceeded the validity window
step_select_eligible Return eligible UIDs for this step.
step_update_states Update states associated with diagnostic results
update_results Store results
shrink
interventions.diagnostics.DxDelivery.shrink()

Delete temporary results

step
interventions.diagnostics.DxDelivery.step()

Main step method: see submethods for details.

step_administer
interventions.diagnostics.DxDelivery.step_administer()

Administer diagnostic product to selected UIDs and return results.

step_expire_results
interventions.diagnostics.DxDelivery.step_expire_results()

Reset result states that have exceeded the validity window

step_select_eligible
interventions.diagnostics.DxDelivery.step_select_eligible()

Return eligible UIDs for this step.

step_update_states
interventions.diagnostics.DxDelivery.step_update_states()

Update states associated with diagnostic results

update_results
interventions.diagnostics.DxDelivery.update_results()

Store results

FujiLAM

interventions.diagnostics.FujiLAM(df=None, datafile=None, **kwargs)

FujiLAM – HIV-stratified, age-stratified.

OralSwab

interventions.diagnostics.OralSwab(df=None, datafile=None, **kwargs)

Oral swab – age-stratified, TB-state-stratified.

Xpert

interventions.diagnostics.Xpert(df=None, datafile=None, **kwargs)

Xpert MTB/RIF – age-stratified (child/adult), TB-state-stratified.