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

Add zotero handler implementation #9084

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

ElinaKapetanaki
Copy link

@ElinaKapetanaki ElinaKapetanaki commented Apr 15, 2024

Description

This is the Zotero Handler Implementation that is focused -for now- at connecting to the Zotero library of a user and selecting his/her annotations, which is highlighted text on research material (either all annotations, a specific one or all annotations on a specific item, like on a specific book). More information about the implementation can be found on the README file of the handler.

Also QA test is in this link showing that everything runs correctly https://github.com/ElinaKapetanaki/mindsdb-test/blob/main/Zotero_QA.MD

Fixes #5637

Type of change

  • ⚡ New feature (non-breaking change which adds functionality)

Verification Process

To ensure the changes are working as expected:

  • Test Location: Specify the URL or path for testing.
  • Verification Steps: Outline the steps or queries needed to validate the change. Include any data, configurations, or actions required to reproduce or see the new functionality.

Checklist:

  • My code follows the style guidelines(PEP 8) of MindsDB.
  • I have appropriately commented on my code, especially in complex areas.
  • Necessary documentation updates are either made or tracked in issues.
  • Relevant unit and integration tests are updated or added.

Copy link
Contributor

@MinuraPunchihewa MinuraPunchihewa left a comment

Choose a reason for hiding this comment

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

Hey @ElinaKapetanaki,
To continue our conversation on Slack here: is the pyzotero package installed in your virtual environment?

@ElinaKapetanaki
Copy link
Author

Yes pyzotero is installed in my mindsdb-venv.

@ElinaKapetanaki ElinaKapetanaki marked this pull request as ready for review May 27, 2024 00:01
@mindsdbadmin
Copy link
Contributor

mindsdbadmin commented May 27, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@ElinaKapetanaki
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@MinuraPunchihewa MinuraPunchihewa left a comment

Choose a reason for hiding this comment

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

Hey @ElinaKapetanaki,
Thank you very much for this great contribution!
I've got a couple of requests:

  1. Can you please resolve the conflicts here by merging the main branch into yours, please? The branches seem to be out of sync.
  2. Can you please post a few screenshots or a quick video of this handler working as expected?

@ElinaKapetanaki
Copy link
Author

Hello @MinuraPunchihewa ,
For the screenshots of the handler working as expected, in this link there are screenshots showing that everything works as expected : https://github.com/ElinaKapetanaki/mindsdb-test/blob/main/Zotero_QA.MD

Also I would like to post a screenshot of the tests for the handler passing as well:

tests

@ElinaKapetanaki
Copy link
Author

I also fixed the conflict problem.

@MinuraPunchihewa
Copy link
Contributor

@ZoranPandovski Do you know the reason why this workflow is failing?

@ZoranPandovski
Copy link
Member

That action deploys to our cloud dev environment by labeling the PR; we can ignore that. If this is ready, we can merge it tomorrow

@ElinaKapetanaki
Copy link
Author

@ZoranPandovski What about the Test on Push failing with the error "Running on Github Actions but GITHUB_TOKEN is not set."?

@ElinaKapetanaki
Copy link
Author

From my part, I think everything is ready and you can see it working in the link I have in above comments. This was my first ever PR, so I am very excited about merging tommorrow!! @MinuraPunchihewa @ZoranPandovski

@ElinaKapetanaki
Copy link
Author

Goodmorning!! Are we merging this today? @MinuraPunchihewa @ZoranPandovski

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please split ZoteroHandler and AnnotationsTable into their own modules? We can call them zotero_handler.py and zotero_tables.py. This will make it easier to add support for more tables (if any) moving forward?

df = self.call_find_annotations_zotero_api(method_name, params)
return Response(RESPONSE_TYPE.TABLE, data_frame=df)

def call_find_annotations_zotero_api(self, method_name: str = None, params: dict = None) -> pd.DataFrame:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we please move this method to AnnotationsTable? Personally, I am not the biggest fan of including this function within the handler class, especially with the use of method_name parameter.

When moving it, since it does not require to be generic as such, we can maybe remove the method_name parameter.

Copy link
Author

Choose a reason for hiding this comment

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

method_name from what I see can take 3 values : items, (to get all annotations) item (to get 1 annotation) or children (to get the annotations of for ex. a specific article), because these are 3 methods that are used from the API . So I am not sure if we can remove it, since that information must be passed to the method.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense. Instead of removing it, can we then give it a more meaningful name? When moving it to the Table class, I think you could even break it down into three functions like get_items(), get_items() and get_item_children().

The approach to take there is completely up to you; my only request is that we move this method to the class where the logic belongs.

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.

[Integration]: Zotero API Integration
4 participants