From aedd7b3df564b8ac64c4d2d4ad849f80dcc18aa1 Mon Sep 17 00:00:00 2001 From: ggman12 Date: Sun, 1 Feb 2026 19:01:42 -0500 Subject: [PATCH] fix: update repository path and improve cloning logic in FAA data retrieval --- src/get_historical_faa.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/get_historical_faa.py b/src/get_historical_faa.py index 0cf39eb..f48f096 100644 --- a/src/get_historical_faa.py +++ b/src/get_historical_faa.py @@ -14,23 +14,35 @@ from derive_from_faa_master_txt import convert_faa_master_txt_to_csv import zipfile import pandas as pd -REPO = "/Users/jonahgoode/Documents/PlaneQuery/Other-Code/scrape-faa-releasable-aircraft" +# Clone repository if it doesn't exist +REPO = Path("data/scrape-faa-releasable-aircraft") +if not REPO.exists(): + print(f"Cloning repository to {REPO}...") + subprocess.run([ + "git", "clone", + "https://github.com/simonw/scrape-faa-releasable-aircraft", + str(REPO) + ], check=True) + print("Repository cloned successfully.") +else: + print(f"Repository already exists at {REPO}") + OUT_ROOT = Path("data/faa_releasable_historical") OUT_ROOT.mkdir(parents=True, exist_ok=True) def run_git_text(*args: str) -> str: - return subprocess.check_output(["git", "-C", REPO, *args], text=True).strip() + return subprocess.check_output(["git", "-C", str(REPO), *args], text=True).strip() def run_git_bytes(*args: str) -> bytes: - return subprocess.check_output(["git", "-C", REPO, *args]) + return subprocess.check_output(["git", "-C", str(REPO), *args]) # All commits in Feb 2024 (oldest -> newest) log = run_git_text( "log", "--reverse", "--format=%H %cs", - "--since=2024-01-01", - "--until=2024-08-08", + "--since=2024-06-01", + "--until=2024-06-08", ) lines = [ln for ln in log.splitlines() if ln.strip()] if not lines: