<commit_before>angular.module('os.biospecimen.participant')
  .factory('ExportUtil', function($translate) {

    function addForms(exportTypes, group, entityType, input, forms) {
      angular.forEach(forms,
        function(form) {
          exportTypes.push({
            group: group,
            type: 'extensions',
            title: form.caption,
            '$$input': input,
            params: { entityType: entityType, formName: form.name }
          });
        });
      return exportTypes;
    }

    function msg(key) {
      return $translate.instant(key);
    }

    function getParticipantTypes(entityForms, cpId, addConsent) {
      var group = $translate.instant('participant.title');
      var input = {'var': 'ppids', varName: 'participant.ppids', varDesc: 'participant.ppids_csv'};

      var exportTypes = [ { group: group, type: 'cpr', title: msg('participant.list'), '$$input': input } ];
      if (addConsent) {
        exportTypes = exportTypes.concat(getConsentTypes(cpId, input));
      }

      addForms(exportTypes, group, 'CommonParticipant', input, entityForms['CommonParticipant']);
      return addForms(exportTypes, group, 'Participant', input, entityForms['Participant']);
    }

    function getConsentTypes(cpId, input) {
      var group = $translate.instant('participant.title');
      input = input || {'var': 'ppids', varName: 'participant.ppids', varDesc: 'participant.ppids_csv'};
      return [{ group: group, type: 'consent', title: msg('participant.consents'), '$$input': input }];
    }

    function getVisitTypes(entityForms) {
      var group = $translate.instant('visits.title');<commit_msg>Plugin hook to export the consent document responses.<commit_after>angular.module('os.biospecimen.participant')
  .factory('ExportUtil', function($translate, $injector) {

    function addForms(exportTypes, group, entityType, input, forms) {
      angular.forEach(forms,
        function(form) {
          exportTypes.push({
            group: group,
            type: 'extensions',
            title: form.caption,
            '$$input': input,
            params: { entityType: entityType, formName: form.name }
          });
        });
      return exportTypes;
    }

    function msg(key) {
      return $translate.instant(key);
    }

    function getParticipantTypes(entityForms, cpId, addConsent) {
      var group = $translate.instant('participant.title');
      var input = {'var': 'ppids', varName: 'participant.ppids', varDesc: 'participant.ppids_csv'};

      var exportTypes = [ { group: group, type: 'cpr', title: msg('participant.list'), '$$input': input } ];
      if (addConsent) {
        exportTypes = exportTypes.concat(getConsentTypes(cpId, input));
      }

      addForms(exportTypes, group, 'CommonParticipant', input, entityForms['CommonParticipant']);
      return addForms(exportTypes, group, 'Participant', input, entityForms['Participant']);
    }

    function getConsentTypes(cpId, input) {
      var type = 'consent';
      if ($injector.has('ecDocument')) {
        type = 'econsentsDocumentResponse';
      }

      var group = $translate.instant('participant.title');
      input = input || {'var': 'ppids', varName: 'participant.ppids', varDesc: 'participant.ppids_csv'};
      return [{ group: group, type: type, title: msg('participant.consents'), '$$input': input }];
    }

    function getVisitTypes(entityForms) {
      var group = $translate.instant('visits.title');
{'fraction_non_alphanumeric': 0.14447017950202665, 'fraction_numerical': 0.0, 'mean_word_length': 3.2185592185592187, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4149665', 'n_tokens_mistral': 1037, 'n_tokens_neox': 983, 'n_words': 214}