Skip to content

Commit 568e4ba

Browse files
taheeraahmednicokant
authored andcommitted
add flag for today to only fetch data from today
1 parent d319540 commit 568e4ba

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/datasync/pit_registering_salmon.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def run(
235235
False, help="Download data from all accessible locations"
236236
),
237237
base_url: str = BIOMARK_BASE_URL,
238+
today: bool = typer.Option(False, help="Set date range to today only"),
238239
):
239240
"""Download PIT data from BioMark's API to a .duckdb file."""
240241

@@ -251,6 +252,11 @@ def run(
251252
"--tags, --readers, or --environment"
252253
)
253254

255+
if today:
256+
begin_date = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
257+
end_date = datetime.today().strftime("%Y-%m-%d")
258+
log.info("Setting date range to today", date=begin_date)
259+
254260
if all_locations:
255261
# skip 'vatne' (0NO) as it returns 403 Forbidden
256262
accessible_sites = {k: v for k, v in SITES.items() if k != "vatne"}

0 commit comments

Comments
 (0)