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

Improve search of authorized and unauthorized studies #4521

Closed

Conversation

jagnathan
Copy link
Contributor

@jagnathan jagnathan commented Feb 17, 2023

Fix cBioPortal/icebox#468. Improved search of authorized internal studies. Users can now filter studies based on their read permission (authorized or not authorized) in the search box. This is an optional feature that has to be enabled by settings in portal.properties.

jagnathan and others added 9 commits February 15, 2023 12:19
fix 9915 improve search of authorized studies
add new search filter based on readPermission flag called Controlled access authorized. Modified the search algorithm to accept booleans instead of just strings esp. false value
fix 9915 improve search of authorized studies
add new search filter based on readPermission flag called Controlled access authorized. Modified the search algorithm to accept booleans instead of just strings esp. false value
id has to be unique for each filter when there are multiple filters.
Copy link
Contributor

@pvannierop pvannierop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Jag, thank you for making this! The only comment that I have is that now the selection widget are two checkboxes that allow you to unselect both options which would result in an empty study list. Personally I think it would be better to have a single toggle that turns the UNAUTH studies on or off.

@@ -58,7 +58,7 @@ export const FilterCheckbox: FunctionComponent<FieldProps> = props => {
<h5>{props.filter.form.label}</h5>
<div>
{options.map((option: FilterFieldOption) => {
const id = `input-${option}`;
const id = `input-${option.displayValue}`;
Copy link

@BasLee BasLee Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filter can now still be matched to the wrong checkbox, when their displayValues are the same. Maybe better to get rid of the ID by wrapping the checkbox by its label?

                            <label [..] >
                                <input [..] />
                                {' '}
                                {option.displayValue}
                            </label>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now, the id will consist of displayvalue and optionvalue combined to ensure that they are unique. Enwrapped with label.

@inodb inodb requested a review from alisman March 22, 2023 14:44
Update checkbox label text when filter is applied vs not applied
@inodb inodb requested a review from dippindots April 5, 2023 14:39
fix all Authorized or Unauthorized studies scenario. Hide the option if the studies that are all authorized or all unauthorized.
@jagnathan jagnathan changed the title Fix 9915 improved findability of studies Improve search of authorized and unauthorized studies Apr 5, 2023
Copy link
Member

@dippindots dippindots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jagnathan Thanks for the pr, overall it looks good. I put some minor comments there. Feel free to address it when you got a chance.
I think it would be great if we can have some tests for this feature. Do you know if it's easy to add some related tests?

src/shared/components/query/CancerStudySelector.tsx Outdated Show resolved Hide resolved
@@ -1450,6 +1450,15 @@ export class QueryStore {
return new Set(referenceGenomes);
}

@computed get readPermissions(): Set<string> {
const studies = Array.from(this.treeData.map_node_meta.keys()).filter( s => typeof((s as CancerStudy).readPermission) !== 'undefined' );
console.log(studies);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can delete this log

src/shared/components/query/QueryStore.ts Outdated Show resolved Hide resolved
Comment on lines +414 to +416
...shownAndAuthorizedStudies.map(
(study: CancerStudy) => study.studyId
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also shows twice, maybe we can create a constant variable for it

const shownAndAuthorizedStudyIds = shownAndAuthorizedStudies.map(
    (study: CancerStudy) => study.studyId
);

src/shared/lib/query/QueryParser.ts Outdated Show resolved Hide resolved
Only CancerStudy objects from treeData are filtered based on whether the readPermission field has a value.  Refactoring: New const created as shownStudiesLengthstring to identify if there is a filter applied or not.
Copy link
Member

@dippindots dippindots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jagnathan Thanks for addressing all the comments, LGTM. Please try to resolve the conflicts and rebase based on the latest master before merge.

fix 9915 improve search of authorized studies
add new search filter based on readPermission flag called Controlled access authorized. Modified the search algorithm to accept booleans instead of just strings esp. false value

fix 9915 improve search of authorized studies

fix 9915 improve search of authorized studies
add new search filter based on readPermission flag called Controlled access authorized. Modified the search algorithm to accept booleans instead of just strings esp. false value

Use _.toString in matchPhraseFull, and specify type

Unnest fieldName check in Phrase.match

Introduce FilterFieldOption type that includes a displayValue

Update QueryParser.ts

Update CheckboxFilterField.tsx

id has to be unique for each filter when there are multiple filters.

Modify the Select all checkbox to select only authorized studies

Update checkbox label text

Update checkbox label text when filter is applied vs not applied

fix all Authorized or Unauthorized studies scenario

fix all Authorized or Unauthorized studies scenario. Hide the option if the studies that are all authorized or all unauthorized.
Only CancerStudy objects from treeData are filtered based on whether the readPermission field has a value.  Refactoring: New const created as shownStudiesLengthstring to identify if there is a filter applied or not.
conflict resolution fix due to merge
@jagnathan
Copy link
Contributor Author

superseded by new PR #4603

@jagnathan jagnathan closed this May 1, 2023
@jagnathan jagnathan reopened this May 1, 2023
@jagnathan
Copy link
Contributor Author

superseded by new PR #4603

@jagnathan jagnathan closed this May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancements to Improved findability of Authorized Studies feature
4 participants