-
Notifications
You must be signed in to change notification settings - Fork 67
Closed
Description
it looks quite difficult how the sorting is handled:
delphi-epidata/src/acquisition/covidcast/database.py
Lines 330 to 335 in d6dd046
| sorting_fields = "data_source signal time_type geo_type".split() | |
| sortable_fields_fn = lambda x: [(field, x[field]) for field in sorting_fields] | |
| prepended_sortables_fn = lambda x: sortable_fields_fn(x) + list(x.items()) | |
| tuple_representation = list(map(prepended_sortables_fn, meta)) | |
| tuple_representation.sort() | |
| meta = list(map(dict, tuple_representation)) # back to dict form |
can't the key function as in .sort(key=lambda x: (x['data_source'], x['signal'], x['time_type'], x['geo_type'])) be used instead?
krivard