Connection Statistics
Last updated
Was this helpful?
Last updated
Was this helpful?
Since we have map and dots, they should be colored according to their connectivity status. Country data can be static (statistics is being imported manually via CSV file) or realtime (which is updated much more often from different sources).
To avoid complex calculations for every request we aggregate information for every day and week per school/country into corresponding models. Aggregation models are being updated in background every few hours.
connectivity speed - bytes per second
connectivity latency - milliseconds
Logic for connectivity and coverage calculations is described with draw.io scheme. In general, every single school mapping depends from country overall status (for example realtime data availability or static connection information provided).
As already said, information is being aggregated on different levels from most granular (real time entries) to less detailed (weekly statistics for country). Entry point for data aggregations is proco.connection_statistics.tasks.update_real_time_data
task.
First, realtime data is being fetched from all possible sources: UNICEF database, Brazil api (simet.nic.br), etc.
for every country aggregation task is being executed in parallel
For every school having realtime data, daily data is being populated (speed = average value from all realtime values for date)
All daily entries from schools are being aggregated to country daily statistics row. Same logic here, speed for country equals to average between all country schools.
Weekly school level aggregation is being performed: we update week entry for every school with average value from past seven days based on daily statistics.
Country level weekly entry is being updated. We take all weekly entries for school level and calculate average between them. And also, we update country connectivity and coverage statuses based on mapping above.
Invalidate all cached records that can be potentially affected: global statistics, countries list, country details, schools list.