get analysis info into the stexaminer, unstyled as yet
Tara L Andrews [Tue, 26 Jun 2012 20:37:25 +0000 (22:37 +0200)]
stemmaweb/root/css/stexaminer.css
stemmaweb/root/js/stexaminer.js
stemmaweb/root/src/stexaminer.tt

index 59c523d..92c8037 100644 (file)
@@ -24,7 +24,7 @@
     position: relative;
     top: -15px;
 }
-#stats_template {
+.template {
        display: none;
 }
 .genealogical {
index aa83fbc..106edf3 100644 (file)
@@ -37,3 +37,42 @@ function color_nodes( column_index, arr_node_ids, arr_greynode_ids ) {
       });
   });
 }
+
+function show_stats( row_index ) {
+       var rs = readingstats[row_index];
+       var rshtml = $('#stats_template').clone();
+       rshtml.find('#statrank').append( rs.id );
+       $.each( rs.readings, function( idx, rdghash ) {
+               var readinglabel = rdghash.readingid;
+               if( rdghash.text ) {
+                       readinglabel += ' (' + rdghash.text + ')';
+               }
+               var readingroots = rdghash.independent_occurrence.join( ', ' );
+               var rdgstats = $('#reading_template').clone();
+               rdgstats.find('.readinglabel').append( readinglabel );
+               rdgstats.find('.reading_copied').append( rdghash.followed );
+               rdgstats.find('.reading_changed').append( rdghash.not_followed );
+               rdgstats.find('.reading_unclear').append( rdghash.follow_unknown );
+               rdgstats.find('.readingroots').append( readingroots );
+               if( ! $.isEmptyObject( rdghash.reading_parents ) ) {
+                       var parentstats = $('#reading_parent_template').clone();
+                       $.each( rdghash.reading_parents, function( parentid, pdata ) {
+                               var parentdesc = pdata.label;
+                               if( pdata.relation ) {
+                                       parentdesc += ' - variant type ' + pdata.relation.type;
+                                       if( pdata.relation.annotation ) {
+                                               parentdesc += ' [ ' + pdata.relation.annotation + ' ]';
+                                       }
+                               } else {
+                                       parentdesc += ' - no syntactic relation';
+                               }
+                               var parentitem = $('<li>').append( parentdesc );
+                               parentstats.find('.reading_parent_list').append( parentitem );
+                       });
+                       rdgstats.find('.reading_statistics').append( parentstats.contents() );
+               }
+               rshtml.append( rdgstats.contents() );
+       });
+       $('#row_statistics').empty();
+       $('#row_statistics').append( rshtml.contents() );
+};
index be3f0ad..10c4632 100644 (file)
@@ -5,13 +5,6 @@
 %]
 <script type="text/javascript">
 var readingstats = [% reading_statistics %];
-function show_stats( row_index ) {
-       var rs = readingstats[row_index];
-       var rshtml = $('#stats_template').clone();
-       rshtml.find('#statrank').append( rs.id );
-       $('#row_statistics').empty();
-       $('#row_statistics').append( rshtml.contents() );
-};
 </script>
 [% END -%]
     <h1>Stexaminer</h1>
@@ -32,12 +25,30 @@ function show_stats( row_index ) {
        <li>Total number of variant locations analyzed: [% total %]</li>
         <li>Number of fully genealogical locations: [% genealogical %]</li>
         <li>Number of readings that conflict with the stemma: [% conflict %]</li>
+        <li>Genealogical reading transitions by relationship type: [% todo %]</li>
       </ul>
       <p>(Choose a row in the table to display statistics about individual readings.)</p>
     </div>
-    <div id="stats_template">
-           <h3>Statistics for readings at <span id="statrank"></span></h3>
+    
+    <div id="stats_template" class="template">
+           <h3>Statistics for readings at <span id="statrank"></span>:</h3>
+           <!-- reading_template will be appended here for each reading -->
+    </div>
+    
+       <div id="reading_template" class="template">  
+               <div class="reading_statistics">
+                       <span class="readinglabel"></span> - copied <span class="reading_copied"></span> times, changed <span class="reading_changed"></span> times<br/>
+                       Reading root(s) at <span class="readingroots"></span><br/>
+                       <!-- reading_parent_template will be appended here if there are parents -->
+               </div>
     </div>
+    
+       <div id="reading_parent_template" class="template">
+               <div class="parent_statistics">
+                       Reading parent(s):
+                       <ul class="reading_parent_list"></ul>
+               </div>
+       </div>
 
 [% PROCESS footer.tt %]