Page MenuHomePhabricator

Commons Impact Metrics: Fix documentation for the all-wikis option
Open, MediumPublic3 Estimated Story PointsFeature

Description

For the 6 endpoints that use the {wiki} parameter, there should be a way to get data for all wikis. I am hoping there is a way and it is just not clear in the documentation, but I tried using all, any, global, total, *, etc. in this parameter to no avail. I think any of these, or just allowing the user to omit the parameter, would be a reasonable way to get the cumulative total across all wikis. While it can be useful to have a breakdown per wiki, I would argue that for metrics, having a top-line stat of all views is actually more important than the stats for any individual wiki. And if there is not an API way to get the cumulative total, the only other way I can see to do it would be to get the list of all wiki codes and do the 200+ queries to check them all and add the results up—not very user-friendly!

As an example, I would like to be able to successfully perform a query such as this:

https://wikimedia.org/api/rest_v1/metrics/commons-analytics/pageviews-per-category-monthly/Media_contributed_by_the_Digital_Public_Library_of_America/deep/all/00000101/99991231

Event Timeline

Dominicbm renamed this task from Commons Impact Metrics: to Commons Impact Metrics: Way to return data for all wikis.Jul 18 2024, 6:05 PM
Aklapper changed the subtype of this task from "Task" to "Feature Request".Jul 18 2024, 7:16 PM

It is possible! Try:
https://wikimedia.org/api/rest_v1/metrics/commons-analytics/pageviews-per-category-monthly/Media_contributed_by_the_Digital_Public_Library_of_America/deep/all-wikis/00000101/99991231

Now, because of you creating this task I saw that the documentation for the wiki field is cut out. It's actually cutting out the part where the "all-wikis" option is mentioned.
We can use this task as a bug report to fix that. It is a simple documentation change.

VirginiaPoundstone subscribed.

@mforns added this to our current sprint so we can make a quick fix to the docs. I think this will be a very popular use case.

It is possible! Try:
https://wikimedia.org/api/rest_v1/metrics/commons-analytics/pageviews-per-category-monthly/Media_contributed_by_the_Digital_Public_Library_of_America/deep/all-wikis/00000101/99991231

Now, because of you creating this task I saw that the documentation for the wiki field is cut out. It's actually cutting out the part where the "all-wikis" option is mentioned.
We can use this task as a bug report to fix that. It is a simple documentation change.

Perfect! I had hoped this was just a documentation issue, but couldn't tell. That's exactly what I was looking for.

mforns renamed this task from Commons Impact Metrics: Way to return data for all wikis to Commons Impact Metrics: Fix documentation for the all-wikis option.Jul 23 2024, 4:43 PM

The previous MR to fix swagger documentation looked good and it is already merged (deployment is pending) but I have found that same documentation needs to be fixed at https://doc.wikimedia.org/generated-data-platform/aqs/analytics-api/reference/commons.html. Same issue there.

@Sfaci, thanks for reviewing and merging!
The swagger changes are the ones that, after the deployment, will populate the docs site.
So, I think we just need to deploy no?

Yes! Deployment is the only pending thing here. The files that are generated when running make docs are the ones that are served by the definition endpoint.

The other documentation issue I mentioned doesn't belong to the service repository/code so it can be done separately with a follow up ticket at another time.

My faul!
It seems we don't need a follow up ticket to fix this at https://doc.wikimedia.org/generated-data-platform/aqs/analytics-api/reference/commons.html because that part is embedded automatically in this site using the API specification that the service serves

VirginiaPoundstone lowered the priority of this task from High to Medium.Aug 28 2024, 4:14 PM
mforns set the point value for this task to 3.Sep 2 2024, 2:39 PM

This just needs deployment.