From 47033836482d35dac82b4d37d7c390b16c440159 Mon Sep 17 00:00:00 2001 From: ggman12 Date: Tue, 17 Feb 2026 17:55:49 -0500 Subject: [PATCH] add hisotircal-adsb-run.yaml --- .github/workflows/historical-adsb-run.yaml | 115 +++++++++++++++++++++ .github/workflows/historical-adsb.yaml | 6 ++ 2 files changed, 121 insertions(+) create mode 100644 .github/workflows/historical-adsb-run.yaml diff --git a/.github/workflows/historical-adsb-run.yaml b/.github/workflows/historical-adsb-run.yaml new file mode 100644 index 0000000..bb7fb52 --- /dev/null +++ b/.github/workflows/historical-adsb-run.yaml @@ -0,0 +1,115 @@ +name: Historical ADS-B Run + +on: + workflow_dispatch: + inputs: + start_date: + description: 'YYYY-MM-DD (inclusive)' + required: true + type: string + end_date: + description: 'YYYY-MM-DD (exclusive)' + required: true + type: string + +jobs: + generate-dates: + runs-on: ubuntu-24.04-arm + outputs: + dates: ${{ steps.generate.outputs.dates }} + steps: + - name: Generate date list + id: generate + env: + START_DATE: ${{ inputs.start_date }} + END_DATE: ${{ inputs.end_date }} + run: | + python - <<'PY' + import json + from datetime import datetime, timedelta + + start = datetime.strptime("${START_DATE}", "%Y-%m-%d") + end = datetime.strptime("${END_DATE}", "%Y-%m-%d") + if end <= start: + raise SystemExit("end_date must be after start_date") + + dates = [] + cur = start + while cur < end: + dates.append(cur.strftime("%Y-%m-%d")) + cur += timedelta(days=1) + + with open("$GITHUB_OUTPUT", "a") as f: + f.write(f"dates={json.dumps(dates)}\n") + PY + + adsb-day: + needs: generate-dates + strategy: + fail-fast: true + matrix: + date: ${{ fromJson(needs.generate-dates.outputs.dates) }} + uses: ./.github/workflows/historical-adsb.yaml + with: + date: ${{ matrix.date }} + + adsb-final: + needs: adsb-day + runs-on: ubuntu-24.04-arm + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup Python + uses: actions/setup-python@v6 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Download daily CSVs + uses: actions/download-artifact@v4 + with: + pattern: openairframes_adsb-* + path: outputs/daily/ + merge-multiple: true + + - name: Concatenate all days to final CSV + env: + START_DATE: ${{ inputs.start_date }} + END_DATE: ${{ inputs.end_date }} + run: | + python - <<'PY' + import re + from pathlib import Path + import polars as pl + + start = "${START_DATE}" + end = "${END_DATE}" + daily_dir = Path("outputs/daily") + files = sorted(daily_dir.glob("openairframes_adsb_*.csv")) + if not files: + raise SystemExit("No daily CSVs found") + + def date_key(path: Path) -> str: + m = re.match(r"openairframes_adsb_(\d{4}-\d{2}-\d{2})_", path.name) + return m.group(1) if m else path.name + + files = sorted(files, key=date_key) + frames = [pl.read_csv(p) for p in files] + df = pl.concat(frames, how="vertical", rechunk=True) + + output_path = Path("outputs") / f"openairframes_adsb_{start}_{end}.csv" + df.write_csv(output_path) + print(f"Wrote {output_path} with {df.height} rows") + PY + + - name: Upload final CSV + uses: actions/upload-artifact@v4 + with: + name: openairframes_adsb-${{ inputs.start_date }}-${{ inputs.end_date }} + path: outputs/openairframes_adsb_${{ inputs.start_date }}_${{ inputs.end_date }}.csv + retention-days: 30 diff --git a/.github/workflows/historical-adsb.yaml b/.github/workflows/historical-adsb.yaml index f19e04e..27e83b8 100644 --- a/.github/workflows/historical-adsb.yaml +++ b/.github/workflows/historical-adsb.yaml @@ -7,6 +7,12 @@ on: description: 'YYYY-MM-DD' required: true type: string + workflow_call: + inputs: + date: + description: 'YYYY-MM-DD' + required: true + type: string jobs: adsb-extract: