Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
feat(project): updates to work with new data model
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Wilson committed Jan 21, 2015
1 parent b3c7401 commit afb1237
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 74 deletions.
16 changes: 9 additions & 7 deletions app/scripts/projects/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ module ngApp.projects {
fields: [
"disease_type",
"project_name",
"primary_site",
"status",
"program",
"project_code",
"_summary._participant_count",
"_summary._analyzed_data.data_type",
"_summary._analyzed_data._participant_count",
"_summary._analyzed_data._file_count",
"_summary._experimental_data._participant_count",
"_summary._experimental_data._file_count",
"_summary._experimental_data.experimental_type"
"summary.participant_count",
"summary.data_file_count",
"summary.data_types.data_type",
"summary.data_types.participant_count",
"summary.data_types.file_count",
"summary.experimental_strategies.participant_count",
"summary.experimental_strategies.file_count",
"summary.experimental_strategies.experimental_strategy"
]
});
}
Expand Down
23 changes: 13 additions & 10 deletions app/scripts/projects/projects.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,23 @@ module ngApp.projects.controllers {
"status",
"program",
"project_code",
"_summary._participant_count",
"_summary._analyzed_data.data_type",
"_summary._analyzed_data._participant_count",
"_summary._analyzed_data._file_count",
"_summary._experimental_data._participant_count",
"_summary._experimental_data._file_count",
"_summary._experimental_data.experimental_type"
"primary_site",
"summary.file_size",
"summary.participant_count",
"summary.data_file_count",
"summary.data_types.data_type",
"summary.data_types.participant_count",
"summary.data_types.file_count",
"summary.experimental_strategies.participant_count",
"summary.experimental_strategies.file_count",
"summary.experimental_strategies.experimental_strategy"
],
facets: [
"status",
"program",
"disease_type",
"_summary._experimental_data.experimental_type",
"_summary._analyzed_data.data_type"
"primary_site",
"summary.experimental_strategies.experimental_strategy",
"summary.data_types.data_type"
],
size: 100
}).then((data) => this.projects = data);
Expand Down
22 changes: 15 additions & 7 deletions app/scripts/projects/projects.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@ module ngApp.projects.models {
import ICollection = ngApp.models.ICollection;
import IEntity = ngApp.models.IEntity;

export interface IExperimentalData {
experimentalType: string;
export interface IExperimentalStrategies {
experimentalStrategies: string;
fileCount: number;
participantCount: number;
}

export interface IDataTypes {
experimentalStrategies: string;
fileCount: number;
participantCount: number;
}

export interface ISummary {
file_count: number;
data_file_count: number;
participantCount: number;
analyzedData: any;
experimentalData: IExperimentalData[];
dataTypes: IDataTypes[];
experimentalStrategies: IExperimentalStrategies[];
}

export interface IProjects extends ICollection {
Expand All @@ -21,9 +27,11 @@ module ngApp.projects.models {

export interface IProject extends IEntity {
project_name: string;
project_code: string;
program: string;
status: string;
program: string;
project_code: string;
disease_type: string;
list_updated: string;
summary: ISummary;
}
}
119 changes: 94 additions & 25 deletions app/scripts/projects/projects.table.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ngApp.projects.models {
import TableiciousConfig = ngApp.components.tables.directives.tableicious.TableiciousConfig;
import TableiciousEntryDefinition = ngApp.components.tables.directives.tableicious.TableiciousEntryDefinition;

function getFileSref(data_type:string) {
function getParticipantSref(data_type:string) {
return function fileSref (field: TableiciousEntryDefinition, row: TableiciousEntryDefinition[], scope, $filter: ng.IFilterService) {
var projectCode = _.find(row,function(elem){
return elem.id === 'project_code';
Expand All @@ -18,7 +18,8 @@ module ngApp.projects.models {

var projectTableModel:TableiciousConfig = {
title: 'Projects',
order: ['project_code', 'disease_type', 'program', 'participants', 'project_name', 'availableData', 'status', 'last_update'],
//order: ['project_code', 'disease_type', 'primary_site', 'program', 'participants', 'project_name', 'data_types', 'file_size', 'files', 'last_update'],
order: ['project_code'],
headings: [{
displayName: "Code",
id: "project_code",
Expand All @@ -30,6 +31,10 @@ module ngApp.projects.models {
displayName: "Disease Type",
id: "disease_type",
enabled: true
},{
displayName: "Primary Site",
id: "primary_site",
enabled: true
}, {
displayName: "Program",
id: "program",
Expand All @@ -39,8 +44,11 @@ module ngApp.projects.models {
displayName: "Participants",
id: "participants",
enabled: true,
template: function (field) {
return field && field.val || 321;
template: function (field, row) {
var summary:TableiciousEntryDefinition = _.find(row,function(x:TableiciousEntryDefinition){
return x.id === 'summary';
});
return summary.val.participant_count
},
sref: function (field:TableiciousEntryDefinition,row:TableiciousEntryDefinition[], scope, $filter: ng.IFilterService) {

Expand All @@ -57,8 +65,8 @@ module ngApp.projects.models {
id: "project_name",
enabled: false
}, {
displayName: "Available Data Files per Data Type",
id: "availableData",
displayName: "Available Participants per Data Type",
id: "data_types",
headingClass:'text-center',
enabled: true,
children: [{
Expand All @@ -67,51 +75,112 @@ module ngApp.projects.models {
enabled: true,
template: function (field:TableiciousEntryDefinition,row,scope) {
var summary:TableiciousEntryDefinition = _.find(row,function(x:TableiciousEntryDefinition){
return x.id === '_summary';
return x.id === 'summary';
});

var data = _.find(summary.val.data_types, function(x){
return x.data_type === 'Clinical';
});
var data:any = summary.val._analyzed_data['Clinical data'];
return data['file_count'];

return data && data.participant_count ? data.participant_count : 0;
},
sref: getFileSref('Clinical data')
}, {
displayName: 'SNV',
id: 'snv',
enabled: true,
sref: getFileSref('Simple nucleotide variant')
}, {
sref: getParticipantSref('Clinical')
}, {
displayName: 'mrnA',
id: 'mrna',
enabled: true,
sref: getFileSref('mRNA expression')
template: function (field:TableiciousEntryDefinition,row,scope) {
var summary:TableiciousEntryDefinition = _.find(row,function(x:TableiciousEntryDefinition){
return x.id === 'summary';
});

var data = _.find(summary.val.data_types, function(x){
return x.data_type === 'Gene expression';
});

return data && data.participant_count ? data.participant_count : 0;
},
sref: getParticipantSref('Gene expression')
}, {
displayName: 'miRNA',
id: 'mirna',
enabled: true,
sref: getFileSref('miRNA expression')
template: function (field:TableiciousEntryDefinition,row,scope) {
var summary:TableiciousEntryDefinition = _.find(row,function(x:TableiciousEntryDefinition){
return x.id === 'summary';
});

var data = _.find(summary.val.data_types, function(x){
return x.data_type === 'Raw microarray data';
});

return data && data.participant_count ? data.participant_count : 0;
},
sref: getParticipantSref('Raw microarray data')
}, {
displayName: 'CNV',
id: 'cnv',
enabled: true,
sref: getFileSref('Copy number variant')
template: function (field:TableiciousEntryDefinition,row,scope) {
var summary:TableiciousEntryDefinition = _.find(row,function(x:TableiciousEntryDefinition){
return x.id === 'summary';
});

var data = _.find(summary.val.data_types, function(x){
return x.data_type === 'Copy number variation';
});

return data && data.participant_count ? data.participant_count : 0;
},
sref: getParticipantSref('Copy number variation')
}, {
displayName: 'Meth',
id: 'meth',
enabled: true,
sref: getFileSref('DNA methylation')
template: function (field:TableiciousEntryDefinition,row,scope) {
var summary:TableiciousEntryDefinition = _.find(row,function(x:TableiciousEntryDefinition){
return x.id === 'summary';
});

var data = _.find(summary.val.data_types, function(x){
return x.data_type === 'DNA methylation';
});

return data && data.participant_count ? data.participant_count : 0;
},
sref: getParticipantSref('DNA methylation')
}]
}, {
displayName: "Status",
id: "status",
displayName: "Files",
id: "data_file_count",
enabled: true,
template: function (field, row) {
var summary:TableiciousEntryDefinition = _.find(row,function(x:TableiciousEntryDefinition){
return x.id === 'summary';
});
return summary.val.data_file_count
},
sref: function (field:TableiciousEntryDefinition,row:TableiciousEntryDefinition[], scope, $filter: ng.IFilterService) {
var projectCode = _.find(row,function(elem){
return elem.id === 'project_code';
}).val;

var filter = $filter("makeFilter")([{name: 'participants.admin.disease_code', value: projectCode }]);
return "search.files({ 'filters':"+filter+"})";
}
}, {
displayName: "File Size",
id: "file_size",
enabled: true,
template: function (field) {
return field && field.val || 'legacy';
return field && field.val || 0;
}
}, {
displayName: "Last Update",
id: "last_update",
id: "last_updated",
enabled: true,
template: function (field) {
return field && field.val || '01/12/2015';
return field && field.val || 0;
}
}
]
Expand Down
Loading

0 comments on commit afb1237

Please sign in to comment.