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

[Feature] Support for sortType and sortOrder in outputColumns #209

Open
Udayraj123 opened this issue Sep 15, 2024 · 6 comments
Open

[Feature] Support for sortType and sortOrder in outputColumns #209

Udayraj123 opened this issue Sep 15, 2024 · 6 comments
Assignees
Labels

Comments

@Udayraj123
Copy link
Owner

Udayraj123 commented Sep 15, 2024

Is your feature request related to a problem? Please describe.
Currently we support outputColumns to be custom defined and we sort in an ascending alphanumerical order by default.
The users may want to dynamically sort the output columns in a descending order or just alphabetical instead of alphanumerical order.

Describe the solution you'd like
We sort the output columns here using the function custom_sort_output_columns.

  • We can modify this to accept user input for outputColumns.sortType(ALPHABETICAL, ALPHANUMERIC, CUSTOM) and outputColumns.sortOrder(ASC/DESC) in the template.json
  • In case of CUSTOM we expect the user to enter all available columns in outputColumns.columns
  • Make sure to do corresponding changes in the template_schema.py file and add its validations

Describe alternatives you've considered
As of now user has to define the custom order in case of descending order. Which may not be possible in case of custom sets(v2)

Additional context
N/A

Note: please share your queries and approaches on discord for quicker discussions:

@harshsennnn
Copy link

harshsennnn commented Sep 30, 2024

can u assign me with this issue

@Anushlinux
Copy link

Hello, I have a solution in my mind for outputColumns.sortOrder can you assign this issue to me?

@Udayraj123
Copy link
Owner Author

Hey @harshsennnn and @Anushlinux,
I will have to assign on a first come first serve basis - but only once one of you shares and discusses an approach that looks feasible.

If you don't get assigned don't worry there are other good first issues to look at, especially submitting your first sample via #40

Also you can join the discord server to discuss any queries with the community.

@YashBaviskar1
Copy link

YashBaviskar1 commented Oct 9, 2024

Hello There this is how I would try to approach this issue :
From what i understand we have to change this

        self.output_columns = sorted(
            all_template_columns, key=custom_sort_output_columns
        )

According to the problem we have to modify and add parameters over the outputColumns. specifically we need to add parameters

  • sortType with three possible values : ALPHABETICAL, ALPHANUMERIC, CUSTOM
  • sortOrder with two possible values ASC, DEC.

We can try this approach for sortType

  • For ALPHABETICAL, ALPHANUMERIC option we can try to directly use key parameter of the sorted() function in python
  • From what I understand about CUSTOM it will directly use the columns in the template.json and we can simply iterate through those columns

If there is anything more to my approach that needs to be changed then please let me know

@Prasadayus
Copy link

Proposed Solution:
Enhanced Sorting Options: Modify the sorting functionality of custom_sort_output_columns to accept user-defined sorting preferences via the template.json file.
Specifically:

  • Add an option for outputColumns.sortType that supports the following values:

2.ALPHABETICAL: Sort the columns alphabetically.
3.ALPHANUMERIC: Default alphanumerical sorting.
4.CUSTOM: User defines a custom order.

  • Add an option for outputColumns.sortOrder that supports:
    1.ASC: Ascending order (default behavior).
    2.DESC: Descending order.

  • For the CUSTOM option, users should specify the exact column order in outputColumns.columns.

Schema Changes: Update template_schema.py to reflect these new fields and validate the user inputs:

1.Ensure that sortType accepts only the allowed values (ALPHABETICAL, ALPHANUMERIC, CUSTOM).
2.Ensure that sortOrder accepts only ASC or DESC.
3.For the CUSTOM type, validate that all available columns are listed in the custom order.

@Udayraj123 can I work on this ?

@Udayraj123
Copy link
Owner Author

@YashBaviskar1 that looks good. You can work on this feature. Meanwhile @Prasadayus I see you've commented on one more issue, you can work on that instead.

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

No branches or pull requests

5 participants