Skip to content

Commit

Permalink
Merge pull request #173 from dbmi-bgm/cohort-to-case-edits
Browse files Browse the repository at this point in the history
Cohort to case edits
  • Loading branch information
Bianca-Morris committed Aug 11, 2020
2 parents 12c43d6 + 2f81ebd commit d161866
Show file tree
Hide file tree
Showing 25 changed files with 82 additions and 3,092 deletions.
204 changes: 0 additions & 204 deletions src/encoded/static/components/browse/CaseSearchView.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/encoded/static/components/forms/CGAPSubmissionView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import memoize from 'memoize-one';
import url from 'url';

import SubmissionView from '@hms-dbmi-bgm/shared-portal-components/es/components/forms/SubmissionView';
import CohortSubmissionView from './../item-pages/CohortView/CohortSubmissionView';
// import CaseSubmissionView from './../item-pages/CaseView/CaseSubmissionView';


export function getSubmissionItemType(context, href){
Expand Down
4 changes: 1 addition & 3 deletions src/encoded/static/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import ReleaseUpdates from './static-pages/ReleaseUpdates';


import DefaultItemView from './item-pages/DefaultItemView';
import CohortView, { CohortSubmissionView } from './item-pages/CohortView';
import CaseView, { CaseSubmissionView } from './item-pages/CaseView';
import IndividualView from './item-pages/IndividualView';
import FileProcessedView from './item-pages/FileProcessedView';
Expand All @@ -47,7 +46,6 @@ content_views.register(ReleaseUpdates, 'Release-updatesPage');

content_views.register(DefaultItemView, 'Item');
content_views.register(CaseView, 'Case');
content_views.register(CohortView, 'Cohort');
content_views.register(IndividualView, 'Individual');
content_views.register(FileProcessedView, 'FileProcessed');
content_views.register(SampleView, 'Sample');
Expand All @@ -62,7 +60,7 @@ content_views.register(CGAPSubmissionView, 'Item', 'edit');
content_views.register(CGAPSubmissionView, 'Item', 'create');
content_views.register(CGAPSubmissionView, 'Item', 'clone');
content_views.register(CGAPSubmissionView, 'Search', 'add');
content_views.register(CohortSubmissionView, 'CohortSearchResults', 'add');
// content_views.register(CaseSubmissionView, 'CaseSearchResults', 'add');

content_views.register(SearchView, 'Search');
content_views.register(SearchView, 'Search', 'selection');
Expand Down
32 changes: 15 additions & 17 deletions src/encoded/static/components/item-pages/CaseView/CaseStats.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';

import React, { useState, useMemo } from 'react';
import React from 'react';
import _ from 'underscore';
import { Collapse } from '@hms-dbmi-bgm/shared-portal-components/es/components/ui/Collapse';
import { LocalizedTime, formatPublicationDate } from '@hms-dbmi-bgm/shared-portal-components/es/components/ui/LocalizedTime';


Expand All @@ -26,12 +25,9 @@ function mapFeaturesToBadges(features = []) {
});
}

/** @param {Object} props - Contents of a family sub-embedded object. */
/** @param {Object} props - Contents of a caseItem */
export const CaseStats = React.memo(function CaseStats(props){
const {
numFamilies = 0,
numIndividuals = 0,
numWithSamples = 0,
className = '',
caseItem = null
} = props;
Expand All @@ -53,7 +49,7 @@ export const CaseStats = React.memo(function CaseStats(props){
<PhenotypicFeatures caseItem={caseItem} />
</StatCard>
<StatCard title="Family Info:" subtitle={famAccession} className="flex-fill">
<FamilyInfo {...{ numFamilies, numIndividuals, numWithSamples, family }} />
<FamilyInfo {...{ family, caseItem }} />
</StatCard>
</div>
</div>
Expand All @@ -80,7 +76,6 @@ export const PatientInfo = React.memo(function PatientInfo(props) {
const {
caseItem = null
} = props || {};
console.log("patientinfo props", props);

const { '@id': atId, case_title = null, individual = null } = caseItem || {};
const {
Expand All @@ -103,7 +98,7 @@ export const PatientInfo = React.memo(function PatientInfo(props) {
<label className="mb-0">Sex:</label> { sex || 'N/A'}
</div>
<div className="card-text mb-1">
<label className="mb-0">Age: </label> { age && age_units ? `${age} age_units` : "N/A" }
<label className="mb-0">Age: </label> { age && age_units ? `${age} ${age_units}(s)` : "N/A" }
</div>
<div className="card-text mb-1">
<label className="mb-0">Life Status:</label> { life_status || 'N/A' }
Expand All @@ -130,28 +125,31 @@ export const PhenotypicFeatures = React.memo(function PhenotypicFeatures({ caseI
});


export const FamilyInfo = React.memo(function FamilyInfo({ family }) {
export const FamilyInfo = React.memo(function FamilyInfo({ family, caseItem }) {
const {
display_title : family_display_title = null,
title: family_title= null,
display_title : familyDisplayTitle = null,
title: familyTitle= null,
family_phenotypic_features: familyFeatures = [],
cohort = null,
project = null
} = family || {};
const { display_title: project_title } = project || {};
const { display_title: projectTitle } = project || {};
const {
cohort = null
} = caseItem || {};
const { display_title: cohortTitle = null } = cohort || {};

const renderedPhenotypicFeatures = mapFeaturesToBadges(familyFeatures);

return (
<>
<div className="card-text mb-1">
<label className="mb-0">Family:</label> { family_title || family_display_title || "N/A" }
<label className="mb-0">Family:</label> { familyTitle || familyDisplayTitle || "N/A" }
</div>
<div className="card-text mb-1">
<label className="mb-0">Cohort:</label> { cohort || "N/A" }
<label className="mb-0">Cohort:</label> { cohortTitle || "N/A" }
</div>
<div className="card-text mb-1">
<label className="mb-0">Project:</label> { project_title || "N/A" }
<label className="mb-0">Project:</label> { projectTitle || "N/A" }
</div>
<div className="card-text">
<label className="mb-03">Family Phenotypic Features: </label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class PanelOne extends React.PureComponent {
});
};

const postData = { title, institution, project };
const postData = { case_id: title, institution, project };

this.setState({ isCreating: true }, ()=>{
this.request = ajax.load(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,25 +527,9 @@ export const CaseSummaryTable = React.memo(function CaseSummaryTable(props){
const renderedSummary = (membersWithoutSamplesLen + membersWithoutViewPermissionsLen) > 0 ? (
<div className="processing-summary">
{ membersWithoutSamplesLen > 0 ?
<p className="pl-2 mb-0">
<p className="pl-1 mb-0">
<span className="text-600">{ membersWithoutSamplesLen }</span> members without samples.
</p>
/*
<React.Fragment>
<p className="mb-0">{ (membersWithoutSamplesLen + " members without samples: ") }</p>
{
membersWithoutSamples.map(function(member, idx){
const { '@id' : id, display_title } = member;
return (
<React.Fragment key={id}>
{ idx !== 0 ? ", " : null }
<a href={id}>{ display_title }</a>
</React.Fragment>
);
})
}
</React.Fragment>
*/
: null }
{ membersWithoutViewPermissionsLen > 0 ?
<p className="mb-0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { idToGraphIdentifier } from './PedigreeTabViewBody';
export class CurrentFamilyController extends React.PureComponent {

static haveFullViewPermissionForFamily(family){
if (!family) { return false; }
const { original_pedigree = null, proband = null, members = [] } = family;
// if (original_pedigree && !object.isAnItem(original_pedigree)){
// // Tests for presence of display_title and @id, lack of which indicates lack of view permission.
Expand Down
Loading

0 comments on commit d161866

Please sign in to comment.