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

Canonical sort order in the compare view #301

Open
adieyal opened this issue Oct 2, 2018 · 3 comments
Open

Canonical sort order in the compare view #301

adieyal opened this issue Oct 2, 2018 · 3 comments

Comments

@adieyal
Copy link

adieyal commented Oct 2, 2018

https://wazimap.co.za/data/distribution/?table=ANNUALHOUSEHOLDINCOME_GENDEROFHOUSEHOLDHEAD&primary_geo_id=ward-79900061&geo_ids=ward|municipality-TSH&release=2011

Currently the values for a particular indicator are sorted by alphabetical value - this is annoying if the number is numeric, e.g. household income. There should be a canonical sort order for every indicator

@longhotsummer
Copy link
Collaborator

Now that we have descriptions of the data tables inside Django models, we can probably add a field which describes the sort order. eg. "strip all non-numbers and sort numerically" vs alphabetical.

@adieyal
Copy link
Author

adieyal commented Oct 3, 2018 via email

@longhotsummer
Copy link
Collaborator

Maybe I'm misunderstanding what you mean by canonical ordering. Assuming you mean "any ordering, as long as we have one and its consistently used", I think we need to be a bit smarter, in particular with labels that have numbers. Here's what an alphabetical ordering of this sort of dataset looks like:

No income
Not applicable
R 1 228 801 - R 2 457 600
R 1228801 - R 2457600
R 153601 - R 307200
R 153 801 - R 307 600
R 19201 - R 38400
R 19 601 - R 38 200
R 1 - R 4800
R 2 457 601 or more
R2457601 or more
R 307201 - R 614400
R 307 601 - R 614 400
R 38 201 - R 76 400
R 38401 -  R 76800
R 4801 - R 9600
R 614 001 - R 1 228 800
R 614401- R 1228800
R 76 401 - R 153 800
R 76801 - R 153600
R 9601 - R 19200
R 9601 - R 19 600
Unspecified

I don't think it's useful to the user, it looks arbitrary. We're also at the mercy of the original source's categories -- so if they have inconsistent spacing, we'll get inconsistent results.

I suggest that for each model we default to an alphabetical ordering, with an option of switching to a numerical ordering (which we can use on this dataset). Here's an example of what that could result in:

R 1 - R 4800
R 4801 - R 9600
R 9601 - R 19200
R 9601 - R 19 600
R 19201 - R 38400
R 19 601 - R 38 200
R 38 201 - R 76 400
R 38401 -  R 76800
R 76 401 - R 153 800
R 76801 - R 153600
R 153601 - R 307200
R 153 801 - R 307 600
R 307201 - R 614400
R 307 601 - R 614 400
R 614 001 - R 1 228 800
R 614401- R 1228800
R 1 228 801 - R 2 457 600
R 1228801 - R 2457600
R 2 457 601 or more
R2457601 or more
No income
Not applicable
Unspecified

If we add any sort of server-side ordering, we'll need to adjust the API to allow the client to benefit from it (eg. by including an ordering list or something). Currently the API returns columns in a JSON object, which has unspecified ordering.

Currently there is no explicit ordering at all.

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

No branches or pull requests

2 participants