Using viral load and epidemic dynamics to optimize pooled testing in resource constrained settings