Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProjectsTable, FilesTable, and RepoCasesTable #1

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ type Case implements Node {
submitter_slide_ids: String
annotations: CaseAnnotations
demographic: Demographic
metadata_participant: MetadataParticipant
metadata_sample: [MetadataSample]
diagnoses: Diagnoses
files: CaseFiles
exposures: Exposures
Expand All @@ -629,6 +631,46 @@ type Case implements Node {
score: Int
}

type MetadataParticipant{
participant: Int
age_2012: Int
totMETs1: Float
weight_lbs: Float
}

type MetadataSample{

id: Int
project: String
sample: String
participant: Int
DaysSince1Jan12: Int
drAlcohol: Float
drB12: Float
drCalories: Float
drCarbs: Float
drCholine: Float
drFat: Float
drFiber: Float
drFolate: Float
drIron: Float
drProtein: Float
participant: Int
q2Alcohol: String
q2B12: String
q2Calories: String
q2Carbs: String
q2Choline: String
q2Fat: String
q2Fiber: String
q2Folate: String
q2Iron: String
q2Protein: String
Time: String
week: Int
}


type CaseAggregations {
updated_datetime: Aggregations
submitter_analyte_ids: Aggregations
Expand Down Expand Up @@ -657,6 +699,9 @@ type CaseAggregations {
demographic__demographic_id: Aggregations
demographic__ethnicity: Aggregations
demographic__year_of_death: NumericAggergations
metadata_participant__age_2012: Aggregations
metadata_participant__totMETs1: Aggregations
metadata_participant__weight_lbs: Aggregations
lost_to_followup: Aggregations
state: Aggregations
case_id: Aggregations
Expand Down
59 changes: 55 additions & 4 deletions src/packages/@ncigdc/components/TabPieCharts/RepoCasesPies.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export type TProps = {
demographic__ethnicity: { buckets: [TBucket] },
demographic__gender: { buckets: [TBucket] },
demographic__race: { buckets: [TBucket] },
metadata_participant__age_2012: { buckets: [TBucket] },
metadata_participant__totMETs1: { buckets: [TBucket] },
metadata_participant__weight_lbs: { buckets: [TBucket] },
primary_site: { buckets: [TBucket] },
project__program__name: { buckets: [TBucket] },
project__project_id: { buckets: [TBucket] },
Expand Down Expand Up @@ -60,11 +63,41 @@ const RepoCasesPiesComponent = ({ aggregations, query, push }: TProps) => {
width={125}
/>
</ColumnCenter>
<ColumnCenter className="test-gender">
<PieTitle>Gender</PieTitle>
<ColumnCenter className="test-age">
<PieTitle>Age in 2012</PieTitle>
<SelfFilteringPie
buckets={_.get(aggregations, 'demographic__gender.buckets')}
fieldName="cases.demographic.gender"
buckets={_.get(aggregations, 'metadata_participant__age_2012.buckets')}
fieldName="cases.metadata_participant.age_2012"
docTypeSingular="case"
currentFieldNames={currentFieldNames}
currentFilters={currentFilters}
query={query}
push={push}
path="doc_count"
height={125}
width={125}
/>
</ColumnCenter>
<ColumnCenter className="test-weight">
<PieTitle>Weight Lbs</PieTitle>
<SelfFilteringPie
buckets={_.get(aggregations, 'metadata_participant__weight_lbs.buckets')}
fieldName="cases.metadata_participant.weight_lbs"
docTypeSingular="case"
currentFieldNames={currentFieldNames}
currentFilters={currentFilters}
query={query}
push={push}
path="doc_count"
height={125}
width={125}
/>
</ColumnCenter>
<ColumnCenter className="test-totMETs1">
<PieTitle>totMETs1</PieTitle>
<SelfFilteringPie
buckets={_.get(aggregations, 'metadata_participant__totMETs1.buckets')}
fieldName="cases.metadata_participant.totMETs1"
docTypeSingular="case"
currentFieldNames={currentFieldNames}
currentFilters={currentFilters}
Expand Down Expand Up @@ -101,6 +134,24 @@ export const RepoCasesPiesQuery = {
key
}
}
metadata_participant__age_2012 {
buckets {
doc_count
key
}
}
metadata_participant__totMETs1 {
buckets {
doc_count
key
}
}
metadata_participant__weight_lbs {
buckets {
doc_count
key
}
}
primary_site {
buckets {
doc_count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export type TProps = {
facets: { facets: string },
parsedFacets: Object,
aggregations: {
demographic__ethnicity: { buckets: [TBucket] },
demographic__gender: { buckets: [TBucket] },
demographic__race: { buckets: [TBucket] },
metadata_participant__age_2012: { buckets: [TBucket] },
metadata_participant__totMETs1: { buckets: [TBucket] },
metadata_participant__weight_lbs: { buckets: [TBucket] },
primary_site: { buckets: [TBucket] },
project__program__name: { buckets: [TBucket] },
project__project_id: { buckets: [TBucket] },
Expand Down Expand Up @@ -81,23 +81,23 @@ const presetFacets = [
type: 'terms',
},
{
title: 'Gender',
field: 'demographic.gender',
full: 'cases.demographic.gender',
title: 'Age in 2012',
field: 'metadata_participant.age_2012',
full: 'cases.metadata_participant.age_2012',
doc_type: 'cases',
type: 'keyword',
},
{
title: 'Race',
field: 'demographic.race',
full: 'cases.demographic.race',
title: 'totMETs1',
field: 'metadata_participant.totMETs1',
full: 'cases.metadata_participant.totMETs1',
doc_type: 'cases',
type: 'keyword',
},
{
title: 'Ethnicity',
field: 'demographic.ethnicity',
full: 'cases.demographic.ethnicity',
title: 'Weight Lbs',
field: 'metadata_participant.weight_lbs',
full: 'cases.metadata_participant.weight_lbs',
doc_type: 'cases',
type: 'keyword',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ export default (Component: ReactClass<*>) =>
key
}
}
demographic__gender {
metadata_participant__age_2012 {
buckets {
doc_count
key
}
}
demographic__race {
metadata_participant__totMETs1 {
buckets {
doc_count
key
}
}
demographic__ethnicity {
metadata_participant__weight_lbs {
buckets {
doc_count
key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { makeFilter } from '@ncigdc/utils/filters';
import FileSize from '@ncigdc/components/FileSize';

import { PROJECTLINK } from '@ncigdc/utils/constants'
import { STORAGELINK } from '@ncigdc/utils/constants'

const filesTableModel = [
{
Expand Down Expand Up @@ -45,12 +46,13 @@ const filesTableModel = [
{
name: 'File Name',
id: 'file_name',
file_id: 'file_id',
sortable: true,
downloadable: true,
th: () => <Th>File Name</Th>,
td: ({ node }) => (
<Td style={{ whiteSpace: 'pre-line', wordBreak: 'break-all' }}>
<a href={PROJECTLINK}>
<a href={node.file_id.replace("gs://",STORAGELINK)}>
{node.file_name}
</a>
</Td>
Expand All @@ -65,7 +67,7 @@ const filesTableModel = [
{uniq(
node.cases.hits.edges.map(e => e.node.project.project_id),
).map(pId => (
<a href={PROJECTLINK}>
<a href={PROJECTLINK + pId}>
{pId}
</a>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const projectsTableModel = [
th: () => <Th rowSpan="2">Project</Th>,
td: ({ node }) => (
<Td>
<a href={PROJECTLINK}>
<a href={PROJECTLINK+node.project_id}>
{node.project_id}
</a>
</Td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,15 @@ const casesTableModel = [
),
td: ({ node, index }) => (
<Td>
{node.submitter_id}
<CaseLink
uuid={node.case_id}
id={`row-${index}-case-link`}
merge
whitelist={['filters']}
>
{node.submitter_id}
</CaseLink>

</Td>
),
},
Expand All @@ -110,7 +118,7 @@ const casesTableModel = [
),
td: ({ node, index }) => (
<Td>
<a href={PROJECTLINK}>
<a href={PROJECTLINK+node.project.project_id}>
{node.project.project_id}
</a>
</Td>
Expand All @@ -129,18 +137,50 @@ const casesTableModel = [
td: ({ node }) => <Td key="primary_site">{node.primary_site}</Td>,
},
{
name: 'Gender',
id: 'demographic.gender',
name: 'Age in 2012',
id: 'metadata_participant.age_2012',
sortable: true,
downloadable: true,
th: () => (
<Th key="metadata_participant.age_2012" rowSpan="1">
Age in 2012
</Th>
),
td: ({ node }) => (
<Td key="metadata_participant.age_2012">
{_.capitalize(node.metadata_participant.age_2012) || '--'}
</Td>
),
},
{
name: 'Weight Lbs',
id: 'metadata_participant.weight_lbs',
sortable: true,
downloadable: true,
th: () => (
<Th key="metadata_participant.weight_lbs" rowSpan="1">
Weight Lbs
</Th>
),
td: ({ node }) => (
<Td key="metadata_participant.weight_lbs">
{_.capitalize(node.metadata_participant.weight_lbs) || '--'}
</Td>
),
},
{
name: 'totMETs1',
id: 'metadata_participant.totMETs1',
sortable: true,
downloadable: true,
th: () => (
<Th key="demographic.gender" rowSpan="2">
Gender
<Th key="metadata_participant.totMETs1" rowSpan="1">
totMETs1
</Th>
),
td: ({ node }) => (
<Td key="demographic.gender">
{_.capitalize(node.demographic.gender) || '--'}
<Td key="metadata_participant.totMETs1">
{_.capitalize(node.metadata_participant.totMETs1) || '--'}
</Td>
),
},
Expand Down Expand Up @@ -182,28 +222,6 @@ const casesTableModel = [
th: () => <Th rowSpan="2">Program</Th>,
td: ({ node }) => <Td>{node.project.program.name}</Td>,
},
{
name: 'Ethnicity',
id: 'demographic.ethnicity',
sortable: false,
downloadable: true,
hidden: true,
th: () => <Th rowSpan="2">Ethnicity</Th>,
td: ({ node }) => (
<Td>{(node.demographic && node.demographic.ethnicity) || '--'}</Td>
),
},
{
name: 'Race',
id: 'demographic.race',
sortable: false,
downloadable: true,
hidden: true,
th: () => <Th rowSpan="2">Race</Th>,
td: ({ node }) => (
<Td>{(node.demographic && node.demographic.race) || '--'}</Td>
),
},
];

export default casesTableModel;
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,15 @@ export default (Component: React.Class<*>) =>
}
}
}
demographic {
gender
ethnicity
race
metadata_participant {
age_2012
weight_lbs
totMETs1
}
metadata_sample {
week
drFiber
drCalories
}
summary {
data_categories {
Expand Down
3 changes: 2 additions & 1 deletion src/packages/@ncigdc/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const localStorage = window.localStorage || {};

/* Links */

export const PROJECTLINK = "https://portal.firecloud.org/"
export const PROJECTLINK = "https://portal.firecloud.org/#workspaces/firecloud-biom-mass/"
export const STORAGELINK = "https://storage.cloud.google.com/"

/* API ENDPOINTS */

Expand Down