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

Extract view/link URL for reconciled cells #1457 #5960

Conversation

ayushrai206
Copy link
Member

Fixes #1457

Changes proposed in this pull request:

  • This basically adds another option of adding a column with url of matched entities in the reconcile->actions menu.

@github-actions github-actions bot added Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements. reconciliation Related to the reconciliation operations and other features labels Jul 4, 2023
Copy link
Sponsor Member

@wetneb wetneb left a comment

Choose a reason for hiding this comment

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

Really great work, congratulations!

We will likely need to improve the GREL expression a little so that it works in all cases.
For Wikidata, the identifiers of entities are of the form Q3498, so they can be directly inserted in the template and that gives a valid URL.

But some reconciliation services might use identifiers which include some characters which need to be escaped to make sure we get a valid URL.
The specification has a note about this:

To guarantee the correctness of the formed URI, clients MUST percent-encode component-delimiting reserved characters in the identifier, i.e. encode it as a URI component [RFC3986].

So we need to find a GREL function which can be used to do this encoding and then insert it at the right place in the expression to get the desired result.

@wetneb
Copy link
Sponsor Member

wetneb commented Jul 8, 2023

Your last commit 55010a6 is likely unintentional, no? The menu-reconcile.js file should not be deleted.

@ayushrai206
Copy link
Member Author

Your last commit 55010a6 is likely unintentional, no? The menu-reconcile.js file should not be deleted.

yes that was by mistake!

@ayushrai206 ayushrai206 force-pushed the 1457-Extract-view/link-URL-for-reconciled-cells branch from 55010a6 to beacab1 Compare July 10, 2023 10:28
@wetneb
Copy link
Sponsor Member

wetneb commented Jul 25, 2023

Congratulations @ayushrai206, it's looking great. However it looks like you have added some files by mistake (see the "Files changed" tab of this PR).

@ayushrai206 ayushrai206 force-pushed the 1457-Extract-view/link-URL-for-reconciled-cells branch from 16f2988 to 9fa8bc1 Compare July 25, 2023 17:17
Copy link
Sponsor Member

@wetneb wetneb left a comment

Choose a reason for hiding this comment

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

We can now do some style polishing, see the comments below.
Also, the file Add column_with_URLs_of_matched_entities.cy.js could be renamed to add_column_with_URLs_of_matched_entities.cy.js (to avoid having a space in its filename, and to follow the naming convention of other files in that directory).

@ayushrai206 ayushrai206 force-pushed the 1457-Extract-view/link-URL-for-reconciled-cells branch from cc8e61d to a2b5419 Compare July 27, 2023 19:06
Copy link
Sponsor Member

@wetneb wetneb left a comment

Choose a reason for hiding this comment

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

Almost there! Just a couple of nitpicks about code style.

Copy link
Sponsor Member

@wetneb wetneb left a comment

Choose a reason for hiding this comment

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

Good start! It looks like there are some issues with the overall structure of your code though.

@ayushrai206 ayushrai206 force-pushed the 1457-Extract-view/link-URL-for-reconciled-cells branch 5 times, most recently from 88c109d to b0b4c4d Compare September 14, 2023 23:28
@ayushrai206
Copy link
Member Author

Hey everyone,
In my most recent commit I have tried to resolve the problem of infinite loop and I have also commented out the cypress tests for a while since they were giving errors, will update the cypress tests when the code is approved. Also I was unsuccessful in removing force pushes from Github history so please do not compare the code in the force pushes, rather see my most recent commit for the actual changes.
Thank you
Ayushi

Copy link
Sponsor Member

@wetneb wetneb left a comment

Choose a reason for hiding this comment

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

Congratulations, it seems to work great!

It is a little difficult to review your code because you did not add any indentation. Could you indent it like the surrounding code, by using two spaces as indentation unit?

Also, the purpose of introducing this promptForColumn was to avoid the duplication of code with the "Add entity identifiers column" operation. So we should make sure that operation also switches to using this new function you introduced. You might need to add another parameter to make it possible to set the title of the dialog (since the current dialog title mentions URLs, which will not be appropriate for the other operation).

Copy link
Sponsor Member

@wetneb wetneb left a comment

Choose a reason for hiding this comment

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

Thanks, that's much better! It seems that by doing this refactoring you have changed the title of the dialog of the existing operation. Restoring the original title should help to get the Cypress test pass again. I would do that by adding a new argument to the promptForColumn function, which would be the title to display in the dialog. This way, you would still be able to use the same promptForColumn function in both operations, but display different titles to the user. This would let you keep the original dialog title for the existing operation and use an appropriate title (mentioning URLs) for the new operation.

Copy link
Sponsor Member

@wetneb wetneb left a comment

Choose a reason for hiding this comment

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

Great, the Cypress tests pass! Now perhaps you could re-enable the Cypress test for the new operation and we should be good to go :) I think the indentation can be improved still but I'm happy to do that at the end.

@ayushrai206 ayushrai206 marked this pull request as ready for review September 18, 2023 20:31
main/webapp/modules/core/langs/translation-en.json Outdated Show resolved Hide resolved
main/webapp/modules/core/langs/translation-en.json Outdated Show resolved Hide resolved
"add-column",
{
baseColumnName: column.name,
newColumnName: columnName,
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

The indentation can still be improved here. You can look for other calls to Refine.postCoreProcess for inspiration :)

ayushrai206 and others added 7 commits September 23, 2023 02:45
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
Fixing the indentation of Refine.postCoreProcess
Changing the dialog name in the cypress tests
FIxes minor mistake in the cypress tests
@wetneb wetneb merged commit 52535a9 into OpenRefine:master Sep 25, 2023
9 checks passed
@wetneb wetneb added this to the 3.8 milestone Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reconciliation Related to the reconciliation operations and other features Type: Feature Request Identifies requests for new features or enhancements. These involve proposing new improvements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extract view/link URL for reconciled cells
3 participants