X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=web%2Fhtdocs%2Fdetails%2Fstats.mc;h=e50f56ae2b7fc32b5bb46702753dce65c41d97cc;hb=e0ae362748a39155af12add31d419f3f8fe67362;hp=0f2640711ed93385c0839d7955012b2566613be3;hpb=52ecdbad43c852aa70bf3fea418e5e9543fcd3fa;p=irspy-moved-to-github.git
diff --git a/web/htdocs/details/stats.mc b/web/htdocs/details/stats.mc
index 0f26407..e50f56a 100644
--- a/web/htdocs/details/stats.mc
+++ b/web/htdocs/details/stats.mc
@@ -1,4 +1,3 @@
-%# $Id: stats.mc,v 1.4 2006-12-15 18:18:46 mike Exp $
<%doc>
Here are the headings in the Z-Spy version:
The ten most commonly supported Bib-1 Use attributes
@@ -19,19 +18,20 @@ least resistance and look at all the records by hand.
%doc>
<%args>
$query => undef
+$reload => 0
%args>
<%perl>
my $key = defined $query ? $query : "";
my $from_cache = 1;
my $stats = $m->cache->get($key);
-if (defined $stats) {
-} else {
+if (!defined $stats || $reload) {
$from_cache = 0;
- $stats = new ZOOM::IRSpy::Stats("localhost:3313/IR-Explain---1", $query);
- $m->cache->set($key, $stats, "1 minute");
+ my $db = ZOOM::IRSpy::connect_to_registry();
+ $stats = new ZOOM::IRSpy::Stats($db, $query);
+ $m->cache->set($key, $stats, "1 day");
}
%perl>
-
Statistics for <% $stats->{conn}->option("host") %>
+ Statistics for <% xml_encode($stats->{host}) %>
<% $stats->{n} %> targets analysed
<% defined $query ? "for '" . xml_encode($query) . "'" : "" %>
% if ($from_cache) {
@@ -39,51 +39,64 @@ if (defined $stats) {
% } else {
Recalculating stats
% }
-
- Top 10 Bib-1 Attributes
+<& table, stats => $stats, data => "bib1AccessPoints",
+ title => "The twenty most commonly supported Bib-1 Use attributes",
+ headings => [ "Attribute", "Name"], maxrows => 20,
+ col3 => sub { bib1_access_point(@_) } &>
+<& table, stats => $stats, data => "recordSyntaxes",
+ title => "Record syntax support by database",
+ headings => [ "Record Syntax"], maxrows => 30 &>
+<& table, stats => $stats, data => "explain",
+ title => "Explain Support",
+ headings => [ "Explain Category"] &>
+<& table, stats => $stats, data => "z3950_init_opt",
+ title => "Z39.50 Protocol Services Support",
+ headings => [ "Service"] &>
+<& table, stats => $stats, data => "domains",
+ title => "Top Domains",
+ headings => [ "Top Domain"] &>
+<& table, stats => $stats, data => "implementation",
+ title => "Implementation",
+ headings => [ "Name" ], maxrows => 20 &>
+%#
+%#
+<%def table>
+<%args>
+$stats
+$data
+$title
+$maxrows => 10
+@headings
+$col3 => undef
+%args>
+ <% $title %>
-
- Attribute |
- Name |
- # Db |
-
+
+
+% foreach my $heading ("#", @headings, "# Targets") {
+ <% xml_encode($heading) %> |
+% }
+
+
+
<%perl>
my $hr;
-$hr = $stats->{bib1AccessPoints};
-foreach my $key ((sort { $hr->{$b} <=> $hr->{$a}
- || $a <=> $b } keys %$hr)[0..9]) {
+$hr = $stats->{$data};
+my @sorted = sort { $hr->{$b} <=> $hr->{$a} || $a <=> $b } keys %$hr;
+my $n = @sorted; $n = $maxrows if @sorted > 10 && $n > $maxrows;
+foreach my $i (1..$n) {
+ my $key = $sorted[$i-1];
%perl>
- <% xml_encode($key) %> |
- unknown |
- <% xml_encode($hr->{$key}) . " (" .
- 100*$hr->{$key}/$stats->{n} . "%)" %> |
+ <% $i %> |
+ <% xml_encode(substr($key, 0, 54), "HUH?") %> |
+% if (defined $col3) {
+ <% xml_encode(&$col3($key), "HUH2?") %> |
+% }
+ <% xml_encode($hr->{$key}, "HUH3?") . " (" .
+ int(10000*$hr->{$key}/$stats->{n})/100 . "%)" %> |
% }
-
-
-<%doc>
- print "\nRECORD SYNTAXES\n";
- $hr = $stats->{recordSyntaxes};
- foreach my $key (sort { $hr->{$b} <=> $hr->{$a}
- || $a cmp $b } keys %$hr) {
- print sprintf("%-26s%5d (%d%%)\n",
- $key, $hr->{$key}, 100*$hr->{$key}/$stats->{n});
- }
-
- print "\nEXPLAIN SUPPORT\n";
- $hr = $stats->{explain};
- foreach my $key (sort { $hr->{$b} <=> $hr->{$a}
- || $a cmp $b } keys %$hr) {
- print sprintf("%-26s%5d (%d%%)\n",
- $key, $hr->{$key}, 100*$hr->{$key}/$stats->{n});
- }
-
- print "\nTOP-LEVEL DOMAINS\n";
- $hr = $stats->{domains};
- foreach my $key (sort { $hr->{$b} <=> $hr->{$a}
- || $a cmp $b } keys %$hr) {
- print sprintf("%-26s%5d (%d%%)\n",
- $key, $hr->{$key}, 100*$hr->{$key}/$stats->{n});
- }
-%doc>
+
+
+%def>