Skip to content

Remove browser chart point click links#6043

Draft
juliawu wants to merge 2 commits intodatacommonsorg:masterfrom
juliawu:browser-chart-click
Draft

Remove browser chart point click links#6043
juliawu wants to merge 2 commits intodatacommonsorg:masterfrom
juliawu:browser-chart-click

Conversation

@juliawu
Copy link
Contributor

@juliawu juliawu commented Feb 28, 2026

This PR removes the click functionality of the observation points in browser page charts.

image (fullsize image link: https://github.com/user-attachments/assets/969488a9-5a8e-4b0e-90ff-3472f803e9b6 )

Context

We are deprecating all SPARQL API endpoints as part of the Spanner Graph migration project. This PR removes a usage of the SPAQRL API that cannot be replaced with existing v2 API calls. We use it to fetch the DCID of the observation being clicked on, so we can redirect the user to its observation browser page (e.g. https://datacommons.org/browser/dc/o/h7vbenjee1ypc).

However, this click functionality itself is hard to activate (really hard to hover over the point exactly), takes a while to render (we get a spinner before redirecting the user) and it's not obvious to the user that it's a feature. Thus, we are removing this functionality altogether.

Changes Made

This PR:

  • Removes code implementing click functionality in browser page charts
  • Removes the client test for the click functionality
  • Removes /api/browser/observation-id which was used by the click functionality, which removes the SPARQL API call dependency

Note that this PR does not:

  • Change the hover behavior of browser page charts
  • Remove the browser observation node pages

Screenshot

Screenshot 2026-02-27 at 7 35 16 PM

On hover, we still show the point value, but the cursor stays default instead of turning into a pointer.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request streamlines the browser page charts by removing the click-to-redirect functionality on observation points. This change is part of a broader effort to deprecate SPARQL API endpoints and addresses the fact that the removed feature was difficult to use, slow, and not intuitive for users. The hover behavior and observation node pages remain unaffected, ensuring core functionality is preserved while improving user experience and simplifying the architecture.

Highlights

  • Removed Click Functionality: The interactive click functionality from observation points within browser charts has been removed, addressing a feature that was difficult to activate and provided a suboptimal user experience.
  • Deprecated SPARQL API Endpoint: The /api/browser/observation-id SPARQL API endpoint, previously used to fetch observation DCIDs for redirection, has been deprecated and removed as part of the Spanner Graph migration.
  • Client-Side Code and Tests Clean-up: Associated client-side code in observation_chart.tsx and its corresponding unit tests in browser_test.py have been eliminated, streamlining the codebase.
Changelog
  • server/routes/browser/api.py
    • Removed unused constants NO_MMETHOD_KEY and NO_OBSPERIOD_KEY.
    • Deleted the get_sparql_query function.
    • Removed the /api/browser/observation-id endpoint and its associated logic.
  • server/tests/routes/api/browser_test.py
    • Deleted the entire test file for the /api/browser/observation-id endpoint.
  • static/js/browser/observation_chart.tsx
    • Removed imports for axios, DataPoint, stringifyFn, and URI_PREFIX.
    • Removed the NO_OBSDCID_ERROR_MESSAGE constant.
    • Removed the canClickObs property from ObservationChartPropType.
    • Updated CSS class logic to remove clickability from chart containers and table rows.
    • Removed the onClick handler from table rows.
    • Removed the handleDotClick, redirectToObsPage, updateErrorMessage, loadSpinner, and removeSpinner methods.
    • Set handleDotClick in drawLineChart options to null.
  • static/js/browser/observation_chart_section.tsx
    • Removed the canClickObs prop when rendering the ObservationChart component.
Activity
  • No specific activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes the click functionality on observation points in browser charts, which depended on a deprecated SPARQL API endpoint. The changes involve removing the backend API endpoint, its tests, and all related frontend code for handling clicks, which simplifies the components. My review includes a suggestion for improving readability and a recommendation to verify potential dead code across the application for further cleanup.

I am having trouble creating individual review comments. Click here to see my feedback.

static/js/browser/observation_chart.tsx (83-86)

medium

To improve readability and avoid repetition, you can simplify this class name construction. The string 'no-click' is present in both branches of the ternary operator.

    const svgContainerClass = `no-click${this.props.series.series.length > MAX_DOTS ? " hide-dots" : ""}`;

static/js/browser/observation_chart.tsx (214-251)

medium

With the removal of redirectToObsPage, the helper methods it called (updateErrorMessage, loadSpinner, removeSpinner) are also gone. This might leave some dead code in the component:

  • The errorMessage field in the state is no longer updated.
  • The spinner elements in the JSX are no longer used.

For better maintainability, consider verifying their usage across the entire application before removing these from the state and JSX, as they might be used in other features.

References
  1. Before suggesting to remove a function as dead code, verify its usage across the entire application, as it might be used in other features not directly related to the current changes (e.g., disaster maps, place search).

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.

1 participant