Skip to content

Commit

Permalink
increase lookback days on trip metrics ingestion (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
idreyn authored Apr 6, 2024
1 parent cf921b1 commit 592350a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ingestor/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def update_time_predictions(event):
# 4:40am UTC -> 2:40/3:40am ET every day
@app.schedule(Cron(40, 7, "*", "*", "?", "*"))
def update_trip_metrics(event):
trip_metrics.ingest_trip_metrics_yesterday()
trip_metrics.ingest_recent_trip_metrics(lookback_days=7)


# Manually triggered lambda for populating daily trip metric tables. Only needs to be ran once.
Expand Down
4 changes: 2 additions & 2 deletions ingestor/chalicelib/trip_metrics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__all__ = ["ingest_trip_metrics_yesterday", "ingest_trip_metrics"]
__all__ = ["ingest_recent_trip_metrics", "ingest_trip_metrics"]

from .ingest import ingest_trip_metrics_yesterday, ingest_trip_metrics
from .ingest import ingest_recent_trip_metrics, ingest_trip_metrics
8 changes: 4 additions & 4 deletions ingestor/chalicelib/trip_metrics/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def ingest_trip_metrics(start_date: date, end_date: date):
dynamo.dynamo_batch_write(row_dicts, "DeliveredTripMetricsExtended")


def ingest_trip_metrics_yesterday():
today = date.today()
yesterday = today - timedelta(days=1)
ingest_trip_metrics(yesterday, today)
def ingest_recent_trip_metrics(lookback_days: int = 1):
end = date.today()
start = end - timedelta(days=lookback_days)
ingest_trip_metrics(start, end)

0 comments on commit 592350a

Please sign in to comment.