pH, hardness, salinity, nitrates and carbonates, fluoride, arsenic and other heavy metals present in water decides its quality. We should go for titration method for some chemicals and for some other there may be instruments - they just provide the values. If you have the idea and also literature available, please share.