dimagi/commcare-hq — pull request #1042 by snopoke (2013-08-28 16:15:45+00:00)
Title: create report data source for AggregateStockStatusReport

building on https://github.com/dimagi/commcare-hq/pull/1030. Relevant commit: https://github.com/dimagi/commcare-hq/commit/6c985d43fe2b0dbaf3d4722c10ff4b2d2a987d6f

This can be used to get indicators like:

"40% of your facilities are stocked out of commodity X"
```python
config = {
'domain': 'commtrack-public-demo',
'product_id': '123'
}
supply_point_products = StockStatusDataSource(config).get_data()
supply_points_stockout = filter(lambda x: x['category'] == 'stockout', supply_point_products)
percentage_stockout = 100.0 * len(supply_point_products) / len(supply_point_stockout)
```