1. A computerized method for detecting and quantifying chemicals in a continuously sampled liquid or gas sample stream, comprising: receiving, by a computing device, a sample measurement comprising a digitized spectroscopic profile; calculating, by the computing device, a multivariate multistage background model comprising a first model that models a first time effect, a second model that models a second time effect that is different than the first time effect, or both; generating, by the computing device, a background corrected sample measurement based on the sample measurement and the multivariate multistage background model; and executing, by the computing device, a multivariate multistage library search, fault detection, and quantification algorithm to identify one or more primary chemicals in the background corrected sample measurement, the algorithm comprising: identifying one or more candidate chemicals in the background corrected sample measurement based on a multivariate statistical process control in comparison of the background corrected sample measurement to a spectral reference library; and performing at least one of (i) identifying a first primary chemical based on a focused chemical evaluation of the one or more candidate chemicals or (ii) quantifying the first primary chemical based on the focused chemical evaluation of the one or more candidate chemicals.