A small UX suggestion for AQS queries:
The timestamp format require day (YYYYMMDD) in the request, even though the Commons Impact Metrics granularities are only monthly. It's ambiguous what happens if I put in any day besides 01 (does it give partial months, or round to the nearest month?), and, in general, feels inelegant for it to be invalid to supply a month without a day, when that is the data being requested. It is also ambiguous what the timestamp means in the response. For example, we have "timestamp": "2024050100", which I understand to mean the data for the month of May—but what it really says is midnight on the morning of May 1 (so maybe it's open to interpretation whether this means the month of May or the month ending at 00:00 on May 1, i.e. April).
Consider these use cases:
- 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/20240501/20240630
- Asking for May 1 - June 30 gives the months of May and June as expected.
- 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/20240502/20240630
- Once you ask for data starting from May 2, you get only the month of June.
- 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/20240501/20240502
- On the other hand, asking only for May 1-May 2 gives you the full month of data. It seems what matters is not whether you specify a meaningful date range at all, but whether 2024050100 is in your range at or after your start timestamp.
- 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/20240501/20240601
- However, the end timstamp is not inclusive in the same way as the start, since May 1-June 1 gives only may and not June
- 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/20240601/20240631
- While it's manageable by a savvy user, another issue this causes is that now I have write requests that know how many days are in the month being requested, or I might run into an error such as this one if I just try to apply 31 for all DD values. (Which leads to other pitfalls—2024 was a leap year, do I need to account for that, too?)
I think all of this ambiguity is solved if timestamps are only YYYYMM in both requests and responses.