A total of 11 dashboard widgets use imon-data in one form or the other. These changes port them to the new API with a slightly different structure. The old API is still seeding/fetching/the works, until further notice.
Structural Changes
API-related
No more: score, rank, percent, accessUrl, or imageUrl.
Provider data for indicators are yet to be added.
Data points link to indicators with admin names, not IDs.
min and max for each indicator were also removed, but since they were needed for some visualizations (like imon-percent, esp with the absence of percent as well), they are now being calculated by imon-data and represent min and max recorded values for this indicator in all the data provided.
Collections
v2: IMonData (all the data points), IMonRecent* (only most recent data point for every country + indicator combination), IMonIndicators, IMonCountries.
v1: IMonDataD, IMonIndicatorsD, IMonCountriesD. (D for deprecated)
Schemas for each can be found in packages/imon-data/imon_data.js.
Subscriptions
v2:
imon_data_v2: function(countries, indicators, recentOnly)
countries / indicators can be either String (code/adminName, or 'all') or Array.
recentOnly is Boolean. If set to true, it will return records from IMonRecent. If false (you want historical data), it will return records from IMonData.
imon_indicators_v2: function()
Returns all indicator data from IMonIndicators.
imon_countries_v2: function()
Returns all country (meta) data from IMonCountries.
v1: Only change is that they now return v1 collections (with the D).
Changed Widgets
access-index:
No longer relies on imon-data (or any Mongo collections); the rank/score data have been frozen in rankData.csv inside the package folder and are parsed on the server and retrieved on the client through a Meteor.method called rankData.
broadband-cost
connection-speed
percent-on-broadband
percent-online
imon-barchart
imon-choropleth
imon-percent
imon-scatter
imon-speedometer
imon-valuetrend
Unresolved Issues
Since provider data are yet to be added to /v2/indicators, the old indicators collection (IMonIndicatorsD) is being used to set the indicator value (in the top right corner of the widget) in the imon widgets that change the displayed source name for each indicator change. (e.g imon-barchart, etc)
Notes
IMonRecent is not seeded with the other collections, but with every subscription, the publish method finds the most recent value (by recorded date) for the requested country + indicator combinations and upserts it to IMonRecent before returning. The reason we even have IMonRecent is because simply getting IMonData for the country + indicator combinations for a large number of countries (say, 'all' for imon-choropleth or imon-scatter) took a lot of time + made the dashboard on the client very heavy because it sent all historical data for all countries per selected indicator(s).
I'm not sure, though, whether the best approach for IMonRecent is to keep it as it is (updated in small parts in the publish method) or calculate it once per fetch (in bulk) on the server.
Again, sorry about the branching issue. There are no conflicts, however. Please let me know if there are any widgets that use imon-data that I didn't notice.
Summary
A total of 11 dashboard widgets use
imon-data
in one form or the other. These changes port them to the new API with a slightly different structure. The old API is still seeding/fetching/the works, until further notice.Structural Changes
API-related
score
,rank
,percent
,accessUrl
, orimageUrl
.min
andmax
for each indicator were also removed, but since they were needed for some visualizations (likeimon-percent
, esp with the absence ofpercent
as well), they are now being calculated byimon-data
and represent min and max recorded values for this indicator in all the data provided.Collections
IMonData
(all the data points),IMonRecent
* (only most recent data point for every country + indicator combination),IMonIndicators
,IMonCountries
.IMonDataD
,IMonIndicatorsD
,IMonCountriesD
. (D for deprecated) Schemas for each can be found inpackages/imon-data/imon_data.js
.Subscriptions
imon_data_v2
: function(countries, indicators, recentOnly)countries
/indicators
can be either String (code/adminName, or 'all') or Array.recentOnly
is Boolean. If set totrue
, it will return records fromIMonRecent
. Iffalse
(you want historical data), it will return records fromIMonData
.imon_indicators_v2
: function() Returns all indicator data fromIMonIndicators
.imon_countries_v2
: function() Returns all country (meta) data fromIMonCountries
.Changed Widgets
access-index
:imon-data
(or any Mongo collections); the rank/score data have been frozen inrankData.csv
inside the package folder and are parsed on the server and retrieved on the client through a Meteor.method calledrankData
.broadband-cost
connection-speed
percent-on-broadband
percent-online
imon-barchart
imon-choropleth
imon-percent
imon-scatter
imon-speedometer
imon-valuetrend
Unresolved Issues
IMonIndicatorsD
) is being used to set the indicator value (in the top right corner of the widget) in the imon widgets that change the displayed source name for each indicator change. (e.gimon-barchart
, etc)Notes
IMonRecent
is not seeded with the other collections, but with every subscription, the publish method finds the most recent value (by recorded date) for the requested country + indicator combinations and upserts it to IMonRecent before returning. The reason we even haveIMonRecent
is because simply gettingIMonData
for the country + indicator combinations for a large number of countries (say, 'all' forimon-choropleth
orimon-scatter
) took a lot of time + made the dashboard on the client very heavy because it sent all historical data for all countries per selected indicator(s).I'm not sure, though, whether the best approach for
IMonRecent
is to keep it as it is (updated in small parts in the publish method) or calculate it once per fetch (in bulk) on the server.imon-data
that I didn't notice.