= Implementation details
Create a way to fetch the number of views to articles that embed files that were uploaded during the event, and display them as 'average daily views'.
The query should:
* Fetch all files that were uploaded to Commons **and** to the local wikis specified in the event setting (the system currently //only// considers uploads to commons; this new method needs to add the ability to fetch the list of files uploaded to the local wikis too)
** There is a task to track uploads from the individual wiki (expanding the collection from Commons only) at task {T206819}. That task is slightly broader (to enable using all metrics about uploads to show local wiki as well) but depending on your implementation approach, may need to be done before this current task.
** There's another related task at {T215356}
* For each of those uploaded files, get the articles they are used/embedded in. Article list should be unique (even if two files were uploaded to the same article, the article should be counted once)
* For each of those articles, fetch the daily page views, starting from the start date of the event and continuing to a maximum of 30 days:
** If the event was fewer than 30 days ago, use as many days as are available, total up the daily views and divide by the number of available days to get the average.
** If the event was more than 30 days ago, use pageviews from the past 30 days only and divide by 30 to get the average. (I.e.,begin from the start-date of the event and count forward to the last update; the time period = the time from the start of the event to the last update OR 30 daysuse as many days as are available, whichever is shorter.)total up the daily views and divide by the number of available days to get the average.
** If the event was more than 30 days ago, use pageviews from the MOST RECENT 30 days only and divide by 30 to get the average.
** If no days are available (i.e., if it's the first day), then display "n/a" for "not available".
* For the **Files Uploaded** reports (e.g., T212547), we'll report pageview totals for each individual file. For the **Event Summary** reports (e.g., T205561), the figure reported will be the grand total of pageviews for all uploaded files.
= Deeper dive
===Why we're doing this
Organizers, their sponsors and partners want to understand the impact of their work. One main way to do this for files uploaded is to see the number of pageviews those files get on the various article pages to which they are added. In our discussions, it has become clear that we can't get an accurate cumulative pageviews figure because we don't know the dates when specific files were added to specific articles. So instead, we will be providing a figure for "average daily pageviews".
=== Parameters
- **All filetypes:** The figure will track images, video files, audio files and other upload types.
- **Uploads to Commons //and// local Wikipedias: ** We will track uploads to all wikis, so long as they are specified as wikis of interest for the event.
- **Pageviews on all wikis (not just those specified): **The Main space articles whose pageviews we're counting can be on any wiki; the wikis do not need to be specified as wikis of interest in setup.
- **30-day average** To smooth out daily or weekly fluctuations