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

[ENH] Modified the result tables for humans and machines #357

Merged
merged 18 commits into from
Nov 21, 2024
Merged

Conversation

rmanaem
Copy link
Contributor

@rmanaem rmanaem commented Nov 17, 2024

Checklist

This section is for the PR reviewer

  • PR has an interpretable title with a prefix ([ENH], [FIX], [REF], [TST], [CI], [MNT], [INF], [MODEL], [DOC]) (see our Contributing Guidelines for more info)
  • PR has a label for the release changelog or skip-release (to be applied by maintainers only)
  • PR links to GitHub issue with mention Closes #XXXX
  • Tests pass
  • Checks pass
  • If the PR changes the participant-level and/or the dataset-level result file, the query-tool-results files in the neurobagel_examples repo have been regenerated

For new features:

  • Tests have been added

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

Summary by Sourcery

Modify the result tables to improve readability for both humans and machines by updating the ResultContainer component and adjusting the TSV download format. Enhance the Cypress tests to align with these changes.

Enhancements:

  • Improve the ResultContainer component to handle additional options for diagnosis and assessment, and enhance the conversion of URIs to labels for better readability.

Tests:

  • Update Cypress tests to reflect changes in the result download process, including new button identifiers and expected file content.

@rmanaem rmanaem changed the title Modified the result tables for humans and machines [MNT] Modified the result tables for humans and machines Nov 17, 2024
Copy link

netlify bot commented Nov 17, 2024

Deploy Preview for neurobagel-query ready!

Name Link
🔨 Latest commit 2a69e7f
🔍 Latest deploy log https://app.netlify.com/sites/neurobagel-query/deploys/673f6c4ee2839a0008f22a90
😎 Deploy Preview https://deploy-preview-357--neurobagel-query.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@rmanaem rmanaem added the pr-minor Non-breaking feature or enhancement, will increment minor version (0.+1.0) label Nov 17, 2024
@surchs surchs self-requested a review November 18, 2024 21:28
Copy link
Contributor

@surchs surchs left a comment

Choose a reason for hiding this comment

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

Thanks @rmanaem for putting this together so quickly and beautifully. The UI looks really awesome!

I left a couple of clarity comments for you to look at, mostly minor, but some of the new label matching functionality might need another look.

I think your e2e test of the generated TSV fails because during the e2e test you don't actually have a live n-API to talk to, and so the list of diagnoses or attributes with their labels is not "gotten".

I think we can either mock these requests and then just assert over a smaller set of diagnoses being correctly relabeled - or we go the long route and have a full on e2e test with live n-API and f-API.

I strongly prefer mocking because these kinds of expensive e2e tests should probably live in a different test suite.

src/components/GetDataDialog.tsx Outdated Show resolved Hide resolved
src/components/GetDataDialog.tsx Outdated Show resolved Hide resolved
src/components/GetDataDialog.tsx Outdated Show resolved Hide resolved
src/components/ResultContainer.tsx Show resolved Hide resolved
src/components/ResultContainer.tsx Outdated Show resolved Hide resolved
src/components/ResultContainer.tsx Outdated Show resolved Hide resolved
src/components/ResultContainer.tsx Outdated Show resolved Hide resolved
src/components/ResultContainer.tsx Outdated Show resolved Hide resolved
src/components/ResultContainer.tsx Outdated Show resolved Hide resolved
Copy link

sourcery-ai bot commented Nov 19, 2024

Reviewer's Guide by Sourcery

This PR modifies the result tables to improve readability and usability for both humans and machines. The changes include converting URIs to human-readable labels, restructuring the TSV output format, and updating the UI components to support these changes. The implementation focuses on maintaining data integrity while making the output more accessible.

ER diagram for TSV output format changes

erDiagram
    DATASET {
        string DatasetName
        string PortalURI
        int NumMatchingSubjects
        string[] DatasetImagingModalities
        string[] DatasetPipelines
    }
    SUBJECT {
        string SubjectID
        string SessionID
        string SessionFilePath
        string SessionType
        int NumMatchingPhenotypicSessions
        int NumMatchingImagingSessions
        string[] SessionImagingModalities
        string[] SessionCompletedPipelines
    }
    DATASET ||--o{ SUBJECT : contains
    DATASET {
        string DatasetName
        string PortalURI
        int NumMatchingSubjects
        string[] DatasetImagingModalities
        string[] DatasetPipelines
    }
    SUBJECT {
        string SubjectID
        string SessionID
        string SessionFilePath
        string SessionType
        int NumMatchingPhenotypicSessions
        int NumMatchingImagingSessions
        string[] SessionImagingModalities
        string[] SessionCompletedPipelines
    }
    DATASET ||--o{ SUBJECT : contains
Loading

Class diagram for GetDataDialog component changes

classDiagram
    class GetDataDialog {
        + boolean open
        + void onClose()
        + boolean disableDownloadResultsButton
        + void handleDownloadResultButtonClick(identifier: string)
    }
    GetDataDialog --> DownloadResultButton
    class DownloadResultButton {
        + string identifier
        + boolean disabled
        + void handleClick(identifier: string)
    }
Loading

File-Level Changes

Change Details Files
Added URI to label conversion functionality for better human readability
  • Implemented convertURIToLabel function to transform URIs into human-readable labels
  • Added support for different types of conversions (sex, sessionType, diagnosis, assessment, modality, pipeline)
  • Integrated with existing constants and options for consistent label mapping
src/components/ResultContainer.tsx
Restructured TSV output format and download functionality
  • Modified column headers and data structure for better organization
  • Combined dataset-level and participant-level information in a single output
  • Updated file naming convention for downloaded results
  • Added handling for protected and unprotected dataset information
src/components/ResultContainer.tsx
src/components/GetDataDialog.tsx
Updated UI components and dialog interactions
  • Modified GetDataDialog component to include download button
  • Updated button labels and tooltips for clarity
  • Added new props for handling download functionality
  • Improved dialog content and instructions
src/components/GetDataDialog.tsx
src/components/DownloadResultButton.tsx
src/App.tsx
Updated test suite to reflect new changes
  • Modified existing tests to accommodate new TSV format
  • Added tests for URI to label conversion
  • Updated component tests for new UI interactions
  • Added tests for download functionality
cypress/e2e/ResultsTSV.cy.ts
cypress/component/GetDataDialog.cy.tsx
cypress/component/ResultContainer.cy.tsx
cypress/component/DownloadResultButton.cy.tsx

Assessment against linked issues

Issue Objective Addressed Explanation
#356 Create a human-friendly format file with cohort information
#356 Create a machine-friendly format file with cohort information
#136 Change column names 'NumPhenotypicSessions' and 'NumImagingSessions' to 'NumMatchingPhenotypicSessions' and 'NumMatchingImagingSessions' in results TSVs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @rmanaem - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Hi @rmanaem! 👋

@sourcery-ai is now installed on this repository.

We found this recent PR of yours and reviewed it to show you what Sourcery can do.

If you want to review another PR, just comment with @sourcery-ai review

Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

src/components/ResultContainer.tsx Show resolved Hide resolved
@rmanaem rmanaem requested a review from surchs November 20, 2024 15:48
Copy link
Contributor

@surchs surchs left a comment

Choose a reason for hiding this comment

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

Thanks @rmanaem, looks good!

I left another comment on the label:URI disassembler function, let's make it easy for ourselves to get back into the code in a couple weeks with a comment.

🧑‍🍳

@surchs
Copy link
Contributor

surchs commented Nov 20, 2024

Oh and I suggest [ENH] for the PR title because it's user facing.

Copy link
Contributor

@surchs surchs left a comment

Choose a reason for hiding this comment

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

Hey @rmanaem, I missed that our downloaded files now also have spaces in them by default because button identifier, button text, and file name are all the same.

Spaces in the file names are going to be more of an issue than in the identifier, so let's fix that before merging.

Specifically make downloaded file names not have any spaces

src/components/ResultContainer.tsx Outdated Show resolved Hide resolved
@rmanaem rmanaem requested a review from surchs November 20, 2024 16:23
Copy link
Contributor

@surchs surchs left a comment

Choose a reason for hiding this comment

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

very cool, thanks @rmanaem

🧑‍🍳

src/components/DownloadResultButton.tsx Show resolved Hide resolved
@rmanaem rmanaem changed the title [MNT] Modified the result tables for humans and machines [ENH] Modified the result tables for humans and machines Nov 20, 2024
@rmanaem rmanaem enabled auto-merge (squash) November 20, 2024 17:01
@rmanaem rmanaem disabled auto-merge November 20, 2024 18:42
@rmanaem rmanaem merged commit 04e2678 into main Nov 21, 2024
5 checks passed
@rmanaem rmanaem deleted the maint-356 branch November 21, 2024 17:22
Copy link
Contributor

🚀 PR was released in v0.7.0 🚀

@neurobagel-bot neurobagel-bot bot added the released This issue/pull request has been released. label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-minor Non-breaking feature or enhancement, will increment minor version (0.+1.0) released This issue/pull request has been released.
Projects
None yet
2 participants