in clns-eTarget/src/main/webapp/js/app.js [2620:2697]
$scope.loadNGSExploartory = function(personID){
if($scope.ctdnaexploratory=='false') return;
$http({
method: 'GET',
url: 'api/data.jsp?endpoint=ctdnaexploratory&personID='+personID
}).then(function successCallback(response) {
// Clear previous patient's results
$scope.currentPatient.exploratory.baseline = {};
// Check there are specimens for the current patient
if(typeof response.data.baseline['1'] != "undefined" && typeof response.data.baseline['1'].specimen.specimenDate.length != "undefined") {
// Check there are results for the current patient
if(typeof response.data.baseline['1'].runs['1'] != "undefined" && typeof response.data.baseline['1'].runs['1']['1'] != "undefined" && ((response.data.baseline['1'].runs['1']['1'].hasOwnProperty('geneSubset') && response.data.baseline['1'].runs['1']['1'].geneSubset.length > 0) || response.data.baseline['1'].runs['1']['1'].showNilResult == "true")) {
$scope.detailSection.exploratory.noResults.message = '';
$scope.currentPatient.exploratory.baseline = response.data.baseline;
$scope.currentPatient.exploratory.baselineList = $scope.getArray($scope.currentPatient.exploratory.baseline);
// Show the tables
// $scope.detailSection.ctdnaExploratorySubs.ctdnaData = true;
// $scope.detailSection.ctdnaExploratorySubs.ngsLib = true;
} else {
$scope.detailSection.exploratory.noResults.message = 'Results not available yet.';
$scope.detailSection.exploratory.noResults.specimenDate = response.data.baseline['1'].specimen.specimenDate;
$scope.currentPatient.exploratory.baselineList = [];
//console.log('set specimen Date ' + $scope.detailSection.exploratory.noResults.specimenDate);
// Hide the tables
// $scope.detailSection.ctdnaExploratorySubs.ctdnaData = false;
// $scope.detailSection.ctdnaExploratorySubs.ngsLib = false;
}
} else if (typeof response.data.baseline['1'] != "undefined" && typeof response.data.baseline['1'].runs['1']['1'] == "undefined") {
$scope.detailSection.exploratory.noResults.message = 'Sample not taken.';
$scope.detailSection.exploratory.noResults.specimenDate = '';
$scope.currentPatient.exploratory.baseline = {};
$scope.currentPatient.exploratory.listGenes = '';
} else {
$scope.detailSection.exploratory.noResults.message = 'No blood samples found.';
$scope.detailSection.exploratory.noResults.specimenDate = '';
$scope.currentPatient.exploratory.baseline = {};
$scope.currentPatient.exploratory.listGenes = '';
}
// Nil result or analysisFailed
if(typeof response.data.baseline['1'] != "undefined" && (typeof response.data.baseline['1'].runs['1']=='undefined' ||
typeof response.data.baseline['1'].runs['1']['1']== 'undefined')){
} else if(typeof response.data.baseline['1'] != "undefined" && (response.data.baseline['1'].runs['1']['1'].showNilResult == 'true' || response.data.baseline['1'].runs['1']['1'].analysisFailed== 'true' || response.data.baseline['1'].runs['1']['1'].noMutationsFound== 'true')) {
$scope.currentPatient.exploratory.baseline = response.data.baseline;
$scope.detailSection.exploratory.noResults.message = '';
}
if(typeof response.data.baseline['1'] != "undefined" && typeof response.data.baseline['1'].runs['1'] != "undefined"){
Object.keys($scope.currentPatient.exploratory.baseline).forEach(function(baseline, i) {
$scope['active_exploratory'][baseline]={};
Object.keys($scope.currentPatient.exploratory.baseline[baseline].runs).forEach(function(key,index) {
// key: the name of the object key
// index: the ordinal position of the key within the object
$scope['active_exploratory'][baseline][key]=''+Object.keys($scope.currentPatient.exploratory.baseline[baseline].runs[key]).length;
});
});
}
for(var bl in $scope.currentPatient.exploratory.baseline){
if($scope.currentPatient.exploratory.baseline[bl].hasOwnProperty('runs') &&
(!$scope.currentPatient.exploratory.baseline[bl].runs.hasOwnProperty('1') ||
$scope.currentPatient.exploratory.baseline[bl].runs['1']['1'].hasOwnProperty('geneSubset') == false)){
$scope.currentPatient.exploratory.baseline[bl].message='Results not available yet.';
} else {
$scope.currentPatient.exploratory.baseline[bl].message='';
}
}
}, function errorCallback(response) {
//console.log('Error fetching exploratory details: '+response.status);
});
}