diff --git a/metrics/datagov_metrics/ckan.py b/metrics/datagov_metrics/ckan.py index 6ddf82b2c..7fb154df2 100644 --- a/metrics/datagov_metrics/ckan.py +++ b/metrics/datagov_metrics/ckan.py @@ -2,6 +2,7 @@ import csv import io from datagov_metrics.s3_util import put_data_to_s3 +from datagov_metrics.ga import date_range_last_month CKAN_BASE_URL = "https://catalog.data.gov/api/action/package_search" QUERIES = { @@ -34,9 +35,10 @@ def write_data_to_csv(response): def main(): data = get_data() + end_date = date_range_last_month()[0]["endDate"] # for example, 2024-10-31 for k, v in data.items(): csv_data = write_data_to_csv(v) - put_data_to_s3(f"global__{k}.csv", csv_data) + put_data_to_s3(f"global__{k}.{end_date}.csv", csv_data) if __name__ == "__main__":