  [abridged] In large-scale time-domain surveys, the processing of data, from
procurement up to the detection of sources, is generally automated. One of the
main challenges is contamination by artifacts, especially in regions of strong
unresolved emission. We present a novel method for identifying candidates for
variables and transients from the outputs of such surveys' data pipelines. We
use the method to systematically search for novae in iPTF observations of the
bulge of M31. We demonstrate that most artifacts produced by the iPTF pipeline
form a locally uniform background of false detections approximately obeying
Poissonian statistics, whereas genuine variables and transients as well as
artifacts associated with bright stars result in clusters of detections, whose
spread is determined by the source localization accuracy. This makes the
problem analogous to source detection on images produced by X-ray telescopes,
enabling one to utilize tools developed in X-ray astronomy. In particular, we
use a wavelet-based source detection algorithm from the Chandra data analysis
package CIAO. Starting from ~2.5x10^5 raw detections made by the iPTF data
pipeline, we obtain ~4000 unique source candidates. Cross-matching these
candidates with the source-catalog of a deep reference image, we find
counterparts for ~90% of them. These are either artifacts due to imperfect PSF
matching or genuine variable sources. The remaining ~400 detections are
transient sources. We identify novae among these candidates by applying
selection cuts based on the expected properties of nova lightcurves. Thus, we
recovered all 12 known novae registered during the time span of the survey and
discovered three nova candidates. Our method is generic and can be applied for
mining any target out of the artifacts in optical time-domain data. As it is
fully automated, its incompleteness can be accurately computed and corrected
for.
