<commit_before>(function(root){
    var data = function() {
        var self = this;
        
        self.getPrograms = function() {
            var url = "http://" + survey.utils.getBaseUrl() + "/api/programs.jsonp";
            console.log("URL: " + url);            
            $.ajax({
               type: 'GET',
                url: url,
                contentType: "application/json",
                dataType: 'jsonp'
            })
            .done(function(data) {
                for (var i = 0; i < data.programs.length; i++) {
                    self.getExtendedProgramsAndPopulateDropdown(data.programs[i].id);
                }
            })
            .fail(function(){
                console.log("Could not fetch programs from server");
            });
        };
        
        
        self.getExtendedProgramsAndPopulateDropdown = function(id) {
            var url = "http://" + survey.utils.getBaseUrl() + "/api/programs/" + id + ".jsonp";
            console.log(url);
            $.ajax({
                    type: 'GET',
                    url: url,
                    contentType: "application/json",
                    dataType: 'jsonp'
                })
                .done(function(data) {
                    console.log("Program: " + data.name + " received!");
                    root.viewModel.programs.push(data);
                })
                .fail(function() {
                    console.log("Could not fetch extended program info from server");
                });
        };
        
        self.getProgramStagesFromSelectedProgram = function() {            
            for (var i = 0; i < root.viewModel.selectedProgram().programStages.length; i++) {
                self.getProgramStageAndPopulateDropdown(root.viewModel.selectedProgram().programStages[i].id);
            }
        };

        self.getProgramStageAndPopulateDropdown = function(id) {
            var url = "http://" + survey.utils.getBaseUrl() + "/api/programStages/" + id + ".jsonp";
            console.log(url);
            $.ajax({
                type: 'GET',
                    url: url,
                    contentType: "application/json",
                    dataType: 'jsonp'
            })
            .done(function(data) {
                console.log("ProgramStage: " + data.name + " received!");
                root.viewModel.programStages.push(data);
                // TODO: Add ProgramStageDataElements to view model
            })
            .fail(function() {
                console.log("Could not fetch program stages from server.");
            });
            
        }
        
    };
    
    root.data = new data();
})(survey);


<commit_msg>Some changes made to survey.data.js<commit_after>(function(root){
    var data = function() {
        var self = this;
        
        self.getPrograms = function() {
            var url = "http://" + survey.utils.getBaseUrl() + "/api/programs.jsonp";
            console.log("URL: " + url);            
            $.ajax({
               type: 'GET',
                url: url,
                contentType: "application/json",
                dataType: 'jsonp'
            })
            .done(function(data) {
                for (var i = 0; i < data.programs.length; i++) {
                    self.getExtendedProgramsAndPopulateDropdown(data.programs[i].id);
                }
            })
            .fail(function(){
                console.log("Could not fetch programs from server");
            });
        };
        
        
        self.getExtendedProgramsAndPopulateDropdown = function(id) {
            var url = "http://" + survey.utils.getBaseUrl() + "/api/programs/" + id + ".jsonp";
            console.log(url);
            $.ajax({
                    type: 'GET',
                    url: url,
                    contentType: "application/json",
                    dataType: 'jsonp'
                })
                .done(function(data) {
                    console.log("Program: " + data.name + " received!");
                    root.viewModel.programs.push(data);
                })
                .fail(function() {
                    console.log("Could not fetch extended program info from server");
                });
        };
        
        self.getProgramStagesFromSelectedProgram = function() {            
            for (var i = 0; i < root.viewModel.selectedProgram().programStages.length; i++) {
                self.getProgramStageAndPopulateDropdown(root.viewModel.selectedProgram().programStages[i].id);
            }
        };

        self.getProgramStageAndPopulateDropdown = function(id) {
            var url = "http://" + survey.utils.getBaseUrl() + "/api/programStages/" + id + ".jsonp";
            console.log(url);
            $.ajax({
                type: 'GET',
                    url: url,
                    contentType: "application/json",
                    dataType: 'jsonp'
            })
            .done(function(data) {
                console.log("ProgramStage: " + data.name + " received!");
                root.viewModel.programStages.push(data);
                // TODO: Add ProgramStageDataElements to view model
            })
            .fail(function() {
                console.log("Could not fetch program stages from server.");
            });            
        }        
    };
    
    root.data = new data();
})(survey);



{'fraction_non_alphanumeric': 0.12753409509767785, 'fraction_numerical': 0.0007371913011426465, 'mean_word_length': 1.2659707724425888, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3990364', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1357, 'n_words': 256}