Algoritham to caluculate State of Charge(SOC) & State of Health (SOH) of the LI-Ion Battery?
The scope of your question is very large, but I will try to give you an example of a relatively simple setup that you might be able to apply to your project.

My electric battery powered lawn mower has a gauge on it that I would call a coulomb counter and here is how it works:  

First I had to install a current shunt in series with the motor on the negative wire after it exited the motor, but before the wire entered the battery.  The current shunt is just a piece of metal with a known resistance so that when current passes through it, your gauge can measure the voltage drop and then convert that to a measured current.  The gauge also measures the battery's voltage at the same time.

With the voltage and current along with time, the gauge, or coulomb counter can now display the amp hours used, the power being used in watts, along with other measurements such as volage.  My particular gauge also has the feature where you can program in the battery's capacity so the gauge can then tell you the percentage of battery used as well.  If you wire in the battery charger in the reverse the load and ensure it goes through the current shunt, this gauge can also keep track of where you are with your battery charging in terms of how full the battery is.

By measuring the current leaving the battery along with time, you get a much more accurate method of state of charge reporting for battery versus just measuring the battery voltage, which is not as accurate.