Skip to content

Commit

Permalink
Merge pull request #1525 from kids-first/next πŸš€πŸš€πŸš€πŸš€πŸš€ Deploys cohort bu…
Browse files Browse the repository at this point in the history
…ilder & DCF integration! :D

πŸš€πŸš€πŸš€πŸš€πŸš€ Deploys cohort builder & DCF integration! :D
  • Loading branch information
hlminh2000 authored Mar 30, 2019
2 parents 4a49024 + c3e7f57 commit e8074d6
Show file tree
Hide file tree
Showing 28 changed files with 789 additions and 710 deletions.
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import logo from 'assets/logo-kids-first-data-portal.svg';
import { requireLogin } from './common/injectGlobals';
import { withApi } from 'services/api';
import { initializeApi, ApiContext } from 'services/api';
import { DCF, GEN3 } from 'common/constants';
import { DCF, GEN3, COHORT_BUILDER_PATH } from 'common/constants';

const forceSelectRole = ({ loggedInUser, isLoadingUser, WrapperPage = Page, ...props }) => {
if (!loggedInUser && requireLogin) {
Expand Down Expand Up @@ -95,7 +95,7 @@ const App = compose(
<Route path="/auth-redirect" exact component={AuthRedirect} />
<Route path="/redirected" exact component={() => null} />
<Route
path="/virtualStudies"
path={COHORT_BUILDER_PATH}
exact
render={props =>
forceSelectRole({
Expand Down
7 changes: 7 additions & 0 deletions src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,20 @@ export const FENCES = [GEN3, DCF];
export const CAVATICA = 'cavatica';
export const SERVICES = [...FENCES, CAVATICA];

export const CAVATICA_DATASET_MAPPING = {
[DCF]: 'sevenbridges/target',
[GEN3]: 'sevenbridges/kids-first',
};

export const GOOGLE = 'google';
export const FACEBOOK = 'facebook';

export const UI_VERSION = packageJson.version;

export const EGO_JWT_KEY = 'EGO_JWT';

export const COHORT_BUILDER_PATH = '/explore';

export const DISEASE_AREAS = [
'Patients With Both Childhood Cancer And Birth Defects',
'Childhood Cancer',
Expand Down
6 changes: 3 additions & 3 deletions src/components/CohortBuilder/Summary/FileBreakdown/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export const toFileSqon = participantSqon => {

export const dataTypesExpStratPairsQuery = participantSqon => ({
query: gql`
query FileBreakdownQuery($sqon: JSON) {
query FileBreakdownQuery {
file {
aggregations(aggregations_filter_themselves: true, include_missing: true, filters: $sqon) {
aggregations(aggregations_filter_themselves: true, include_missing: true) {
sequencing_experiments__experiment_strategy {
buckets {
key
Expand All @@ -36,7 +36,7 @@ export const dataTypesExpStratPairsQuery = participantSqon => ({
}
}
`,
variables: { sqon: toFileSqon(participantSqon) },
variables: {},
transform: data => {
const experimentStrategies = get(
data,
Expand Down
69 changes: 41 additions & 28 deletions src/components/CohortBuilder/Summary/SurvivalChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { withApi } from 'services/api';
import { fetchSurvivalData } from 'services/arranger';
import md5 from 'md5';
import CardContent from 'uikit/Card/CardContent';
import { SizeProvider } from 'components/Utils';
import PromptMessage from 'uikit/PromptMessage';

const SurvivalChartWrapper = styled('div')`
margin-top: 10px;
Expand Down Expand Up @@ -183,8 +185,6 @@ const StyledSurvivalPlot = styled(SurvivalPlot)`
}
`;

// transform: translatey(7px);

class SurvivalChart extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -288,33 +288,46 @@ class SurvivalChart extends React.Component {
};

return (
<CohortCard
Content={SurvivalCardContent}
title="Overall Survival"
loading={this.state.isLoading}
>
<SurvivalChartWrapper>
<SurvivalChartHeader>
Applicable survival data for <a>{get(data, '[0].donors.length', 0)} Participants</a>
</SurvivalChartHeader>
<StyledSurvivalPlot
dataSets={data}
onMouseLeaveDonors={this.handleMouseLeaveDonors}
onMouseEnterDonors={this.handleMouseEnterDonors}
/>
<div style={tooltipStyle}>
<strong>{donor.id}</strong>
<div>Survival Rate: {(donor.survivalEstimate * 100).toFixed(2)}%</div>
{donor.isCensored ? (
<div>Censored Survival Time: {donor.time} days (censored)</div>
) : (
<div>Survival Time: {donor.time} days </div>
)}
</div>
</SurvivalChartWrapper>
</CohortCard>
<SizeProvider>
{({ size }) => (
<CohortCard
Content={SurvivalCardContent}
title="Overall Survival"
loading={this.state.isLoading}
>
<SurvivalChartWrapper>
<SurvivalChartHeader>
Applicable survival data for <a>{get(data, '[0].donors.length', 0)} Participants</a>
</SurvivalChartHeader>

<StyledSurvivalPlot
size={size}
dataSets={data}
onMouseLeaveDonors={this.handleMouseLeaveDonors}
onMouseEnterDonors={this.handleMouseEnterDonors}
/>

<div style={tooltipStyle}>
<strong>{donor.id}</strong>
<div>Survival Rate: {(donor.survivalEstimate * 100).toFixed(2)}%</div>
{donor.isCensored ? (
<div>Censored Survival Time: {donor.time} days (censored)</div>
) : (
<div>Survival Time: {donor.time} days </div>
)}
</div>
</SurvivalChartWrapper>
</CohortCard>
)}
</SizeProvider>
);
}
}

export default compose(withApi)(SurvivalChart);
// export default compose(withApi)(SurvivalChart);

export default () => (
<CohortCard Content={SurvivalCardContent} title="Overall Survival">
<PromptMessage heading={'BETA'} content={<div>Visualization coming soon</div>} />
</CohortCard>
);
27 changes: 19 additions & 8 deletions src/components/CohortBuilder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import VirtualStudyListProvider from './VirtualStudyListProvider';
import SaveVirtualStudiesModalContent from './SaveVirtualStudiesModalContent';
import SaveIcon from 'icons/SaveIcon';
import ShareQuery from 'components/ShareSaveQuery/ShareQuery';
import PromptMessage from 'uikit/PromptMessage';

const Container = styled('div')`
width: 100%;
Expand All @@ -49,11 +50,6 @@ const FullWidthWhite = styled('div')`
margin-top: 21px;
`;

const CategoriesContainer = styled('div')`
padding-left: 30px;
padding-right: 30px;
`;

const SqonBuilderContainer = styled('div')`
padding-top: 20px;
padding-bottom: 20px;
Expand All @@ -64,7 +60,12 @@ const SqonBuilderContainer = styled('div')`
`;

const Content = styled(ContentBar)`
padding: 0 20px 0 32px;
padding-left: 30px;
padding-right: 30px;
`;

const StylePromptMessage = styled(PromptMessage)`
width: 100%;
`;

const SaveButtonText = styled('span')`
Expand Down Expand Up @@ -193,6 +194,16 @@ const CohortBuilder = compose(

return (
<Container>
<StylePromptMessage
content={
<div>
<strong>BETA RELEASE: </strong>Use the cohort builder to create virtual studies.
You can query participant variables including demographic, clinical, and data
categories. It's in progress, so you may experience some bugs. To give feedback,
click the button in the bottom right corner. All feedback is welcome!
</div>
}
/>
<Content>
<Row>
<Heading>Explore Data</Heading>
Expand Down Expand Up @@ -235,9 +246,9 @@ const CohortBuilder = compose(
</Row>
</Content>
<FullWidthWhite>
<CategoriesContainer>
<Content>
<Categories sqon={executableSqon} onSqonUpdate={categoriesSqonUpdate} />
</CategoriesContainer>
</Content>
<SqonBuilderContainer>
<SqonBuilder
syntheticSqons={syntheticSqons}
Expand Down
4 changes: 3 additions & 1 deletion src/components/EntityPage/File/Download.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ const StyledDownloadButton = styled(DownloadButton)`
const Download = compose(
withApi,
withTheme,
)(({ kfId, theme, disabled, ...props }) =>
)(({ kfId, fence, theme, disabled, ...props }) =>
disabled ? (
<Fragment>
<DownloadFileButton
kfId={kfId}
fence={fence}
render={props => <StyledDownloadButton {...props} disabled />}
{...props}
/>
Expand All @@ -64,6 +65,7 @@ const Download = compose(
) : (
<DownloadFileButton
kfId={kfId}
fence={fence}
render={props => <StyledDownloadButton {...props} />}
{...props}
/>
Expand Down
3 changes: 2 additions & 1 deletion src/components/EntityPage/File/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ const fileQuery = `query ($sqon: JSON) {
file_format
file_name
is_harmonized
kf_id
latest_did
modified_at
reference_genome
repository
size
sequencing_experiments {
hits {
Expand Down Expand Up @@ -313,6 +313,7 @@ const FileEntity = compose(withTheme)(
});
}}
kfId={data.kf_id}
fence={data.repository}
disabled={!hasFilePermission}
/>
<ShareButton link={window.location.href} />
Expand Down
Loading

0 comments on commit e8074d6

Please sign in to comment.