<commit_before><%@ page language="java" %><%@ page buffer="none" %><%@ page import="
gov.nih.nci.rembrandt.web.helper.ReportGeneratorHelper,
gov.nih.nci.rembrandt.web.bean.SessionQueryBag,
gov.nih.nci.rembrandt.util.RembrandtConstants,
org.dom4j.Document,org.dom4j.io.XMLWriter,org.dom4j.io.OutputFormat,
gov.nih.nci.caintegrator.service.findings.*, gov.nih.nci.rembrandt.web.helper.*,
gov.nih.nci.rembrandt.web.factory.*, gov.nih.nci.rembrandt.web.bean.*, 
org.dom4j.Document, gov.nih.nci.rembrandt.util.*,
gov.nih.nci.rembrandt.web.factory.ApplicationFactory,
gov.nih.nci.rembrandt.cache.*" %><%

String key = request.getParameter("key")!=null ? (String) request.getParameter("key") : null;
	if(key != null)	{
		PresentationTierCache ptc = ApplicationFactory.getPresentationTierCache();
		FindingReportBean frb = (FindingReportBean) ptc.getObjectFromSessionCache(session.getId(), key);
		if(frb!=null)	{
			Document xmlDocument = (Document) frb.getXmlDoc();
			if(xmlDocument!=null)	{
				//generate the CSV
				response.setContentType("application/csv");
				response.setHeader("Content-Disposition", "attachment; filename=report.csv");
				try{	
					ReportGeneratorHelper.renderReport(request, xmlDocument,"csv.xsl",out);
				}
				catch(Exception e)	{
					out.println("Error Generating the report");
				}
			}
			else	{
				out.println("No Records Available for this query");
			}
		}
		else	{
			out.println("No Records Available for this query");
		}
	}
	else	{
		out.println("Error Generating the CSV.");
	}
%><commit_msg>on-demand full annotation XML generation now occurs here<commit_after><%@ page language="java" %><%@ page buffer="none" %><%@ page import="
gov.nih.nci.rembrandt.web.helper.ReportGeneratorHelper,
gov.nih.nci.rembrandt.web.bean.SessionQueryBag,
gov.nih.nci.rembrandt.util.RembrandtConstants,
org.dom4j.Document,org.dom4j.io.XMLWriter,org.dom4j.io.OutputFormat,
gov.nih.nci.caintegrator.service.findings.*, gov.nih.nci.rembrandt.web.helper.*,
gov.nih.nci.rembrandt.web.factory.*, gov.nih.nci.rembrandt.web.bean.*, 
org.dom4j.Document, gov.nih.nci.rembrandt.util.*,
gov.nih.nci.rembrandt.web.factory.ApplicationFactory,
gov.nih.nci.rembrandt.cache.*,gov.nih.nci.rembrandt.web.xml.ClassComparisonReport,
java.util.HashMap" %><%

String key = request.getParameter("key")!=null ? (String) request.getParameter("key") : null;
	if(key != null)	{
		PresentationTierCache ptc = ApplicationFactory.getPresentationTierCache();
		FindingReportBean frb = (FindingReportBean) ptc.getObjectFromSessionCache(session.getId(), key);
		if(frb!=null && frb.getFinding()!=null)	{
			Document xmlDocument = null;
			if(frb.getXmlDocCSV()!=null)
				xmlDocument = (Document)frb.getXmlDocCSV();
			else	{
				//generate the XML for CSV (w/annotations) and cache
				xmlDocument = ClassComparisonReport.getReportXML(frb.getFinding(), new HashMap(), true);
				//put frb back in cache
				frb.setXmlDocCSV(xmlDocument);
				ptc.addToSessionCache(frb.getFinding().getSessionId(),frb.getFinding().getTaskId(), frb);
			}
			if(xmlDocument!=null)	{
				//generate the CSV
				response.setContentType("application/csv");
				response.setHeader("Content-Disposition", "attachment; filename=report.csv");
				try{	
					ReportGeneratorHelper.renderReport(request, xmlDocument,"csv.xsl",out);
				}
				catch(Exception e)	{
					out.println("Error Generating the report");
				}
			}
			else	{
				out.println("No Records Available for this query");
			}
		}
		else	{
			out.println("No Records Available for this query");
		}
	}
	else	{
		out.println("Error Generating the CSV.");
	}
%>
{'fraction_non_alphanumeric': 0.1561628555493586, 'fraction_numerical': 0.002230897936419409, 'mean_word_length': 4.657728706624606, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4196116', 'n_tokens_mistral': 1399, 'n_tokens_neox': 1249, 'n_words': 185}