Skip to content

Commit eb46bf2

Browse files
authored
Fix sorting in compute_covidcast_meta (#1243)
1 parent 061c460 commit eb46bf2

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/acquisition/covidcast/database.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,7 @@ def worker():
526526
t.join()
527527
logger.info("all threads terminated")
528528

529-
# sort the metadata because threaded workers dgaf
530-
sorting_fields = "data_source signal time_type geo_type".split()
531-
sortable_fields_fn = lambda x: [(field, x[field]) for field in sorting_fields]
532-
prepended_sortables_fn = lambda x: sortable_fields_fn(x) + list(x.items())
533-
tuple_representation = list(map(prepended_sortables_fn, meta))
534-
tuple_representation.sort()
535-
meta = list(map(dict, tuple_representation)) # back to dict form
529+
meta = sorted(meta, key=lambda x: (x['data_source'], x['signal'], x['time_type'], x['geo_type']))
536530

537531
return meta
538532

0 commit comments

Comments
 (0)