-
Notifications
You must be signed in to change notification settings - Fork 412
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: add draft
status to Response
#3033
Conversation
I'll update some unit tests that I've missed from |
updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.269 → v0.0.270](astral-sh/ruff-pre-commit@v0.0.269...v0.0.270)
5b42ba3
to
38f4e2d
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #3033 +/- ##
===========================================
- Coverage 90.81% 90.81% -0.01%
===========================================
Files 208 208
Lines 11181 11179 -2
===========================================
- Hits 10154 10152 -2
Misses 1027 1027
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
tests/server/api/v1/test_records.py
Outdated
@@ -101,7 +101,7 @@ def create_multi_label_selection_questions(dataset: "Dataset") -> None: | |||
), | |||
], | |||
) | |||
def test_create_record_response( | |||
def test_create_record_response_with_valid_values( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the new test name, we should parameterize also the status
and create responses with partial values (this is a difference between submitted
and draft
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super!!!
Just adding some tests regarding draft responses with partial values (which should be created correctly)
# Description I've added a new possible status for the `Response` model called `draft`. As this is a new possible status, I've also updated the `GET /api/v1/me/datasets/:dataset_id/metrics` endpoint to return also the count of responses with their status equal to `draft`. In addition, I've removed the `SubmittedResponseCreate` and `DiscardedResponseCreate` classes and the discriminated union in which they were being used (`ResponseCreate`), and instead I've created a `pydantic.BaseModel` class called `ResponseCreate`. Also, I've refactored the functions for getting the count of the responses based on their status: - `count_responses_by_dataset_id_and_user_id` now accepts an optional `response_status` argument - `count_submitted_responses_by_dataset_id_and_user_id` and `count_discarded_responses_by_dataset_id_and_user_id` have been removed. Finally, I've updated the unit tests for the endpoints `GET /api/v1/me/datasets/:dataset_id/metrics`, `GET /api/v1/me/datasets/:dataset_id/records` and `POST /api/v1/records/:record_id/responses`. Closes #3008 **Type of change** - [x] New feature (non-breaking change which adds functionality) - [x] Refactor **How Has This Been Tested** All the relevant unit tests for these changes have been updated and re-executed. **Checklist** - [x] I have merged the original branch into my forked branch - [ ] I added relevant documentation - [x] follows the style guidelines of this project - [x] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Francisco Aranda <[email protected]>
# Description I've added a new possible status for the `Response` model called `draft`. As this is a new possible status, I've also updated the `GET /api/v1/me/datasets/:dataset_id/metrics` endpoint to return also the count of responses with their status equal to `draft`. In addition, I've removed the `SubmittedResponseCreate` and `DiscardedResponseCreate` classes and the discriminated union in which they were being used (`ResponseCreate`), and instead I've created a `pydantic.BaseModel` class called `ResponseCreate`. Also, I've refactored the functions for getting the count of the responses based on their status: - `count_responses_by_dataset_id_and_user_id` now accepts an optional `response_status` argument - `count_submitted_responses_by_dataset_id_and_user_id` and `count_discarded_responses_by_dataset_id_and_user_id` have been removed. Finally, I've updated the unit tests for the endpoints `GET /api/v1/me/datasets/:dataset_id/metrics`, `GET /api/v1/me/datasets/:dataset_id/records` and `POST /api/v1/records/:record_id/responses`. Closes #3008 **Type of change** - [x] New feature (non-breaking change which adds functionality) - [x] Refactor **How Has This Been Tested** All the relevant unit tests for these changes have been updated and re-executed. **Checklist** - [x] I have merged the original branch into my forked branch - [ ] I added relevant documentation - [x] follows the style guidelines of this project - [x] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Francisco Aranda <[email protected]>
# Description This PR replaces the pre-defined `Literal`s for the response status in both the Python SDK and the Python client, so as to use an `Enum` instead. Besides that, also the `draft` status has been included as it was previously missing, but as of #3033 it was included in the API and as of #3541 it was also included in the UI. Closes #3745 **Type of change** - [X] Bug fix (non-breaking change which fixes an issue) - [X] Improvement (change adding some improvement to an existing functionality) **How Has This Been Tested** (Please describe the tests that you ran to verify your changes. And ideally, reference `tests`) - [X] Added `draft` as another use-case of the `ResponseSchema` unit tests - [x] Added responses with `draft` status in `from_argilla` integration tests **Checklist** - [ ] I added relevant documentation - [X] follows the style guidelines of this project - [X] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [X] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK) (see text above) - [x] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)
Description
I've added a new possible status for the
Response
model calleddraft
. As this is a new possible status, I've also updated theGET /api/v1/me/datasets/:dataset_id/metrics
endpoint to return also the count of responses with their status equal todraft
.In addition, I've removed the
SubmittedResponseCreate
andDiscardedResponseCreate
classes and the discriminated union in which they were being used (ResponseCreate
), and instead I've created apydantic.BaseModel
class calledResponseCreate
.Also, I've refactored the functions for getting the count of the responses based on their status:
count_responses_by_dataset_id_and_user_id
now accepts an optionalresponse_status
argumentcount_submitted_responses_by_dataset_id_and_user_id
andcount_discarded_responses_by_dataset_id_and_user_id
have been removed.Finally, I've updated the unit tests for the endpoints
GET /api/v1/me/datasets/:dataset_id/metrics
,GET /api/v1/me/datasets/:dataset_id/records
andPOST /api/v1/records/:record_id/responses
.Closes #3008
Type of change
How Has This Been Tested
All the relevant unit tests for these changes have been updated and re-executed.
Checklist