Skip to content

Service Ridership Dashboard S3

This page documents S3 functions in the Service Ridership Dashboard module.

ingestor.chalicelib.service_ridership_dashboard.s3

put_dashboard_json_to_s3(today, dash_json)

Upload dashboard JSON data to S3 as both a dated file and latest.json.

Parameters:

Name Type Description Default
today date

The date used to name the dated JSON file.

required
dash_json DashJSON

The dashboard JSON data to upload.

required
Source code in ingestor/chalicelib/service_ridership_dashboard/s3.py
def put_dashboard_json_to_s3(today: date, dash_json: DashJSON) -> None:
    """Upload dashboard JSON data to S3 as both a dated file and latest.json.

    Args:
        today: The date used to name the dated JSON file.
        dash_json: The dashboard JSON data to upload.
    """
    print("Uploading dashboard JSON to S3")
    contents = json.dumps(dash_json)
    bucket.put_object(Key=f"{date_to_string(today)}.json", Body=contents)
    bucket.put_object(Key="latest.json", Body=contents)