<commit_before>(function() {
    'use strict';

    angular
        .module('portal')
        .run(runBlock);

    /** @ngInject */
    function runBlock($log, $httpBackend, $window, API, AuthAPI) {

        var firstNames = ['Faustina', 'Janise', 'Dung', 'Chaya', 'Karry', 'Maye', 'Ericka', 'Apryl', 'Cara', 'Markus', 'Rosetta', 'Amie', 'Kris', 'Jerold', 'Lorena', 'Lanora', 'Tandra', 'Alvera', 'Keitha', 'Darlena', 'Ross', 'Hisako', 'Daniella', 'Bonny', 'Herma', 'Jacquline', 'Adan', 'Naoma', 'Katlyn', 'Gwyn', 'Hannah', 'Markus', 'Augustina', 'Dorothy', 'Fredrick', 'Clemente', 'Dawne', 'Courtney', 'Margherita', 'Adella'];
        var lastNames = ['Beene', 'Fairbank', 'Petrarca', 'Klingler', 'Melvin', 'Cheeseman', 'Clagon', 'Odriscoll', 'Monteith', 'Yates', 'Brandenburg', 'Bolz', 'Laughter', 'Chaisson', 'Plourde', 'Miltenberger', 'Zubia', 'Rapozo', 'Voit', 'Muriel', 'Houghtaling', 'Hubbell', 'Weldy', 'Becraft', 'Weinman', 'Shawver', 'Suda', 'Shakespeare', 'Prado', 'Newman', 'Coney', 'Reddout', 'Cothren', 'Arocho', 'Brittian', 'Ingalls', 'Kuhn', 'Munford', 'Kobel', 'Duwe'];
        var documents = [{title: 'Title of a doc', filetype: 'C-CDA 1'},
                         {title: 'A study in search', filetype: 'docx'},
                         {title: 'Living the dream', filetype: 'pdf'},
                         {title: 'Health stuff', filetype: 'xml'},
                         {title: 'Immunization', filetype: 'png'},
                         {title: 'Blood work', filetype: 'txt'},
                         {title: 'X-Rays', filetype: 'gif'},
                         {title: 'A thing that happened once', filetype: 'pptx'},
                         {title: 'Another title', filetype: 'C-CDA 2.2'}];
        var aDocument = [{data: "<document>\n<made>\n<of attribute='a value'>XML</of>\n</made>\n</document>"},
                         {data: "<doc ns='docstring'>\n<thing>some txt</thing>\n<another-thing>more text</another-thing>\n</doc>"},
                         {data: "<ccda version='1.1'>\n<item>1</item>\n<item>2</item>\n<item>3</item>\n</ccda>"}];
        var organizations = [{id: 1, name: 'Hospital', url: 'http://www.example.com', status: 'Active'},
                             {id: 2, name: 'EHR For Fun', url: 'http://www.example.com/2', status: 'Inactive'},
                             {id: 3, name: 'Ambulatory Center', url: 'http://www.example.com/3', status: 'Active'}];

        // fake backend data
        //$httpBackend.whenGET (new RegExp(API + '/organizations')).respond(200, {results: randomArray(organizations, Math.floor(Math.random() * 3) + 3)});
        $httpBackend.whenGET (new RegExp(API + '/patients/.*/documents$')).respond(200, {results: randomArray(documents, Math.floor(Math.random() * 6) + 1)});
        $httpBackend.whenGET (new RegExp(API + '/patients/.*/documents/.*')).respond(200, aDocument[Math.floor(Math.random() * aDocument.length)]);
        $httpBackend.whenPOST(new RegExp(API + '/search$')).respond(200, {records: makePeople(Math.floor(Math.random() * 6) + 3)});
        $httpBackend.whenPOST(new RegExp(API + '/acfs/create')).respond(function(method, url, data) {
            var ret = angular.fromJson(data);
            ret.id = 1;
            var str = angular.toJson(ret);
            $log.debug(data, ret, str);
            return [200, str, {}];
        });
        $httpBackend.whenPOST(new RegExp(API + '/acfs/.*/edit')).respond(function(method, url, data) { return [200, {acf: angular.fromJson(data)}, {}]; });
        $httpBackend.whenPOST(new RegExp(API + '/queries/.*/stage')).respond(function(method, url, data) { return [200, {}, {}]; });

        // real "go to actual endpoints" data
        $httpBackend.whenGET (new RegExp(API + '/acfs')).passThrough();
        //$httpBackend.whenPOST(new RegExp(API + '/acfs/create')).passThrough();
        //$httpBackend.whenPOST(new RegExp(API + '/acfs/.*/edit')).passThrough();
        $httpBackend.whenGET (new RegExp(API + '/organizations')).passThrough();
        $httpBackend.whenGET (new RegExp(AuthAPI)).passThrough();
        $httpBackend.whenPOST(new RegExp(AuthAPI)).passThrough();
        $httpBackend.whenGET(/^app/).passThrough();

        $log.info('runBlock end');

        function makePeople(count) {<commit_msg>PULSE-104: Return some fake patients<commit_after>(function() {
    'use strict';

    angular
        .module('portal')
        .run(runBlock);

    /** @ngInject */
    function runBlock($log, $httpBackend, $window, API, AuthAPI) {

        var firstNames = ['Faustina', 'Janise', 'Dung', 'Chaya', 'Karry', 'Maye', 'Ericka', 'Apryl', 'Cara', 'Markus', 'Rosetta', 'Amie', 'Kris', 'Jerold', 'Lorena', 'Lanora', 'Tandra', 'Alvera', 'Keitha', 'Darlena', 'Ross', 'Hisako', 'Daniella', 'Bonny', 'Herma', 'Jacquline', 'Adan', 'Naoma', 'Katlyn', 'Gwyn', 'Hannah', 'Markus', 'Augustina', 'Dorothy', 'Fredrick', 'Clemente', 'Dawne', 'Courtney', 'Margherita', 'Adella'];
        var lastNames = ['Beene', 'Fairbank', 'Petrarca', 'Klingler', 'Melvin', 'Cheeseman', 'Clagon', 'Odriscoll', 'Monteith', 'Yates', 'Brandenburg', 'Bolz', 'Laughter', 'Chaisson', 'Plourde', 'Miltenberger', 'Zubia', 'Rapozo', 'Voit', 'Muriel', 'Houghtaling', 'Hubbell', 'Weldy', 'Becraft', 'Weinman', 'Shawver', 'Suda', 'Shakespeare', 'Prado', 'Newman', 'Coney', 'Reddout', 'Cothren', 'Arocho', 'Brittian', 'Ingalls', 'Kuhn', 'Munford', 'Kobel', 'Duwe'];
        var documents = [{title: 'Title of a doc', filetype: 'C-CDA 1'},
                         {title: 'A study in search', filetype: 'docx'},
                         {title: 'Living the dream', filetype: 'pdf'},
                         {title: 'Health stuff', filetype: 'xml'},
                         {title: 'Immunization', filetype: 'png'},
                         {title: 'Blood work', filetype: 'txt'},
                         {title: 'X-Rays', filetype: 'gif'},
                         {title: 'A thing that happened once', filetype: 'pptx'},
                         {title: 'Another title', filetype: 'C-CDA 2.2'}];
        var aDocument = [{data: "<document>\n<made>\n<of attribute='a value'>XML</of>\n</made>\n</document>"},
                         {data: "<doc ns='docstring'>\n<thing>some txt</thing>\n<another-thing>more text</another-thing>\n</doc>"},
                         {data: "<ccda version='1.1'>\n<item>1</item>\n<item>2</item>\n<item>3</item>\n</ccda>"}];
        var organizations = [{id: 1, name: 'Hospital', url: 'http://www.example.com', status: 'Active'},
                             {id: 2, name: 'EHR For Fun', url: 'http://www.example.com/2', status: 'Inactive'},
                             {id: 3, name: 'Ambulatory Center', url: 'http://www.example.com/3', status: 'Active'}];

        // fake backend data
        //$httpBackend.whenGET (new RegExp(API + '/organizations')).respond(200, {results: randomArray(organizations, Math.floor(Math.random() * 3) + 3)});
        $httpBackend.whenGET (new RegExp(API + '/patients$')).respond(200, {results: makePeople(Math.floor(Math.random() * 6) + 3)});
        $httpBackend.whenGET (new RegExp(API + '/patients/.*/documents$')).respond(200, {results: randomArray(documents, Math.floor(Math.random() * 6) + 1)});
        $httpBackend.whenGET (new RegExp(API + '/patients/.*/documents/.*')).respond(200, aDocument[Math.floor(Math.random() * aDocument.length)]);
        $httpBackend.whenPOST(new RegExp(API + '/search$')).respond(200, {records: makePeople(Math.floor(Math.random() * 6) + 3)});
        $httpBackend.whenPOST(new RegExp(API + '/acfs/create')).respond(function(method, url, data) {
            var ret = angular.fromJson(data);
            ret.id = 1;
            var str = angular.toJson(ret);
            $log.debug(data, ret, str);
            return [200, str, {}];
        });
        $httpBackend.whenPOST(new RegExp(API + '/acfs/.*/edit')).respond(function(method, url, data) { return [200, {acf: angular.fromJson(data)}, {}]; });
        $httpBackend.whenPOST(new RegExp(API + '/queries/.*/stage')).respond(function(method, url, data) { return [200, {}, {}]; });

        // real "go to actual endpoints" data
        $httpBackend.whenGET (new RegExp(API + '/acfs')).passThrough();
        //$httpBackend.whenPOST(new RegExp(API + '/acfs/create')).passThrough();
        //$httpBackend.whenPOST(new RegExp(API + '/acfs/.*/edit')).passThrough();
        $httpBackend.whenGET (new RegExp(API + '/organizations')).passThrough();
        $httpBackend.whenGET (new RegExp(AuthAPI)).passThrough();
        $httpBackend.whenPOST(new RegExp(AuthAPI)).passThrough();
        $httpBackend.whenGET(/^app/).passThrough();

        $log.info('runBlock end');

        function makePeople(count) {
{'fraction_non_alphanumeric': 0.21009565518036188, 'fraction_numerical': 0.01037224847297453, 'mean_word_length': 3.0138760407030527, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 2}, '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': '1508677', 'n_tokens_mistral': 2973, 'n_tokens_neox': 2861, 'n_words': 600}