in clns-eTarget/src/main/webapp/js/app.js [2538:2618]
$scope.loadNGSSubset = function(personID){
if($scope.ctdnangs=='false') return;
$http({
method: 'GET',
url: 'api/data.jsp?endpoint=ctdnangssubset&personID='+personID
}).then(function successCallback(response) {
// Clear previous patient's results
$scope.currentPatient.ngsSubset.baseline = {};
if(typeof response.data.listGenes != "undefined"){
var listGenes = response.data.listGenes;
$scope.currentPatient.ngsSubset.listGenes = listGenes.join(', ');
}
// Check there are specimens for the current patient
if(typeof response.data.baseline['1'] != "undefined" && response.data.baseline['1'].specimen.specimenDate.length != 0) {
// Check there are results for the current patient
// sample taken but not analysed
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')) {
// Update the results
$scope.detailSection.ngsSubset.noResults.message = '';
$scope.currentPatient.ngsSubset.baseline = response.data.baseline;
$scope.currentPatient.ngsSubset.baselineList = $scope.getArray($scope.currentPatient.ngsSubset.baseline);
} else {
$scope.detailSection.ngsSubset.noResults.message = 'Results not available yet.';
$scope.detailSection.ngsSubset.noResults.specimenDate = response.data.baseline['1'].specimen.specimenDate;
$scope.currentPatient.ngsSubset.baselineList = [];
}
$scope.currentPatient.ngsSubset.specimenDate = response.data.baseline['1'].specimen.specimenDate;
} else if (typeof response.data.baseline['1'] != "undefined" && typeof response.data.baseline['1'].runs['1']['1'] == "undefined"){
$scope.detailSection.ngsSubset.noResults.message = 'Sample not taken.';
$scope.detailSection.ngsSubset.noResults.specimenDate = '';
$scope.currentPatient.ngsSubset.baseline = {};
// Hide the tables
$scope.currentPatient.ngsSubset.ngsLib = {};
$scope.currentPatient.ngsSubset.baselineList = [];
} else {
$scope.detailSection.ngsSubset.noResults.message = 'No blood samples found.';
$scope.detailSection.ngsSubset.noResults.specimenDate = '';
$scope.currentPatient.ngsSubset.baseline = {};
$scope.currentPatient.ngsSubset.baselineList = [];
// Hide the tables
$scope.currentPatient.ngsSubset.ngsLib = {};
}
// Nil result, 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" && (response.data.baseline['1'].runs['1']['1'].showNilResult == 'true'
|| response.data.baseline['1'].runs['1']['1'].noMutationsFound == 'true' || response.data.baseline['1'].runs['1']['1'].analysisFailed == 'true')) {
$scope.currentPatient.ngsSubset.baseline = response.data.baseline;
$scope.detailSection.ngsSubset.noResults.message = '';
}
if(typeof response.data.baseline['1'] != "undefined" && typeof response.data.baseline['1'].runs['1'] != "undefined"){
Object.keys($scope.currentPatient.ngsSubset.baseline).forEach(function(baseline, i) {
$scope['active_ctdna'][baseline]={};
Object.keys($scope.currentPatient.ngsSubset.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_ctdna'][baseline][key]=''+Object.keys($scope.currentPatient.ngsSubset.baseline[baseline].runs[key]).length;
});
});
}
for(var bl in $scope.currentPatient.ngsSubset.baseline){
if($scope.currentPatient.ngsSubset.baseline[bl].hasOwnProperty('runs') &&
(!$scope.currentPatient.ngsSubset.baseline[bl].runs.hasOwnProperty('1') ||
$scope.currentPatient.ngsSubset.baseline[bl].runs['1']['1'].hasOwnProperty('geneSubset') == false)){
$scope.currentPatient.ngsSubset.baseline[bl].message='Results not available yet.';
} else {
$scope.currentPatient.ngsSubset.baseline[bl].message='';
}
}
}, function errorCallback(response) {
//console.log('Error fetching ngs subset details: '+response.status);
});
}