Skip to content

Update provenance links in browser#6071

Merged
nick-nlb merged 9 commits intodatacommonsorg:masterfrom
nick-nlb:provenance_link_update
Mar 16, 2026
Merged

Update provenance links in browser#6071
nick-nlb merged 9 commits intodatacommonsorg:masterfrom
nick-nlb:provenance_link_update

Conversation

@nick-nlb
Copy link
Contributor

Update provenance links in browser

Issue

b/491143381

Description

The provenance links were previously using the URL of the source of the provenance as the link text, while the link itself correctly went to the browser entry for that provenance.

This created a confusing UI where the link the user clicked on was not the link that the user was then directed to.

The update required that the /provenance endpoint (which is only used in this place) be updated to return the name of the provenance rather than the URL.

Screenshots

Before

before

After

after

…over the URL. This required an update to the provenance endpoint to provide the information that we want, as wall as small changes to multiple files in the frontend.
@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 resolves a user experience issue where provenance links in the browser displayed the source URL, which could be confusing. The changes involve updating the backend API to provide a more descriptive provenance name and modifying the frontend to utilize this name for display in the UI, making the links more intuitive and user-friendly.

Highlights

  • Backend API Update: The /api/browser/provenance endpoint was modified to return the human-readable name of the provenance instead of its URL.
  • Frontend UI Enhancement: The browser's provenance links now display the provenance name, improving clarity and user experience.
  • Code Refactoring: Frontend components were updated to reflect the change from displaying provenance URLs/domains to displaying provenance names, including renaming relevant state and prop variables.
Changelog
  • server/routes/browser/api.py
    • Removed unused imports (json, request, Response, server.services.datacommons).
    • Imported jsonify for proper JSON response formatting.
    • Modified the provenance endpoint to fetch and return the name property of provenance DCIDs instead of their url.
  • static/js/browser/app.tsx
    • Renamed the provDomain state property to provenanceNames to accurately reflect its new content.
    • Updated the logic for processing the /api/browser/provenance response to extract and store the name for each provenance.
    • Passed the provenanceNames prop to child components (OutArcSection, InArcSection).
  • static/js/browser/arc_table_row.tsx
    • Renamed the src prop to provenanceName in the ArcTableRowPropType interface.
    • Adjusted the rendering condition and displayed text to use provenanceName instead of src.
  • static/js/browser/in_arc_section.tsx
    • Updated the InArcSectionsPropType interface to use provenanceNames instead of provDomain.
    • Passed the updated provenanceNames prop to InArcSubsection.
  • static/js/browser/in_arc_subsection.tsx
    • Modified the InArcSubsectionPropType interface to use provenanceNames instead of provDomain.
    • Updated the ArcTableRow component to receive provenanceName from the provenanceNames map.
  • static/js/browser/out_arc_section.tsx
    • Changed the OutArcSectionPropType interface to use provenanceNames instead of provDomain.
    • Updated the ArcTableRow component to receive provenanceName from the provenanceNames map.
Activity
  • The pull request was opened by nick-nlb with the title "Update provenance links in browser".
  • The author provided a detailed description, including a link to a buganizer issue (b/491143381).
  • Before and after screenshots were included in the description to visually demonstrate the UI changes.
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 updates the provenance links in the browser to display the provenance name instead of its URL, which improves the user interface's clarity. The backend is updated to fetch and return the provenance name, and the frontend is adjusted to consume this new data structure and display it. The changes are well-executed. I've suggested a minor simplification in the frontend code to make it more concise by removing a redundant check, taking advantage of the guarantees provided by the updated backend API.

…tain data sources more sensible or human-readable. It currently only contains a mapping of the very common `HumanReadableStatVars` to `Data Commons`.

Update tests for changes in this PR.
@nick-nlb nick-nlb marked this pull request as ready for review March 10, 2026 23:02
@nick-nlb nick-nlb requested review from beets and kmoscoe March 10, 2026 23:15
/**
* Mapping of raw provenance names (returned by the API) to custom display names.
* This can be used to make certain data sources more human-readable in the UI.
* If a provenance name is not in this map, the original string will be used.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does "original string" mean? Is it the DCID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry - that was unclear! The original string is the provenance name given by the API. It would only ever be a DCID if there isn't a name (although as you verified, there should always be a name).

I'll update the comment.

}
const predicates = Object.keys(this.state.data);
predicates.sort(this.predicateComparator);
return (
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure where the best place to put this comment is, but I just thought of another consideration. We really should not show the Provenance column at all when the node is of type Provenance itself. It doesn't make sense to show a link that just links back to the same page (i.e. goes nowhere). Could we add some logic to check if the subject node is of type Provenance and then show a 2-column table consisting of property and value only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

)}
className="arc-group-title"
>
<span className="mp">Subject Type: {this.props.parentType}</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, not sure where to put this comment, but if the "Subject type" is "Provenance", we shouldn't show the third column, since it will just show the same content and link as the second one. Can we put a check in for subject type "Provenance" and then render a 2-table column only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now done as well. As I was doing this, I noticed that there are at least two other "special DC provenances" where the provenance name is a little unusual: ExperimentalStatVars and RawStatVars.

What do you think of doing away with the explicit override map we are using, but rather label all "dc/base/..." Provenances as Data Commons?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it true though?

@kmoscoe
Copy link
Contributor

kmoscoe commented Mar 10, 2026 via email

… "Provenance" and the out-arcs to hide the provenance column when the node is of type provenance.

To keep the widths of the columns consistent regardless of whether there are two or three columns, the CSS now explicitly targets the provenance column for width, rather than the last column.
@kmoscoe kmoscoe self-requested a review March 11, 2026 18:34
Copy link
Contributor

@kmoscoe kmoscoe left a comment

Choose a reason for hiding this comment

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

Thanks so much! Leaving the answer to your latest question up to you. :-)

@nick-nlb
Copy link
Contributor Author

Thanks so much! Leaving the answer to your latest question up to you. :-)

As per our discussion, we've gone the careful route and removed the mapping, showing the provenance names directly regardless of what they are.

@nick-nlb nick-nlb merged commit 517e909 into datacommonsorg:master Mar 16, 2026
12 checks passed
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.

3 participants