{{response.title=base_title + ': ' + T('Popularity service testing page')}} {{ def link(a, **kwargs): return A(a, _href=a, **kwargs) pass }} {{extend 'layout.html'}} {{import json}}

{{=T('OneZoom popularity service, test page')}}

{{=T('Test the values from the OneZoom API')}}

{{=XML(T('This compares existing values from the OneZoom popularity API with values obtained by directly querying the wiki APIs. These direct queries will return more recent estimates of the raw popularity, both for the target taxon and parents which have wikidata entries. These parent raw popularities are a major contributor to the final (phylogenetic) popularity of a species (the other contributor, the descendants of a target taxon, are not calculated here as they can be very large for higher-level taxa: however, they should be relatively small for species, which should only have a few subspecies underneath them).'))}}

{{if request.vars.key:}} {{pass}} {{if request.vars.ott:}} {{else:}} {{=T('(Grey wolf/domestic dog,')}} Canis lupus) {{pass}}
{{if error:}}

{{=T(error)}}

{{pass}}
{{if taxa != False:}} {{=T('for page visits between the start of')}} {{=T('and end of')}} {{if taxa:}} {{headers = sorted(headers_index, key=lambda key: headers_index[key])}} {{for h in headers:}}{{pass}} {{for i, row in enumerate(taxa):}} {{for h in headers:}} {{if h=='wikidata':}} {{else:}} {{pass}} {{pass}} {{pass}}
{{=T(h)}}{{=T('enwiki (')}}{{=T('optional')}} )
{{=T('name')}} {{=T('page size')}} {{=T('mean monthly')}}
{{=T('visits (mmv)')}}
{{=T('trimmed mmv')}} {{=T('current raw_pop')}}
{{=row[headers_index[h]]}}{{=row[headers_index[h]]}}
{{else:}} {{=T('No matching ott')}} {{pass}}

{{=XML(T('This uses something like this query to get wikipedia page names from wikidata Q ids. It then uses something like this query to get page sizes from the wikipedia names, and this to get monthly site visits (see docs). The trimmed mean removes the two highest monthly site numbers.') % {'slot0': (xmlescape("|".join(["Q{}".format(t[headers_index['wikidata']]) for t in taxa])))})}}

{{pass}}