# Data sources

## City of Chicago ride-hail trips (Transportation Network Providers)

- **What:** every trip reported to the City of Chicago by the licensed ride-hail operators (Transportation Network
  Providers), published on the Chicago Data Portal in three datasets split by trip start year:

  | Dataset id | Trips it holds | Address |
  |---|---|---|
  | `m6dm-c72p` | November 2018 to December 2022 | https://data.cityofchicago.org/d/m6dm-c72p |
  | `n26f-ihde` | 2023 and 2024 | https://data.cityofchicago.org/d/n26f-ihde |
  | `6dvr-xwnh` | 2025 on | https://data.cityofchicago.org/d/6dvr-xwnh |

- **Publisher:** City of Chicago (attribution as given on each dataset page).
- **Terms:** the portal marks the data "See Terms of Use", which are the City of Chicago Data Terms of Use:
  https://www.chicago.gov/city/en/narr/foia/data_disclaimer.html. These are purpose-limited, revocable data-use terms,
  not an unrestricted open-data licence. The data is provided as is; this study is not affiliated with or endorsed by
  the City or any operator.
- **Privacy rounding (from the datasets' descriptions):** fares are rounded to the nearest $2.50 and tips to the nearest
  $1.00; cash tips are not recorded. Additional charges are "the taxes, fees, and any other charges for the trip".
  `shared_trip_authorized` is whether the rider agreed to a shared trip, matched or not; `trips_pooled` is how many
  trips were pooled together.

## What was retrieved

Monthly aggregates only, through the portal's own SoQL API (`https://data.cityofchicago.org/resource/<id>.json`). No
trip-level rows were downloaded. The query, run once per month (or half month, or run of months, when the portal
timed out on a larger window), with `{start}` and `{end}` the window's bounds:

```
SELECT date_trunc_ym(trip_start_timestamp) AS m, shared_trip_authorized AS shared, trips_pooled AS pooled,
  count(*) AS n_trips, count(fare) AS n_fare, sum(fare) AS s_fare, count(tip) AS n_tip, sum(tip) AS s_tip,
  count(additional_charges) AS n_addl, sum(additional_charges) AS s_addl, sum(trip_total) AS s_total,
  count(trip_miles) AS n_miles, sum(trip_miles) AS s_miles, sum(trip_seconds) AS s_seconds
WHERE trip_start_timestamp >= '{start}' AND trip_start_timestamp < '{end}'
GROUP BY m, shared, pooled ORDER BY m, shared, pooled LIMIT 1000
```

- `revfc/fetch.py` sends it and saves each response only after it parses as a non-empty JSON list.
- `revfc/clean.py` sums the responses into `data/monthly.csv` (one row per month and segment) and refuses the table
  unless every month from November 2018 to August 2026 appears exactly once.
- The next month returned no rows at retrieval: the portal had not published it yet.

## Fingerprints (retrieval hash)

- `data/raw/`: 90 response files, each listed with its sha256 in `data/raw-manifest.json`.
- `data/raw-manifest.json` sha256: `f4a9503a2b724c47db87b07d3755b5bca8327dd20b870740e4af4bb8f36ed9e3`
- `data/monthly.csv` sha256: `860c48e8830525bbd398f766e73346a0d54858a992e46d4d5ab10fa87f5d4120`

The aggregates come with the download, so the study replays offline. Re-fetching can give slightly different sums
if the City revises records.

## City of Chicago ride-hail drivers (Transportation Network Providers drivers dataset)

- **What:** every driver the licensed ride-hail operators report to the City of Chicago, one row per driver per month
  in which the driver was eligible to give trips in Chicago for at least one day, whether or not the driver gave any.
  Dataset id `j6wf-834c`, https://data.cityofchicago.org/d/j6wf-834c.
- **Columns:** `month_reported`, `driver_start_month` (the month the driver was reported to have started; the earliest
  when operators differ), `city`, `state`, `zip`, `number_of_trips` (that month; values over 999 are blanked as
  suspected errors), `multiple_tnps` (reported by more than one operator that month), `birth_year`, `age`,
  `employment_classification`. There is no driver id.
- **Publisher and terms:** City of Chicago, with the same "See Terms of Use" marking and the same City of Chicago Data
  Terms of Use as the trips data above. The city notes that matching drivers across operators, and between its
  licensing and reporting records, is imperfect, and that after a correction its trip counts are close to, but not
  exactly, the trips datasets'.
- **Retrieved:** counts only, through the portal's SoQL API, grouped by month reported and start month, November 2018 to
  August 2026 (`revfc/fetch_drivers.py`):

```
SELECT month_reported, driver_start_month, count(*) AS listed,
  sum(case(number_of_trips > 0, 1, true, 0)) AS active_known, count(number_of_trips) AS trips_known,
  sum(number_of_trips) AS trips
WHERE month_reported >= '{first}' AND month_reported <= '{last}'
GROUP BY month_reported, driver_start_month ORDER BY month_reported, driver_start_month LIMIT 50000
```

- **Not published:** the responses themselves, because some start months hold only a few drivers. Their
  sha256 values and the query are in `data/drivers-manifest.json`.
- **Published:** `data/drivers-cohorts.csv`, drivers listed and active (at least one trip, or a blanked count) by month
  and months since start (0 to 35, then one row for 36 or more, which also takes drivers whose start month is missing
  or later than the month reported), and `data/drivers-monthly.csv`, the month's totals and the trips the drivers data
  reports. Any listed or active count from 1 to 9 is merged into the month's last row, so monthly totals are unchanged
  and no published listed or active count lies between 1 and 9. Three merged age rows therefore show 0 in
  `data/drivers-cohorts.csv`: January, February and March 2023 at ages 33, 34 and 35 (the April 2020 cohort); their
  drivers are in those months' 36-or-more rows. Differences between published counts, such as listed minus active in
  one row, can be smaller than 10. The monthly totals match a separate whole-month count from the portal in every month.
- **Known reporting artifact:** from June to September 2023 a block of drivers carries a May 2023 start month, then
  moves back. Active totals are unaffected; cohort rows in those months are.

## What "revenue" means here

Fares plus additional charges, summed over every operator: what riders paid before tips. Tips are reported separately.
It is the gross bookings a marketplace would forecast, not any operator's revenue: operators keep only part of it, and
the charges include taxes and fees that go to the city and others.

## Synthetic data (sales capacity part)

`sales-capacity.html` uses no outside data. Its made-up company, every rate and every simulated year are generated by
`revfc/capacity.py` from the assumptions in `protocol-capacity.json`, with a fixed seed. Nothing in that part is measured
from a real company.

## Synthetic data (patient-flow part)

`patient-flow.html` uses no outside data. Its made-up therapy, patients, channel and noisy worlds are generated by
`revfc/patientflow.py` from the assumptions in `protocol-patientflow.json`, with a fixed seed. Nothing in that part is
measured from a real product.
