-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat: 5673 cell guide tissue specific cell type route #6232
Conversation
Deployment Summary
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6232 +/- ##
=======================================
Coverage 91.96% 91.96%
=======================================
Files 178 178
Lines 14706 14706
=======================================
Hits 13524 13524
Misses 1182 1182
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
c2b40cc
to
bcd9d8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new snapshot for tissue specific cell type page SEO
@@ -1,3 +1,11 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention is to use [cellTypeId].tsx
to serve both CELL_GUIDE_CELL_TYPE
and CELL_GUIDE_TISSUE_SPECIFIC_CELL_TYPE
routes, so we have single source of truth and not duplicate code where possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracts out stuff to connect.ts
element: JSX.Element; | ||
} | null>(null); | ||
|
||
const { cellTypeId: queryCellTypeId, tissueId: queryTissueId } = router.query; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we get tissueId
from the router now, I've removed the states that used to track selectedOrgan
and selectedOrganId
const throttledHandleResize = useMemo(() => { | ||
return throttle(handleResize, 100); | ||
}, [handleResize]); | ||
const handleChangeOrgan = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleChangeOrgan()
now just pushes the app to the new route!
const headerName = page.getByTestId(CELL_GUIDE_CARD_HEADER_NAME); | ||
const headerNameText = await headerName.textContent(); | ||
expect(headerNameText).toBe("Neuron"); | ||
test("All tissue specific CellGuide card components are present", async ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test for tissue specific cell type page SEO description
const rowCountAfter = rowElementsAfter.length; | ||
expect(rowCountAfter).toBeGreaterThan(1); | ||
expect(rowCountAfter).not.toBe(rowCountBefore); | ||
await tryUntil( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update test to avoid flakiness caused by table not yet loaded
const firstRowContentAfter = | ||
await rowElementsAfter[0].textContent(); | ||
expect(firstRowContentBefore).not.toBe(firstRowContentAfter); | ||
await tryUntil( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update test to avoid flakiness caused by table not yet loaded new data for specific tissue
* (thuang): Since the marker gene table is not stably sorted, we need | ||
* to target a specific marker gene to prevent flakiness. | ||
*/ | ||
const markerGeneNRXN1 = page.locator(`${tableSelector} tbody tr`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent flakiness caused by marker gene table not having a stable sort
const node = page.getByTestId( | ||
`${CELL_GUIDE_CARD_ONTOLOGY_DAG_VIEW_RECT_OR_CIRCLE_PREFIX_ID}-CL:0000099__0-has-children-isTargetNode=false` | ||
`${CELL_GUIDE_CARD_ONTOLOGY_DAG_VIEW_RECT_OR_CIRCLE_PREFIX_ID}-CL:0002319__0-has-children-isTargetNode=false` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neural cell works well with NRXN1
marker gene
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tihuan The page should maintain scroll position when changing the tissue. Is that still possible? Otherwise looks good!
Oh yes! I wasn't sure if it was a bug or a feature to keep the scroll position, so went with the default navigation behavior 😆 Just updated the code to keep the scroll position. Rdev should be updated soon 🙆♂️ Thanks for the great feedback! |
@atarashansky PTAL this PR for feature related implementation 🙏 I'm keeping this PR in draft until @ainfeld is back to collaborate on analytics changes Thank you! |
d489736
to
804ef34
Compare
8b39639
to
7d94c83
Compare
7d94c83
to
c3f9873
Compare
bd7afa9
to
5ed4f90
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated snapshots for tissue specific cell type page SEO
CELL_GUIDE_CELL_TYPE = "/cellguide/:cellTypeId", | ||
CELL_GUIDE_TISSUE = "/cellguide/tissues/:tissueId", | ||
CELL_GUIDE_TISSUE_SPECIFIC_CELL_TYPE = "/cellguide/tissues/:tissueId/cell-types/:cellTypeId", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add routes for easier way to have a consistent way to create URL and find places that navigate to the same route
@@ -60,27 +65,27 @@ function CellGuideInfoBar({ | |||
router.push(href); | |||
} | |||
track(EVENTS.CG_VIEW_CELLGUIDE_PAGE_CLICKED, { | |||
cell_type: cellInfoCellType.cellTypeName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here and below - use destructuring to improve readability
|
||
const { cellTypeId, cellTypeName } = cellInfoCellType; | ||
|
||
const cellTypeUrl = getCellTypeLink({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the new utility function to get cellTypeLink
|
||
interface AnimatedNodesProps { | ||
tree: HierarchyPointNode<TreeNodeWithState>; | ||
tissueId?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this component needs tissueId
now to construct cellTypeLink
await isElementVisible(page, CELL_GUIDE_CARD_HEADER_NAME); | ||
await isElementVisible(page, CELL_GUIDE_CARD_HEADER_TAG); | ||
await isElementVisible(page, CELL_GUIDE_CARD_CL_DESCRIPTION); | ||
await isElementVisible(page, CELL_GUIDE_CARD_GPT_DESCRIPTION); | ||
await isElementVisible(page, CELL_GUIDE_CARD_SYNONYMS); | ||
await isElementVisible(page, CELL_GUIDE_CARD_GPT_TOOLTIP_LINK); | ||
await isElementVisible(page, CELL_GUIDE_CARD_SEARCH_BAR); | ||
await isElementVisible(page, CELL_GUIDE_CARD_ENRICHED_GENES_TABLE); | ||
await isElementVisible(page, CELL_GUIDE_CARD_ONTOLOGY_DAG_VIEW); | ||
const headerName = page.getByTestId(CELL_GUIDE_CARD_HEADER_NAME); | ||
const headerNameText = await headerName.textContent(); | ||
expect(headerNameText).toBe("Neuron"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted to assertAllCellCardComponentsArePresent()
for reuse
@@ -554,6 +578,99 @@ describe("Cell Guide", () => { | |||
}); | |||
|
|||
describe("Ontology Viewer", () => { | |||
describe("Tissue specific cell type page", () => { | |||
test("Clicks on a cell type node that has the same tissue in its dropdown in the ontology viewer navigates to the correct cell type page", async ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add new tests to cover the behaviors where:
- On a tissue page, clicking on a cell type node should navigate to its tissue specific cell type page
- On a tissue page, clicking on a cell type node should navigate to its tissue agnostic page IF the cell type page turns out not having such tissue in the tissue dropdown
5ed4f90
to
fe41791
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid work @tihuan! Look good to me 🚀
thanks @tihuan!! no worries about when it actually goes to prod, doesn't really matter to me haha just useful to know when it's expected so I can plan the work I need to do after it. This gives me lots of time to play around with it in staging to understand what I need to change for analytics so really really appreciate that 🙏 |
Ahaha awesome! Glad some extra time in staging is useful this time 🎉 Thanks again, @ainfeld 😄 🙏 |
Reason for Change
DO NOT MERGE UNTIL @ainfeld is back to help sort out analytics impactUPDATE(12/1): @ainfeld has confirmed that no engineering changes for analytics changes
Changes
Behavior changes:
Code changes:
connect.ts
isSuccess
to hooksuseAllOrgansLookupTables()
anduseOrganAndOrganismFilterListForCellType()
, so we can do behavior change 3 aboveuseEffect
inconnect.ts
to redirect user to tissue agnostic cell type page, usingisSuccess
from the change right abovegetCellTypeLink()
utility function for all three places (dropdown, ontology viewer, and right side cell type info panel) that push user to cell type page to useTesting steps
Three behavior changes:
BEHAVIOR 1:
Brain
selected in the tissue dropdownVideo:
Screen.Recording.2023-11-16.at.9.38.40.AM.mov
BEHAVIOR 2:
BEHAVIOR 3:
For example, on Brain tissue page, clicking on "cell" node should take you to the tissue agnostic "cell" page
Checklist 🛎️
Notes for Reviewer