<commit_before>'use strict';

angular.module('openspecimen', [
  'ngMessages',
  'ngSanitize', 
  'ui.router', 
  'ui.bootstrap', 
  'ui.mask', 
  'ui.select',
  'mgcrea.ngStrap.popover',
  'angular-loading-bar'])

  .config(function($stateProvider, $urlRouterProvider, $httpProvider, uiSelectConfig, ApiUrlsProvider) {
    $stateProvider
      .state('login', {
        url: '/',
        templateUrl: 'modules/user/signin.html',
        controller: 'LoginCtrl'
      })
      .state('signed-in', {
        abstract: true,
        templateUrl: 'modules/common/appmenu.html'
      })
      .state('cps', {
        url: '/cps',
        abstract: true,
        template: '<div ui-view></div>',
        parent: 'signed-in'
      })
      .state('cp-list', {
        url: '', 
        templateUrl: 'modules/biospecimen/cp/list.html',
        controller: 'CpListCtrl',
        parent: 'cps'
      })
      .state('cp-detail', {
        url: '/:cpId',
        templateUrl: 'modules/biospecimen/cp/detail.html',
        parent: 'cps',
        resolve: {
          cp: function($stateParams, CollectionProtocolService) {
            return CollectionProtocolService.getCp($stateParams.cpId).then(
              function(result) {
                return result.data;
              }
            );
          }
        },
        controller: function($scope, $state, cp) {
          $scope.cp = cp;
        },
        breadcrumb: {
          title: '{{cp.title}}',
          state: 'cp-detail.overview'
        }
      })
      .state('cp-detail.overview', {
        url: '/overview',
        templateUrl: 'modules/biospecimen/cp/overview.html',
        parent: 'cp-detail'
      })
      .state('cp-detail.consents', {
        url: '/consents',
        templateUrl: 'modules/biospecimen/cp/consents.html',
        parent: 'cp-detail'
      })
      .state('cp-detail.events', {
        url: '/events',
        templateUrl: 'modules/biospecimen/cp/events.html',
        parent: 'cp-detail'
      })
      .state('participant-list', {
        url: '/participants',
        templateUrl: 'modules/biospecimen/participant/list.html',
        controller: 'ParticipantListCtrl',
        parent: 'cp-detail'
      })
      .state('participant-new', {
        url: '/new-participant',
        templateProvider: function($stateParams, CpConfigSvc) {
          var tmpl = CpConfigSvc.getRegParticipantTmpl($stateParams.cpId);
          return '<div ng-include src="\'' + tmpl + '\'"></div>';
        },
        controllerProvider: function($stateParams, CpConfigSvc) {
          return CpConfigSvc.getRegParticipantCtrl($stateParams.cpId);
        },
        parent: 'cp-detail'
      })
      .state('participant-detail', {
        url: '/participants/:cprId',
        templateUrl: 'modules/biospecimen/participant/detail.html',
        resolve: {
          cpr: function($stateParams, CprService) {
            return CprService.getRegistration($stateParams.cprId).then(
              function(result) {
                return result.data;
              }
            );   
          },

          visits: function($stateParams, CprService) {
            return CprService.getVisits($stateParams.cprId, true).then(
              function(result) {
                return result.data;
              }
            );
          }
        },
        controller: 'ParticipantDetailCtrl',
        parent: 'signed-in'
      })
      .state('participant-detail.overview', {
        url: '/overview',
        templateUrl: 'modules/biospecimen/participant/overview.html',
        controller: function() {
        },
        parent: 'participant-detail'
      })
      .state('participant-detail.consents', {
        url: '/consents',
        templateUrl: 'modules/biospecimen/participant/consents.html',
        controller: function() {
        },
        parent: 'participant-detail'
      })
      .state('participant-detail.visits', {
        url: '/visits',
        templateUrl: 'modules/biospecimen/participant/visits.html',
        controller: function($scope, cpr, visits) {
          $scope.cpr = cpr;
          $scope.visits = visits;
        },
        parent: 'participant-detail'
      })
      .state('participant-detail.specimens', {
        url: '/?eventId&visitId',<commit_msg>Show specimen tree of first visit by default<commit_after>'use strict';

angular.module('openspecimen', [
  'ngMessages',
  'ngSanitize', 
  'ui.router', 
  'ui.bootstrap', 
  'ui.mask', 
  'ui.select',
  'mgcrea.ngStrap.popover',
  'angular-loading-bar'])

  .config(function($stateProvider, $urlRouterProvider, $httpProvider, uiSelectConfig, ApiUrlsProvider) {
    $stateProvider
      .state('login', {
        url: '/',
        templateUrl: 'modules/user/signin.html',
        controller: 'LoginCtrl'
      })
      .state('signed-in', {
        abstract: true,
        templateUrl: 'modules/common/appmenu.html'
      })
      .state('cps', {
        url: '/cps',
        abstract: true,
        template: '<div ui-view></div>',
        parent: 'signed-in'
      })
      .state('cp-list', {
        url: '', 
        templateUrl: 'modules/biospecimen/cp/list.html',
        controller: 'CpListCtrl',
        parent: 'cps'
      })
      .state('cp-detail', {
        url: '/:cpId',
        templateUrl: 'modules/biospecimen/cp/detail.html',
        parent: 'cps',
        resolve: {
          cp: function($stateParams, CollectionProtocolService) {
            return CollectionProtocolService.getCp($stateParams.cpId).then(
              function(result) {
                return result.data;
              }
            );
          }
        },
        controller: function($scope, $state, cp) {
          $scope.cp = cp;
        },
        breadcrumb: {
          title: '{{cp.title}}',
          state: 'cp-detail.overview'
        }
      })
      .state('cp-detail.overview', {
        url: '/overview',
        templateUrl: 'modules/biospecimen/cp/overview.html',
        parent: 'cp-detail'
      })
      .state('cp-detail.consents', {
        url: '/consents',
        templateUrl: 'modules/biospecimen/cp/consents.html',
        parent: 'cp-detail'
      })
      .state('cp-detail.events', {
        url: '/events',
        templateUrl: 'modules/biospecimen/cp/events.html',
        parent: 'cp-detail'
      })
      .state('participant-list', {
        url: '/participants',
        templateUrl: 'modules/biospecimen/participant/list.html',
        controller: 'ParticipantListCtrl',
        parent: 'cp-detail'
      })
      .state('participant-new', {
        url: '/new-participant',
        templateProvider: function($stateParams, CpConfigSvc) {
          var tmpl = CpConfigSvc.getRegParticipantTmpl($stateParams.cpId);
          return '<div ng-include src="\'' + tmpl + '\'"></div>';
        },
        controllerProvider: function($stateParams, CpConfigSvc) {
          return CpConfigSvc.getRegParticipantCtrl($stateParams.cpId);
        },
        parent: 'cp-detail'
      })
      .state('participant-detail', {
        url: '/participants/:cprId',
        templateUrl: 'modules/biospecimen/participant/detail.html',
        resolve: {
          cpr: function($stateParams, CprService) {
            return CprService.getRegistration($stateParams.cprId).then(
              function(result) {
                return result.data;
              }
            );   
          },

          visits: function($stateParams, CprService) {
            return CprService.getVisits($stateParams.cprId, true).then(
              function(result) {
                return result.data;
              }
            );
          }
        },
        controller: 'ParticipantDetailCtrl',
        parent: 'signed-in'
      })
      .state('participant-detail.overview', {
        url: '/overview',
        templateUrl: 'modules/biospecimen/participant/overview.html',
        controller: function() {
        },
        parent: 'participant-detail'
      })
      .state('participant-detail.consents', {
        url: '/consents',
        templateUrl: 'modules/biospecimen/participant/consents.html',
        controller: function() {
        },
        parent: 'participant-detail'
      })
      .state('participant-detail.visits', {
        url: '/visits',
        templateUrl: 'modules/biospecimen/participant/visits.html',
        controller: function($scope, $state, cpr, visits) {
          $scope.cpr = cpr;
          $scope.visits = visits;

          if (visits && visits.length > 0) {
            $state.go(
              'participant-detail.specimens', 
              {visitId: visits[0].id, eventId: visits[0].eventId}
            );
          }
        },
        parent: 'participant-detail'
      })
      .state('participant-detail.specimens', {
        url: '/?eventId&visitId',
{'fraction_non_alphanumeric': 0.14596627164995443, 'fraction_numerical': 0.00034184138559708297, 'mean_word_length': 1.9062913907284769, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '5646864', 'n_tokens_mistral': 2677, 'n_tokens_neox': 2595, 'n_words': 393}