# 103. NYC mobility operations

**Owner: Djellon Pllana.** Independently built portfolio case study using historical public observations. No employment by, or partnership with, the source organizations is claimed.

## Business question

Where are recorded taxi activity and charges concentrated, and can pickup-time information estimate trip duration in a later month?

## Executive result

The warehouse reconciles 12,885,358 reported trips into 11,459,171 eligible observations. Future-month duration MAE is 6.12 minutes, 2.9% lower than the route-hour baseline.

The full warehouse and the sampled model evaluation have different scopes. Passenger charges are not profit; deployment decisions need fleet and dispatch data.

![Computed analysis](outputs/chart.png)

## Scope and architecture

12,885,358 original observations. Original files → hashed source manifest → typed transformations and SQL marts → chronological experiments → executed notebook → aggregate interactive dashboard.

1. Original monthly Parquet and taxi-zone CSV files, with retrieval hashes.
2. SQL classifies every source row, preserves an exclusion ledger, and aggregates at declared grains.
3. Train on April, select configuration on May, and evaluate once on June trips.
4. Use trip-weighted metrics and a paired daily bootstrap; inspect borough errors.
5. Serve aggregate dashboard data; keep large source files and trip-level samples outside the website.

## Data contract

Trip ledger: one reported trip, without an invented unique business identifier. Eligible trips: source-month pickup, 1–180 minutes, 0.1–100 miles, positive charge at most $1,000, nonnegative fare and known endpoint zones. These are analyst scope rules, not official TLC quality labels. Daily mart: one pickup date and borough. Zone mart: one month and pickup zone. The source may contain genuine identical trips; no automatic deduplication is applied.

## Model and evaluation

Target: occupied trip minutes. Inputs: pickup zone, destination zone, pickup hour and weekday. Destination zone is assumed known at dispatch; a meter-only setting without a destination cannot use this model. Distance, fare, payment and tips are excluded because they are finalized after travel. Fixed April training and May validation precede the June test. A stronger baseline uses training route-hour medians and falls back to the global training median. Zones are integer-encoded; unseen-zone behavior and additional geometry features require a future test.

See [evaluation.json](outputs/evaluation.json), [results.csv](outputs/results.csv) and [quality.json](outputs/quality.json). Test observations are not used to choose configurations. Results are from the current historical evaluation; additional tuning requires a new evaluation period.

## Recommended next decision

Use the borough and month dashboard to inspect demand concentration and trip mix. Evaluate the duration model in shadow mode with dispatch data before changing service promises or fleet allocation.

## Limitations

Recorded trips do not measure unmet demand, fleet utilization, or driver earnings. Charges include fees and exclude cash tips. The model is evaluated on a bounded, deterministic sample of eligible trips and only one future month. It excludes implausible trip records. Native Power BI Desktop refresh and rendering remain unverified.

## Reproduce

From the full project-collection root, use Python 3.12 and install `capstones/requirements.txt`. Run `python projects/103-nyc-mobility-operations/analysis.py` or execute this project's notebook. Raw files are fetched from the original publisher, hashed and cached in `data/raw/capstones`. The full NYC run reads over 200 MB of compressed source data and needs several GB of working memory and disk. The website carries aggregated results rather than raw trip logs or trained model binaries.

The project Python file exposes the full study code. Shared helpers live in `capstones/common.py`; source downloads are declared in `capstones/fetch.py`; the native NYC Power BI companion is generated with `python -m capstones.bi`.

## Source and attribution

[NYC TLC yellow taxi trip records, April–June 2025](https://www.nyc.gov/site/tlc/about/tlc-trip-record-data.page) — NYC Taxi & Limousine Commission; trip technology providers. [Reuse information](https://opendata.cityofnewyork.us/overview/#termsofuse). Data were transformed and aggregated for this study; see `data/source_manifest.json` for exact source files and hashes.
