From 3643800f8eb050f17590e0b59a81d57673f4975d Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Mon, 22 Nov 2021 14:31:14 -0500 Subject: [PATCH] [O] Process only if not processed --- src/process/twitter_process.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/process/twitter_process.py b/src/process/twitter_process.py index 6d9b4a8..f11dad0 100644 --- a/src/process/twitter_process.py +++ b/src/process/twitter_process.py @@ -85,6 +85,10 @@ def process_tweets(tweets_dir: str = './data/twitter/user-tweets/') -> None: for filename in os.listdir(f'{tweets_dir}/user'): # Only check json files and ignore macos dot files if filename.endswith('.json') and not filename.startswith('.'): + # Check if already processed + if os.path.isfile(f'{tweets_dir}/processed/{filename}'): + continue + # Read tweets = json.loads(read(f'{tweets_dir}/user/{filename}')) p = [Posting(is_covid_related(t['full_text']),