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

Fix : Differentiate recent and all in study panel #4085

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

salimkanoun
Copy link
Contributor

Context

This PR tries to solve : #3714
It were remaining a partial implementation in which the "recent" tab and "all" tab was displaying the same content.

Changes & Results

For Primary tab => No changes
For Recent => It now list studies prior to the oldest primary study with a limit time of 1y
For All => It now list all patient's studies without restrictions (including primary studies)

Testing

This change does not affect Basic mode as this mode uses PanelStudyBrowserTracking, while this PR updated PanelStudyBrowser

@sedghi is there any plane to make this two sharing at least a common code base ? There a lot of duplicated code between both.

Checklist

PR

Code

  • [] My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

Chrome Latest

Copy link

netlify bot commented May 4, 2024

Deploy Preview for ohif-platform-docs ready!

Name Link
🔨 Latest commit 78e20ca
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/665620d46eebd40008247e0d
😎 Deploy Preview https://deploy-preview-4085--ohif-platform-docs.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.

Copy link

netlify bot commented May 4, 2024

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit 78e20ca
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/665620d459adf40008ec3469
😎 Deploy Preview https://deploy-preview-4085--ohif-dev.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.

Copy link

codecov bot commented May 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.41%. Comparing base (8a335bd) to head (d36564e).
Report is 361 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4085      +/-   ##
==========================================
- Coverage   46.23%   44.41%   -1.83%     
==========================================
  Files          78       80       +2     
  Lines        1276     1333      +57     
  Branches      312      327      +15     
==========================================
+ Hits          590      592       +2     
- Misses        548      588      +40     
- Partials      138      153      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +353 to +377
//If primary study, add to primary study
if (primaryStudyInstanceUIDs.includes(study.studyInstanceUid)) {
primaryStudies.push(tabStudy);
} else {
// TODO: Filter allStudies to dates within one year of current date
recentStudies.push(tabStudy);
allStudies.push(tabStudy);
}
//In all case add to all Studies tab
allStudies.push(tabStudy);
});

//Get primary studies date as time stamp
const primaryStudiesTimestamps = primaryStudies.filter(study => study.date).map((study) => new Date(study.date).getTime())

if (primaryStudiesTimestamps.length > 0) {

const oldestPrimaryTimeStamp = Math.min(...primaryStudiesTimestamps)
const oneYearInMs = 365 * 24 * 3600 * 1000

//Select studies date previous to primary studies and up to one year earlier
recentStudies = allStudies.filter(study => {
if (!study.date) return false
const studyTimeStamp = new Date(study.date).getTime()
return (oldestPrimaryTimeStamp - studyTimeStamp) < oneYearInMs
})

}

Copy link
Member

Choose a reason for hiding this comment

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

I believe the issue here is that it's not following the same logic as PanelStudyBrowserTracking. Instead of having it here, could we please export it as a utility so that both PanelStudyBrowser and PanelStudyBrowserTracking can utilize it?

Copy link
Member

Choose a reason for hiding this comment

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

@IbrahimCSAE will do this

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.

None yet

3 participants