Skip to content

Commit

Permalink
Changed metadata sorting in compute_covidcast_meta
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrotsko committed Jul 24, 2023
1 parent 60a01f2 commit eebfdbe
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/acquisition/covidcast/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,7 @@ def worker():
t.join()
logger.info("all threads terminated")

# sort the metadata because threaded workers dgaf
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
meta = sorted(meta, key=lambda x: (x['data_source'], x['signal'], x['time_type'], x['geo_type']))

return meta

Expand Down

0 comments on commit eebfdbe

Please sign in to comment.