[% META title = 'Resources &raquo; Stats &amp; Audit &raquo; Turnaround time for specimen' %]

<!-- BEGIN [% template.name %] -->

    [% # PROCESS dumper.tt dump = stats %]

    <p>[% site.html.back_button %]</p>

    <h3>Registration to [% c.model('Base').does_authorisation
        ? 'authorisation' : 'reporting' %] duration for 95% of non-trial requests:
        [% specimen_type %] samples</h3>

    [% PROCESS site/date_constraints.tt
        func_name = 'get_page'
        target_url = app_url _ '/audit/turnaround_chart/' _ c.param('id')
        restricted = { # too slow to allow these:
            no_constraint = 1,
            all_since     = 1,
        }
    %]

    <table class="indent">
        <tr>
            <td align="right" class="title">total:</td>
            <td>[% stats.total %]</td>
            <td rowspan="11" class="borderless">
                <img src="[% app_url %]/chart/specimen_turnround/[% specimen_type %]" />
            </td>
        </tr>
        <tr>
            <td align="right" class="title">range:</td>
            <td>[% stats.range %] ([% stats.min %] - [% stats.max %]) days</td>
        </tr>
        <tr>
            <td align="right" class="title">mean:</td>
            <td>[% stats.mean | format('%.1f') %] day</td>
        </tr>
        <tr>
            <td align="right" class="title">median:</td>
            <td>[% stats.median %] day</td>
        </tr>
        <tr>
            <td align="right" class="title">mode:</td>
            <td>[% stats.mode %] day</td>
        </tr>
        <tr>
            <td align="right" class="title">skewness:</td>
            <td>[% stats.skewness | format('%.1f') %]</td>
        </tr>
        <tr>
            <td align="right" class="title">
                <span class="acronym" title="excludes top 5%">
                    trimmed mean</span>:
            </td>
            <td>[% stats.trimmed_mean | format('%.1f') %] day</td>
        </tr>
        <tr>
            <td align="right" class="title">90th percentile:</td>
            <td>[% x_percentile(90) %] day</td>
        </tr>
        <tr class="blue">
            <td align="right" class="title">95th percentile:</td>
            <td>[% x_percentile(95) %] day</td>
        </tr>
        <tr>
            <td align="right" class="title">98th percentile:</td>
            <td>[% x_percentile(98) %] day</td>
        </tr>
        <tr class="borderless">
            <td colspan="2" align="right">
            [% IF c.user_can('report') %]
                Download data: <a href="[%
                    c.query.self_url.replace('turnaround_chart','turnaround_data')
                %]" class="image"><img src="/images/table-icon.png" /></a>
            [% END %]
            </td>
        </tr>
    </table>
<!-- END [% template.name %] -->
