Skip to content

Commit

Permalink
chores: add assertion to check if previous day data is available
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalmhjn committed Jun 14, 2024
1 parent 5cb90ef commit f59153c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/call_data_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def merge_data(self):
for i in self.list_links:
df = pd.read_csv(f"{self.read_path}/raw_data_{i}.csv")
df["t_1h"] = pd.to_datetime(df["t_1h"])
assert (
str(df["t_1h"].dt.date.min()) == self.date_formatted
), f"Data for previous day is not available via API yet. For other days, manually set the offsets in API query."

if str(df["t_1h"].dt.date.min()) == self.date_formatted:
full_data_list.append(df)
else:
logging.info("Data for %s detector is not available", i)
full_data_list.append(df)
full_data = pd.concat(full_data_list, axis=0)
full_data.to_csv(self.path, index=False)

Expand Down

0 comments on commit f59153c

Please sign in to comment.