<commit_before>package org.waterforpeople.mapping.analytics;

import java.util.List;

import org.waterforpeople.mapping.analytics.dao.SurveyQuestionSummaryDao;
import org.waterforpeople.mapping.dao.SurveyInstanceDAO;
import org.waterforpeople.mapping.domain.QuestionAnswerStore;
import org.waterforpeople.mapping.domain.SurveyInstance;

import com.gallatinsystems.framework.analytics.summarization.DataSummarizer;

/**
 * This class will summarize survey information by updating counts by response
 * type by survey. The key should be a key of a survey instance object
 * 
 * @author <NAME>
 * 
 */
public class SurveyQuestionSummarizer implements DataSummarizer {

	@Override
	public boolean performSummarization(String key, String type) {
		if (key != null) {
			SurveyInstanceDAO instanceDao = new SurveyInstanceDAO();
			SurveyInstance instance = instanceDao.getByKey(new Long(key));
			if (instance != null) {
				List<QuestionAnswerStore> answers = instance
						.getQuestionAnswersStore();
				if (answers != null) {
					for (QuestionAnswerStore answer : answers) {
						SurveyQuestionSummaryDao.incrementCount(answer);
					}
				}
			}
		}
		return true;
	}

}
<commit_msg>refactored to load QuestionAnswerStore manually<commit_after>package org.waterforpeople.mapping.analytics;

import java.util.List;

import org.waterforpeople.mapping.analytics.dao.SurveyQuestionSummaryDao;
import org.waterforpeople.mapping.dao.SurveyInstanceDAO;
import org.waterforpeople.mapping.domain.QuestionAnswerStore;

import com.gallatinsystems.framework.analytics.summarization.DataSummarizer;

/**
 * This class will summarize survey information by updating counts by response
 * type by survey. The key should be a key of a survey instance object
 * 
 * @author <NAME>
 * 
 */
public class SurveyQuestionSummarizer implements DataSummarizer {

	@Override
	public boolean performSummarization(String key, String type) {
		if (key != null) {
			SurveyInstanceDAO instanceDao = new SurveyInstanceDAO();
			List<QuestionAnswerStore> answers = instanceDao
					.listQuestionAnswerStore(new Long(key));
			if (answers != null) {
				for (QuestionAnswerStore answer : answers) {
					SurveyQuestionSummaryDao.incrementCount(answer);
				}
			}
		}
		return true;
	}

}

{'fraction_non_alphanumeric': 0.08319039451114923, 'fraction_numerical': 0.0, 'mean_word_length': 4.0280172413793105, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '7591948', 'n_tokens_mistral': 749, 'n_tokens_neox': 666, 'n_words': 158}