Add support for getting data OONI Data Kraken API #892
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current target is only the MAT.
We support an environment flag for getting the data from the aggregation API implement in ooni/data, see: ooni/data#45.
Here is a working example on how to run this:
.env.local
.env.local
yarn run dev
Example live preview link: https://explorer-3ljbnbf5b-ooni1.vercel.app/chart/mat?probe_cc=ID&since=2023-10-23&until=2023-11-23&time_grain=day&axis_x=measurement_start_day&axis_y=domain&test_name=web_connectivity
Notes about the implementation
For backward compatibility we implement an aggregation API which is compliant with the current API. The only difference is that it also supports a new field called
anomaly_threshold
which is set by default to0.7
and used to determine if a particular measurement is to be considered anomalous or not based on theloni
values.It does however already support returning extra data which could eventually be used in an alternative future MAT view.
The schema of the returned data format can be inspected here: https://github.com/ooni/data/blob/5dd30c472da7a6eaa19071c5a49a510693e03f19/oonidata/fastapi/routers/aggregation.py#L43.
The interesting stuff is inside of the
loni_*
keys.These are aggregate loni based likelyhood of blocking estimates calculated using the new analysis engine and are values that go from 0-1, where 1 indicates our belief in that particular blocking method being implemented.
Other new interesting keys are:
observation_count
: the unique count of observations used to determine a particular aggregate loni valuevantage_point_count
: a guess of the number of unique vantage points that contributed to this experiment result (estimated viaCOUNT(DISTINCT location_network_type, location_network_asn, location_network_cc, location_resolver_asn)
)Please note that the experiment results tables only contain data from the last few months and contrary to observation tables is not being updated regularly.
🆕 you can now view the LoNI values by clicking on a bar in the MAT