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

Deterministic ordering of corpus fields #1671

Open
BeritJanssen opened this issue Oct 3, 2024 · 3 comments
Open

Deterministic ordering of corpus fields #1671

BeritJanssen opened this issue Oct 3, 2024 · 3 comments
Assignees
Labels
enhancement improvements to user functionality

Comments

@BeritJanssen
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The order of fields used to be determined by the ordering in the corpus definition. With the conversion to database corpora, this does not seem to be the case anymore, while there used to be a convention that the datefield was always the first filter to appear in the list.
Screenshot 2024-10-03 at 12 00 19

Describe the solution you'd like
We might add an order field to the fields, which, for python corpora, might be set with a data migration, and for other corpora, might have the default of 0, giving the user the option to move fields up or down in the display.

Describe alternatives you've considered
We might also enforce ordering based on Python files, but for "database born" corpora, this is not a solution.

@BeritJanssen BeritJanssen added the enhancement improvements to user functionality label Oct 3, 2024
@lukavdplas
Copy link
Contributor

We might add an order field to the fields, which, for python corpora, might be set with a data migration, and for other corpora, might have the default of 0, giving the user the option to move fields up or down in the display.

Django's order_with_respect_to does pretty much exactly what you describe here!

@BeritJanssen
Copy link
Contributor Author

Ah, noice! Didn't know of that yet, nice sugar around adding your own ordering field.

@Meesch Meesch self-assigned this Oct 10, 2024
@lukavdplas
Copy link
Contributor

Some more thoughts:

  • The JSON and Python APIs for corpora both pass the fields as an ordered list/array, so the order in the database can be set from that definition.
  • In the corpus creation form, we can say that, for now, the order of fields in the JSON is taken from the example CSV. (I suspect this is already the case in Feature/corpus form #1659) Eventually, it would be nice if the form also included controls to adjust the order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improvements to user functionality
Projects
None yet
Development

No branches or pull requests

3 participants