-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional file monitoring instruction
- Loading branch information
Gordon Shotwell
committed
Dec 6, 2023
1 parent
1f376a0
commit bf5c115
Showing
5 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Problem description | ||
|
||
Data apps often sit at the end of a larger data processing pipeline, and so it is helpful to have your app update whenever the underlying data files change. | ||
Data apps often sit at the end of a larger data processing pipeline, and so it is helpful to have your app update whenever the underlying data files change. An example data generating script can be found in `populate-logs.py` which irregularly appends a row to a data frame. | ||
|
||
# Requirements | ||
- App should read in and render a csv file, whenever that csv file changes the application should update without any user action. | ||
- App should read in and render a csv file as a data frame, whenever that csv file changes the data frame output should rerender. | ||
- The application shouldn't rerender if the csv file is unchanged. | ||
- Othe components should be usable as the data frame rerenders. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
date,status | ||
2023-12-05 18:48:35.076744,status5 | ||
2023-12-05 18:48:36.081387,status14 | ||
2023-12-05 18:48:37.088922,status19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pandas as pd | ||
from datetime import datetime | ||
from pathlib import Path | ||
|
||
import random | ||
import time | ||
|
||
log_path = Path(__file__).parent / "logs.csv" | ||
|
||
while True: | ||
status = "status" + str(random.randint(0, 20)) | ||
# Create a new DataFrame with the current time and the random status | ||
df = pd.DataFrame({"date": [datetime.now()], "status": [status]}) | ||
|
||
df.to_csv(log_path, mode="a", header=False, index=False) | ||
# Wait for a second before the next append operation | ||
time.sleep(random.randint(1, 5)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters