Module:NPP backlog
Appearance
This module retrieves the size of the backlog at new pages patrol at the start (UTC) of a given day. It uses the data compiled by User:MusikBot at Wikipedia:New pages patrol/Backlog chart/daily.
Note that the data is limited to the last c. 6 months.
Usage
Number of articles in the backlog on date (YYYY-MM-DD
format):
{{#invoke:NPP backlog|articles|date}}
Difference between N and the articles backlog on date:
{{#invoke:NPP backlog|diff|N|date}}
If there is no data for date, the module will attempt to estimate by working backwards to the first date with data available. By default, this estimation assumes a one-day difference is being calculated. If not, specify a delta value in days:
{{#invoke:NPP backlog|diff|N|date|delta}}
See also
local p = {};
local data = mw.loadJsonData("Wikipedia:New pages patrol/Backlog chart/daily")
local backlog = { }
for k,v in ipairs(data) do
backlog[v["date"]] = v["value"]
end
function p._articles(day1, day2)
if day2 == nil then
return backlog[day1] or 0
else
if (backlog[day1] == nil or backlog[day2] == nil) then
return 0
else
return backlog[day1] - backlog[day2]
end
end
end
function p.articles(frame)
local templateArgs = frame.args
local day1 = templateArgs[1] or os.date("%Y-%m-%d")
local day2 = templateArgs[2] or nil
return p._articles(day1, day2)
end
return p