Calculation of cellular signal indicator in web interface

The Particle web interface of a Boron shows in the vitals section a cellular signal indicator:
The network section of the raw json vitals data looks like this:


What algorithm is used to calculate the number of bars from this data?