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

TASK-5964 - Clinical Improvements #948

Merged
merged 49 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a443288
wc: Refactor getDisplayName from web-utils module #TASK-6396 #TASK-5964
jmjuanes Jun 19, 2024
8dacd6b
wc: Add interpretation name to the form for creating a new interpreta…
jmjuanes Jun 19, 2024
978a409
wc: Add name field in the interpretation-update component #TASK-6396 …
jmjuanes Jun 19, 2024
a286ddf
wc: Fix getting available status configured in study in clinical anal…
jmjuanes Jun 27, 2024
54ac234
wc: Fix style when rendering available status in clinical analysis gr…
jmjuanes Jun 27, 2024
3e771d3
wc: Fix status displayed in clinical analysis update #TASK-6396 #TASK…
jmjuanes Jun 27, 2024
c1b741d
wc: Fix status displayed in catalog browsers #TASK-6396 #TASK-5964
jmjuanes Jun 27, 2024
5328b03
wc: Fix flags displayed in clinical analysis create #TASK-6396 #TASK-…
jmjuanes Jun 27, 2024
314ef60
wc: Fix flags displayed in clinical analysis update #TASK-6396 #TASK-…
jmjuanes Jun 27, 2024
216089e
wc: Remove adding defaultFilter from study config in interpreter brow…
jmjuanes Jun 27, 2024
b236793
wc: Remove adding defaultFilter from study config in interpreter brow…
jmjuanes Jun 27, 2024
21cfadd
wc: Fix displaying interpretation name and id in interpretation summa…
jmjuanes Jun 27, 2024
60ecf10
wc: Fix displaying interpretation name and id in variant-interpreter …
jmjuanes Jun 27, 2024
49b4abc
wc: Remove status.name in cohort components #TASK-6396 #TASK-5964
jmjuanes Jun 28, 2024
ebb2701
wc: Remove uasge of status.name in clinical analysis components #TASK…
jmjuanes Jun 28, 2024
1c7cd1d
wc: Remove usage of status.name in cohort-view #TASK-6396 #TASK-5964
jmjuanes Jun 28, 2024
4ecc639
wc: Remove usage of status.name in family components #TASK-6396 #TASK…
jmjuanes Jun 28, 2024
85daf4a
wc: Remove usage of status.name in file components #TASK-6396 #TASK-5964
jmjuanes Jun 28, 2024
8c8203b
wc: Remove usage of status.name in individual components #TASK-6396 #…
jmjuanes Jun 28, 2024
1282e85
wc: Remove usage of status.name in individual components #TASK-6396 #…
jmjuanes Jun 28, 2024
b87455a
wc: Remove usage of status.name in job components #TASK-6396 #TASK-5964
jmjuanes Jun 28, 2024
d809e65
wc: Remove usage of status.name in sample components #TASK-6396 #TASK…
jmjuanes Jun 28, 2024
103d4f5
wc: Remove usage of status.name in study admin audit #TASK-6396 #TASK…
jmjuanes Jun 28, 2024
656a085
wc: Remove usage of status.name in file-grid #TASK-6396 #TASK-5964
jmjuanes Jun 28, 2024
6f556ec
wc: Remove usage of status.name in utils-new #TASK-6396 #TASK-5964
jmjuanes Jun 28, 2024
ad77972
wc: Fix panels locked field in clinical analysis components #TASK-639…
jmjuanes Jun 28, 2024
988ba30
wc: Fix panels locked field in rd-tiering-analysis #TASK-6396 #TASK-5964
jmjuanes Jun 28, 2024
cf206b3
wc: Fix panels locked field in clinical interpretation components #TA…
jmjuanes Jun 28, 2024
ee86579
wc: Fix panels locked field in variant interpreter browser cancer #TA…
jmjuanes Jun 28, 2024
9612313
wc: Fix panels locked field in variant interpreter browser cnv #TASK-…
jmjuanes Jun 28, 2024
c11ecc8
wc: Fix panels locked field in variant interpreter browser rd #TASK-6…
jmjuanes Jun 28, 2024
77da844
wc: Fix panels locked field in variant interpreter browser rearrangem…
jmjuanes Jun 28, 2024
e5dac2c
wc: Fix panels locked field in variant interpreter browser template #…
jmjuanes Jun 28, 2024
d01c0e6
wc: Move jobStatusFormatter to web-utils #TASK-6396 #TASK-5964
jmjuanes Jul 1, 2024
e175c88
wc: Fix usage of job status formatter in job-grid #TASK-6396 #TASK-5964
jmjuanes Jul 1, 2024
ae6d453
wc: Fix usage of job status formatter in job-monitor #TASK-6396 #TASK…
jmjuanes Jul 1, 2024
b28e2f8
wc: Fix usage of job status formatter in job-view #TASK-6396 #TASK-5964
jmjuanes Jul 1, 2024
1a039a9
Merge branch 'develop' into TASK-5964
jmjuanes Jul 2, 2024
73807c5
Merge branch 'develop' into TASK-5964
jmjuanes Jul 4, 2024
80e14c1
Merge branch 'develop' into TASK-5964
jmjuanes Jul 5, 2024
063a59f
Merge branch 'develop' into TASK-5964
jmjuanes Jul 8, 2024
3534601
Merge branch 'release-3.2.x' into TASK-5964
jmjuanes Jul 18, 2024
de58816
Merge branch 'release-3.2.x' into TASK-5964
jmjuanes Aug 6, 2024
64dbf19
Merge branch 'release-3.2.x' into TASK-5964
jmjuanes Aug 12, 2024
e202533
wc: Fix statuses list in interpretation create #TASK-6396 #TASK-5964
jmjuanes Aug 14, 2024
3474032
wc: Fix statuses list in interpretation update #TASK-6396 #TASK-5964
jmjuanes Aug 14, 2024
5cb1ee5
Merge branch 'release-3.2.x' into TASK-5964
jmjuanes Aug 14, 2024
721c4c8
Merge task 'release-3.2.x' into TASK-5964
gpveronica Aug 27, 2024
0ab972e
Merge branch 'release-3.2.x' into TASK-5964
gpveronica Aug 27, 2024
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
24 changes: 0 additions & 24 deletions src/core/utils-new.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,30 +304,6 @@ export default class UtilsNew {
return document.createRange().createContextualFragment(`${html}`);
}

static jobStatusFormatter(status, appendDescription = false) {
const description = appendDescription && status.description ? `<br>${status.description}` : "";
// FIXME remove this backward-compatibility check in next v2.3
const statusId = status.id || status.name;
switch (statusId) {
case "PENDING":
case "QUEUED":
return `<span class="text-primary"><i class="far fa-clock"></i> ${statusId}${description}</span>`;
case "RUNNING":
return `<span class="text-primary"><i class="fas fa-sync-alt anim-rotate"></i> ${statusId}${description}</span>`;
case "DONE":
return `<span class="text-success"><i class="fas fa-check-circle"></i> ${statusId}${description}</span>`;
case "ERROR":
return `<span class="text-danger"><i class="fas fa-exclamation-circle"></i> ${statusId}${description}</span>`;
case "UNKNOWN":
return `<span class="text-danger"><i class="fas fa-exclamation-circle"></i> ${statusId}${description}</span>`;
case "ABORTED":
return `<span class="text-warning"><i class="fas fa-ban"></i> ${statusId}${description}</span>`;
case "DELETED":
return `<span class="text-primary"><i class="fas fa-trash-alt"></i> ${statusId}${description}</span>`;
}
return "-";
}

// Capitalizes the first letter of a string and lowercase the rest.
static capitalize = ([first, ...rest]) => first.toUpperCase() + rest.join("").toLowerCase();

Expand Down
3 changes: 1 addition & 2 deletions src/webcomponents/clinical/analysis/rd-tiering-analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import UtilsNew from "../../../core/utils-new.js";
import "../../commons/forms/data-form.js";
import "../../commons/filters/catalog-search-autocomplete.js";


export default class RdTieringAnalysis extends LitElement {

constructor() {
Expand Down Expand Up @@ -161,7 +160,7 @@ export default class RdTieringAnalysis extends LitElement {
display: {
render: (panels, dataFormFilterChange) => {
// Get whether disease panels can be modified or are fixed
const casePanelLock = !!this.clinicalAnalysis;
const casePanelLock = !!this.clinicalAnalysis?.panelLocked;
// Get the list of disease panels for the dropdown
let diseasePanels = [];
if (casePanelLock) {
Expand Down
6 changes: 3 additions & 3 deletions src/webcomponents/clinical/clinical-analysis-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default class ClinicalAnalysisCreate extends LitElement {
// id: this.opencgaSession?.user?.id
// },
comments: [],
panelLock: false,
panelLocked: false,
samples: [],
};
}
Expand Down Expand Up @@ -478,7 +478,7 @@ export default class ClinicalAnalysisCreate extends LitElement {
},
{
title: "Disease Panel Lock",
field: "panelLock",
field: "panelLocked",
type: "toggle-switch",
display: {
helpMessage: "You must select at least one of the Clinical Analysis panels to enable Disease Panel Lock.",
Expand All @@ -502,7 +502,7 @@ export default class ClinicalAnalysisCreate extends LitElement {
return html`
<clinical-flag-filter
.flag="${flags?.map(f => f.id).join(",")}"
.flags="${this.opencgaSession.study.internal?.configuration?.clinical?.flags[this.clinicalAnalysis.type?.toUpperCase()]}"
.flags="${this.opencgaSession.study.internal?.configuration?.clinical?.flags || []}"
.multiple="${true}"
@filterChange="${e => handleFlagsFilterChange(e, "flags.id")}">
</clinical-flag-filter>
Expand Down
11 changes: 4 additions & 7 deletions src/webcomponents/clinical/clinical-analysis-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,7 @@ export default class ClinicalAnalysisGrid extends LitElement {
}

statusFormatter(value, row) {
// TODO remove this code as soon as new OpenCGA configuration is in place
const _status = this.opencgaSession.study?.internal?.configuration?.clinical?.status || [];

const status = this.opencgaSession.study?.internal?.configuration?.clinical?.status || [];
const hasWriteAccess = OpencgaCatalogUtils.checkPermissions(this.opencgaSession.study, this.opencgaSession.user.id, "WRITE_CLINICAL_ANALYSIS");
const isEditable = !this._config.readOnlyMode && hasWriteAccess && !row.locked; // status is editable

Expand All @@ -380,16 +378,15 @@ export default class ClinicalAnalysisGrid extends LitElement {
<div class="dropdown">
<button class="${btnClassName}" type="button" data-bs-toggle="dropdown" ${!isEditable ? "disabled=\"disabled\"" : ""}>
<span class='me-auto'">${currentStatus}</span>

</button>
${isEditable ? `
<ul class="dropdown-menu">
${_status[row.type].map(({id, description}) => `
${status.map(({id, description}) => `
<li>
<a class="d-flex dropdown-item" data-action="statusChange" data-status="${id}">
<a class="d-flex dropdown-item" data-action="statusChange" data-status="${id}" style="cursor:pointer;">
<div class="flex-grow-1">
${id === currentStatus ? `<strong>${id}</strong>` : id}
<p class="form-text"><small>${description}</small></p>
<div class="small text-secondary">${description}</div>
</div>
${id === currentStatus ? "<i class=\"fas fa-check\"></i>" : ""}
</a>
Expand Down
8 changes: 4 additions & 4 deletions src/webcomponents/clinical/clinical-analysis-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export default class ClinicalAnalysisUpdate extends LitElement {
return html `
<clinical-status-filter
.status="${statusId}"
.statuses="${this.opencgaSession.study.internal?.configuration?.clinical?.status[clinicalAnalysis?.type?.toUpperCase()]}"
.statuses="${this.opencgaSession.study.internal?.configuration?.clinical?.status || []}"
.multiple=${false}
.forceSelection=${true}
.classes="${updateParams?.["status.id"] ? "selection-updated" : ""}"
Expand Down Expand Up @@ -384,7 +384,7 @@ export default class ClinicalAnalysisUpdate extends LitElement {
.panel="${panels?.map(panel => panel.id).join(",")}"
.showExtendedFilters="${false}"
.classes="${updateParams?.panels ? "selection-updated" : ""}"
.disabled="${(!!clinicalAnalysis?.locked || !!clinicalAnalysis?.panelLock)}"
.disabled="${(!!clinicalAnalysis?.locked || !!clinicalAnalysis?.panelLocked)}"
@filterChange="${e => handlePanelsFilterChange(e)}">
</disease-panel-filter>
`;
Expand All @@ -393,7 +393,7 @@ export default class ClinicalAnalysisUpdate extends LitElement {
},
{
title: "Disease Panel Lock",
field: "panelLock",
field: "panelLocked",
type: "toggle-switch",
display: {
helpMessage: "All existing interpretations must contain at least one of the Clinical Analysis panels to enable Disease Panel Lock.",
Expand Down Expand Up @@ -439,7 +439,7 @@ export default class ClinicalAnalysisUpdate extends LitElement {
return html `
<clinical-flag-filter
.flag="${flags?.map(f => f.id).join(",")}"
.flags="${this.opencgaSession.study.internal?.configuration?.clinical?.flags[clinicalAnalysis?.type?.toUpperCase()]}"
.flags="${this.opencgaSession.study.internal?.configuration?.clinical?.flags || []}"
.multiple="${true}"
.classes="${updateParams?.flags ? "selection-updated" : ""}"
.disabled="${!!clinicalAnalysis?.locked}"
Expand Down
2 changes: 1 addition & 1 deletion src/webcomponents/clinical/clinical-analysis-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ export default class ClinicalAnalysisView extends LitElement {
},
{
title: "Status",
field: "status.name",
field: "status.id",
display: {
defaultValue: "-",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ export default class ClinicalInterpretationCreate extends LitElement {
helpMessage: "The interpretation ID is generated automatically",
},
},
{
title: "Interpretation Name",
field: "name",
type: "input-text",
},
{
title: "Assigned To",
field: "analyst.id",
Expand Down Expand Up @@ -222,7 +227,7 @@ export default class ClinicalInterpretationCreate extends LitElement {
type: "custom",
display: {
render: (panels, dataFormFilterChange) => {
const panelLock = !!this.clinicalAnalysis?.panelLock;
const panelLock = !!this.clinicalAnalysis?.panelLocked;
const panelList = panelLock ? this.clinicalAnalysis.panels : this.opencgaSession.study?.panels;
const handlePanelsFilterChange = e => {
const panelList = (e.detail?.value?.split(",") || [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import {LitElement, html} from "lit";
import UtilsNew from "../../../core/utils-new.js";
import BioinfoUtils from "../../../core/bioinfo/bioinfo-utils.js";
import WebUtils from "../../commons/utils/web-utils.js";

export default class ClinicalInterpretationSummary extends LitElement {

Expand Down Expand Up @@ -146,7 +147,7 @@ export default class ClinicalInterpretationSummary extends LitElement {
</div>
</div>
<div>
<span style="font-size:1.2em;">${interpretation.id}</span>
<span style="font-size:1.2em;">${WebUtils.getDisplayName(interpretation)}</span>
<span style="color:grey;margin-left:8px;">version ${interpretation.version}</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ export default class ClinicalInterpretationUpdate extends LitElement {
disabled: true,
},
},
{
title: "Interpretation Name",
field: "name",
type: "input-text",
},
{
title: "Assigned To",
field: "analyst.id",
Expand Down Expand Up @@ -188,7 +193,7 @@ export default class ClinicalInterpretationUpdate extends LitElement {
display: {
render: (panels, dataFormFilterChange, updateParams) => {
// CAUTION: check if the panelLock condition is the same as clinical-analysis-update.js
const panelLock = !!this.clinicalAnalysis?.panelLock;
const panelLock = !!this.clinicalAnalysis?.panelLocked;
const panelList = panelLock ? this.clinicalAnalysis?.panels : this.opencgaSession.study?.panels;
const handlePanelsFilterChange = e => {
const panelList = (e.detail?.value?.split(",") || [])
Expand Down
8 changes: 0 additions & 8 deletions src/webcomponents/cohort/cohort-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,6 @@ export default class CohortCreate extends LitElement {
placeholder: "Add an ID",
}
},
{
title: "Name",
field: "status.name",
type: "input-text",
display: {
placeholder: "Add source name"
}
},
{
title: "Description",
field: "status.description",
Expand Down
2 changes: 1 addition & 1 deletion src/webcomponents/cohort/cohort-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export default class CohortGrid extends LitElement {
_.id,
_.samples ? _.samples.map(_ => `${_.id}`).join(",") : "",
_.creationDate ? CatalogGridFormatter.dateFormatter(_.creationDate) : "-",
_.status.name,
_.status.id,
_.type
].join("\t"))];
UtilsNew.downloadData(dataString, "cohort_" + this.opencgaSession.study.id + ".tsv", "text/plain");
Expand Down
8 changes: 0 additions & 8 deletions src/webcomponents/cohort/cohort-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,6 @@ export default class CohortUpdate extends LitElement {
placeholder: "Add an ID",
}
},
{
title: "Name",
field: "status.name",
type: "input-text",
display: {
placeholder: "Add source name"
}
},
{
title: "Description",
field: "status.description",
Expand Down
2 changes: 1 addition & 1 deletion src/webcomponents/cohort/cohort-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export default class CohortView extends LitElement {
title: "Status",
type: "complex",
display: {
template: "${internal.status.name} (${internal.status.date})",
template: "${internal.status.id} (${internal.status.date})",
format: {
"internal.status.date": date => UtilsNew.dateFormatter(date),
}
Expand Down
2 changes: 1 addition & 1 deletion src/webcomponents/commons/opencga-browser-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export default class OpencgaBrowserFilter extends LitElement {
content = html`
<clinical-status-filter
.status="${this.preparedQuery[subsection.id]}"
.statuses="${Object.values(this.opencgaSession.study.internal?.configuration?.clinical?.status)?.flat()}"
.statuses="${this.opencgaSession.study.internal?.configuration?.clinical?.status || []}"
.multiple="${true}"
@filterChange="${e => this.onFilterChange(subsection.id, e.detail.value)}">
</clinical-status-filter>
Expand Down
52 changes: 40 additions & 12 deletions src/webcomponents/commons/utils/web-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@

export default class WebUtils {

static getDisplayName(item) {
if (item?.id && item?.name) {
// First case: both item.id and item.name exists and are not empty
return `${item.name} (${item.id})`;
} else if (item?.id) {
// Second case: only item.id exists
return item.id;
} else if (item?.name) {
// Thids case: only item.name exists
return item.name;
static formatDisplayName(id, name, defaultValue = "-") {
if (id && name) {
// First case: both id and name exists and are not empty
return `${name} (${id})`;
} else if (id) {
// Second case: only id exists
return id;
} else if (name) {
// Third case: only name exists
return name;
} else {
// Fallback: neither item.id and item.name exists or item is empty
return "-";
// Fallback: neither id and name exists
return defaultValue;
}
}

// Note: this is an alias to 'formatDisplayName', where the argument is an object that contains 'id' and/or 'name'
static getDisplayName(item, defaultValue) {
return WebUtils.formatDisplayName(item?.id, item?.name, defaultValue);
}

static getIVALink(opencgaSession, tool, query = {}) {
const baseUrl = (new URL(window.location.pathname, window.location.origin));
let queryStr = "";
Expand All @@ -48,4 +53,27 @@ export default class WebUtils {
return `${baseUrl}#${tool}/${opencgaSession.project.id}/${opencgaSession.study.id}/${queryStr}`;
}

static jobStatusFormatter(status, appendDescription = false) {
const description = appendDescription && status?.description ? `<br>${status.description}` : "";
const statusId = status.id;
switch (statusId) {
case "PENDING":
case "QUEUED":
return `<span class="text-primary"><i class="far fa-clock"></i> ${statusId}${description}</span>`;
case "RUNNING":
return `<span class="text-primary"><i class="fas fa-sync-alt anim-rotate"></i> ${statusId}${description}</span>`;
case "DONE":
return `<span class="text-success"><i class="fas fa-check-circle"></i> ${statusId}${description}</span>`;
case "ERROR":
return `<span class="text-danger"><i class="fas fa-exclamation-circle"></i> ${statusId}${description}</span>`;
case "UNKNOWN":
return `<span class="text-danger"><i class="fas fa-exclamation-circle"></i> ${statusId}${description}</span>`;
case "ABORTED":
return `<span class="text-warning"><i class="fas fa-ban"></i> ${statusId}${description}</span>`;
case "DELETED":
return `<span class="text-primary"><i class="fas fa-trash-alt"></i> ${statusId}${description}</span>`;
}
return "-";
}

}
Loading
Loading