Quality is not inherently factored into standard input_count: When you use input_count on a decider combinator, it counts the total number of a specific item, regardless of its quality tier (Normal, Uncommon, Rare, etc.).
The code is written to load stats via:
local stats = force.get_item_production_statistics(getPlayerSurface(player))
The test below shows results for one player who complained that his science packs were not being counted correctly and shows 2000, when they are much higher. The manual test below show the bug.
The mod is Brave-New-Oarc and using the stats button in the gui, which runs lib/stats_gui.lua function buildStatsTable.
Results of test
stats.input_counts["space-science-pack"]
2000
stats.get_input_count({name="space-science-pack", quality="normal"})
372000
stats.get_input_count({name="space-science-pack", quality="uncommon"})
173000
stats.get_input_count({name="space-science-pack", quality="rare"})
21000
stats.get_input_count({name="space-science-pack", quality="epic"})
2000
stats.get_input_count({name="space-science-pack", quality="legendary"})
0