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

feat: update create suggestion endpoint to PUT #3391

Merged
merged 26 commits into from
Jul 13, 2023

Conversation

gabrielmbmb
Copy link
Member

@gabrielmbmb gabrielmbmb commented Jul 12, 2023

Description

This PR updates the POST create suggestion endpoint added in #3304 to be a PUT endpoint instead that allows creating a suggestion for a given combination of question + record (if it doesn't exist) or update an existing one:

  • The endpoint will return a 201 when the suggestion is created
  • The endpoint will return a 200 when the suggestion existed and it has been updated.

Also, this PR updates the Suggestion SQLAlchemy ORM model adding a new unique constraint for record id and question id. As the migration file added in #3304 to create the suggestions table has not been applied yet in any prod environment, just in dev.argilla.io, I modified the migration file to include this unique constraint. Before deploying these changes in dev.argilla.io we will need to:

  1. Revert the migration
  2. Apply the latest migration

Type of change

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

How Has This Been Tested

Manually in a local environment and I've added unit tests.

Checklist

  • I added relevant documentation
  • follows the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I filled out the contributor form (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@gabrielmbmb gabrielmbmb added type: enhancement Indicates new feature requests area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints labels Jul 12, 2023
@gabrielmbmb gabrielmbmb added this to the v1.13.0 milestone Jul 12, 2023
Copy link
Member

@frascuchon frascuchon left a comment

Choose a reason for hiding this comment

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

Just a comment regarding the new schema

@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Patch coverage: 94.71% and project coverage change: +0.22 🎉

Comparison is base (6630d7b) 90.13% compared to head (78f2362) 90.36%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3391      +/-   ##
===========================================
+ Coverage    90.13%   90.36%   +0.22%     
===========================================
  Files          233      243      +10     
  Lines        12493    12939     +446     
===========================================
+ Hits         11261    11692     +431     
- Misses        1232     1247      +15     
Flag Coverage Δ
pytest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ack/integrations/huggingface/card/_dataset_card.py 100.00% <ø> (ø)
.../feedback/integrations/huggingface/card/_parser.py 100.00% <ø> (ø)
src/argilla/feedback/__init__.py 100.00% <ø> (ø)
src/argilla/tasks/database/migrate.py 39.13% <ø> (-4.87%) ⬇️
src/argilla/training/autotrain_advanced.py 0.00% <0.00%> (ø)
src/argilla/utils/telemetry.py 89.09% <ø> (ø)
src/argilla/server/settings.py 77.65% <50.00%> (-3.52%) ⬇️
src/argilla/server/database.py 75.00% <63.63%> (-25.00%) ⬇️
...lient/feedback/integrations/huggingface/dataset.py 86.80% <86.80%> (ø)
src/argilla/client/feedback/dataset.py 79.86% <90.00%> (-2.36%) ⬇️
... and 64 more

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@alvarobartt alvarobartt left a comment

Choose a reason for hiding this comment

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

LGTM! Feel free to merge 👍🏻

@frascuchon frascuchon merged commit 88ced99 into develop Jul 13, 2023
@frascuchon frascuchon deleted the feature/suggestions-put-endpoint branch July 13, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints type: enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants