It's like you've smoked
cigarettes
Step 1: I converted AQI back to PM 2.5 particle concentration. That's the number of particles in the air that are a certain size. For this operation I used the same equation as the Air Now calculator.
Step 2: based on this research, the health impact of a particle concentration of 22μg/m3 per 24 hours is equivalent to about 1 cigarette. I divided the concentration from step 1 by 22 and 24, then multiplied by the number of hours exposed.
Step 3: the final result is rounded to the nearest integer. In converting AQI to PM2.5 we lose some information. Different types of air pollution can also be more or less harmful than cigarettes. Because we are looking at impact to health, we aren't measuring something precise to begin with. An integer makes it more clear that the result is an estimate.
Feedback or questions? Please leave an issue on GitHub. For more information about why I built this the way I did, read this.