A computer-implemented method for determining a concentration of a component of an electrolyte in a lithium-ion or for a lithium-ion cell is provided. The method includes providing, to a spectrometer, instructions to capture a spectrum of a sample solution of the electrolyte and generate a signal. The method includes analyzing the signal to determine one or more spectral features of the spectrum. The method includes preparing a database of spectra corresponding to solutions having predetermined concentrations of the component of the electrolyte wherein the database includes a plurality for spectral features for each solution. The method further includes determining a machine learning (ML) model using the database of spectra. The method includes determining the concentration of the component of the electrolyte in the sample solution using the machine learning model.