argilla
argilla copied to clipboard
[SPIKE] feat: refresh record `count_submitted_responses` column using context functions
Description
This PR include changes to explore the possibility of using a new column named count_submitted_responses
to records
table.
This new column will be refreshed every time a response is created/updated/deleted maintaining a correct counter value of the submitted responses that a record has.
With this value we can easily filter records that are in completed
status, using the distribution strategy for the associated dataset.
Changes that are included in this PR:
- Refresh
count_submitted_responses
when a response is created/updated/deleted.
Changes that are not present in this PR
- Refresh
count_submitted_responses
when responses are created in bulk. - Refresh
count_submitted_responses
when records are created/upserted in bulk. - Refresh modified records into the search engine.
- Include
count_submitted_responses
into the search engine mapping. - Add new calculated value
status
to record responses.- We need to explore if this could fit into the ORM model or Pydantic schemas.
- Modify the search endpoint to return records with specific
status
value.
Refs #5069
Type of change
(Please delete options that are not relevant. Remember to title the PR according to the type of change)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Refactor (change restructuring the codebase without changing functionality)
- [ ] Improvement (change adding some improvement to an existing functionality)
- [ ] Documentation update
How Has This Been Tested
(Please describe the tests that you ran to verify your changes. And ideally, reference tests
)
- [ ] Test A
- [ ] Test B
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/)