Skip to main content

parkingstudy icon

parkingstudy

PyPI version Python versions pipeline status License: MIT DOI Downloads

Parking occupancy and turnover survey analysis for planners.

parkingstudy turns the spreadsheets of a classic parking study into the numbers a parking management plan needs:

  • Inventory: spaces by block face, zone, space type and facility, with time limits, restrictions, part-time windows (clearways, street cleaning) and hourly rates.
  • Occupancy counts by time beat: occupancy rate, peak occupancy, effective capacity at a target occupancy (85 % by default, configurable), practical capacity, accumulation curve and space-hours of demand and supply.
  • Licence-plate (beat / LPR) surveys: stays and durations, turnover, mean and median duration, overstay share against posted time limits, utilization.
  • Heatmap tables of occupancy by zone (or block face) x hour.
  • Demand-responsive pricing rules: the SFMTA occupancy-band policy and the SFpark pilot table, both as configurable policies.
  • GeoJSON join of any result table to block-face geometries for mapping.
  • Privacy by design: licence plates are replaced on input by a salted keyed hash (HMAC-SHA256). Raw plates are never stored in memory objects or written to outputs.

Standard library only, no required dependencies. Requires Python 3.9 or newer.

pip install parkingstudy

Quick start (command line)

Input files are plain CSV (column names are case-insensitive):

file required columns optional columns
inventory block_face_id, spaces zone, space_type, facility (on_street/off_street), time_limit_min, restriction, unavailable (07:00-09:00;16:00-18:00), hourly_rate
counts block_face_id, beat, occupied space_type, date
sightings block_face_id, beat, and plate_token or plate space_type, date

beat is a clock time (08:30) or an ISO date-time (2026-03-10T08:30).

# 1. Create a secret salt once per survey, keep it out of version control
parkingstudy salt > survey.salt
export PARKINGSTUDY_SALT=$(cat survey.salt)

# 2. Anonymise the field sheets: the plate column is replaced by a token column
parkingstudy hash-plates sightings_raw.csv -o sightings.csv

# 3. Supply summary, occupancy by beat and peak vs. 85 % effective capacity
parkingstudy inventory inventory.csv
parkingstudy occupancy inventory.csv counts.csv --by zone -o occupancy.csv
parkingstudy occupancy inventory.csv counts.csv --by zone --peak --target 0.85 \
    --factor on_street=0.85 --factor off_street=0.90
parkingstudy occupancy inventory.csv counts.csv --by zone --space-hours

# 4. Turnover, duration and overstay from the plate survey
parkingstudy turnover inventory.csv sightings.csv --by block_face --beat-minutes 30 \
    --stays stays.csv -o turnover.csv
parkingstudy turnover inventory.csv sightings.csv --durations      # duration classes

# 5. Heatmap (zone x hour) and pricing recommendations for the 09:00-12:00 rate period
parkingstudy heatmap inventory.csv counts.csv --by zone --bin-minutes 60 -o heatmap.csv
parkingstudy pricing inventory.csv counts.csv --from 09:00 --to 12:00 --policy sfmta

# 6. Map it: join any result CSV (key column) to block-face GeoJSON
parkingstudy geojson block_faces.geojson turnover.csv -o turnover_map.geojson

Every analysis command writes CSV (or --format json) to standard output or -o FILE. turnover also accepts raw plates directly if a salt is supplied (--salt-env VAR or --salt-file FILE); without one it refuses to read them.

Quick start (Python)

from parkingstudy import (
    PlateHasher, read_inventory, read_counts, read_sightings,
    capacity_assessment, build_stays, turnover_summary, utilization_heatmap,
)

inv = read_inventory("inventory.csv")
counts = read_counts("counts.csv")

for row in capacity_assessment(inv, counts, by="zone", target=0.85):
    print(row.key, row.peak_occupied, row.spaces, row.effective_capacity, row.above_target)

hasher = PlateHasher.from_env()            # salt from $PARKINGSTUDY_SALT
sightings = read_sightings("sightings_raw.csv", hasher)   # plates hashed while reading
stays = build_stays(sightings, beat_minutes=30, inventory=inv)
for r in turnover_summary(stays, inv, by="block_face"):
    print(r.key, r.turnover, r.mean_duration_min, r.overstay_share)

print(utilization_heatmap(inv, counts, by="zone").to_csv())

See examples/quickstart.py for a complete synthetic survey.

API overview

area objects
inventory InventoryRecord, Inventory (capacity, time_limit, hourly_rate, summary)
occupancy Count, occupancy_by_beat, peak_occupancy, effective_capacity, practical_capacity, capacity_assessment, accumulation_curve, space_hours, infer_beat_minutes
plate survey Sighting, build_stays, Stay, turnover_summary, TurnoverRow, accumulation_from_stays, duration_distribution
heatmap utilization_heatmap, HeatmapTable (get, max_cell, to_rows, to_csv)
pricing PricingPolicy, PriceBand, SFMTA_POLICY, SFPARK_PILOT_POLICY, recommend_rate, recommend_rates, mean_occupancy
GeoJSON join_to_geojson, rows_by_key, load_geojson, write_geojson
privacy PlateHasher, generate_salt, normalize_plate, anonymise_rows, anonymise_csv
I/O read_inventory, read_counts, read_sightings, write_rows, records_to_rows

Aggregation everywhere uses by="block_face" | "zone" | "total".

Method and sources

Occupancy. Occupancy rate at a beat = vehicles / legal spaces available at that beat. Spaces inside an unavailable window count as zero supply; vehicles parked there are still counted, so rates above 100 % (illegal parking) are kept and flagged (over_capacity). Zone and total rates sum vehicles and spaces of the block faces counted at that beat.

Effective capacity = spaces x target occupancy. The 85 % default is the "85 percent rule" for kerb parking advocated by D. Shoup, The High Cost of Free Parking (APA Planners Press, 2005): above roughly 85 % occupancy drivers start cruising for a space. Practical capacity (also "effective supply") multiplies spaces by an efficiency factor per facility type. The defaults (0.85 on-street, 0.90 off-street) are common planning rules of thumb rather than values from a standard; pass your own factors= / --factor.

Licence-plate beat survey. A vehicle seen on consecutive beats at the same block face (or zone, level="zone") is one stay. With beat length b, first and last sightings t1 and tn: minimum duration = tn - t1; estimated duration = tn - t1 + b (each sighting stands for one beat, the usual beat-survey convention). The true duration lies between tn - t1 and tn - t1 + 2b. Stays on the first or last beat of a survey session are flagged as censored. max_gap_beats tolerates missed reads. Turnover = vehicles / spaces over the survey period (and per hour). Space-hours of demand = sum of estimated durations; utilization = space-hours / (spaces x survey hours). Overstay compares a stay with the posted limit of its block face: the default basis="minimum" counts only stays certainly longer than the limit (enforcement-grade, conservative); basis="estimate" uses the estimated duration.

Pricing. SFMTA_POLICY follows SFMTA, Demand-responsive parking pricing policies: on-street parking meters and off-street lots (5 December 2017): occupancy 80 % or above raises the hourly rate by 0.25, 60 % to below 80 % leaves it unchanged, below 60 % lowers it by 0.25, within 0.50 to 8.00 per hour. SFPARK_PILOT_POLICY is the four-band table reported for the 2011-2013 SFpark pilot (80-100 % +0.25, 60-80 % hold, 30-60 % -0.25, below 30 % -0.50, cap 6.00). Both are configurable examples: build a PricingPolicy with your own bands, steps, currency, floor, cap and rounding.

Plate anonymisation. Plates are normalised (Unicode NFKC, upper case, letters and digits only) and replaced by HMAC-SHA256 (RFC 2104) keyed with a secret salt of at least 16 bytes, truncated to 16 hex characters by default. Unlike an unsalted hash, tokens cannot be reversed by enumerating the small space of valid plates without the salt. Use a fresh salt per survey and destroy it afterwards. Licence plates are personal data under, for example, the EU GDPR and the Turkish KVKK (Law No. 6698); check the rules that apply to your survey.

Limitations

  • Beat surveys cannot see stays shorter than one beat that fall between two passes, so turnover is underestimated and mean duration overestimated, more so with long beats.
  • Zone-level stays take the time limit of the first block face where the vehicle was seen.
  • A block face with several different time limits (for different space types) is not assessed for overstay unless sightings carry a space_type.
  • No time zones; beats are naive local times. Bare clock times are treated as one day.
  • Practical-capacity factors and the SFpark pilot table are planning conventions and secondary-source values; verify them for your context.

Development

pip install -e ".[dev]"
python -m pytest
python -m ruff check . && python -m ruff format --check src tests
python -m mypy src
  • aadtkit: traffic count processing and AADT estimation following the FHWA Traffic Monitoring Guide.
  • streetlos: multimodal street level-of-service screening for walking and cycling.
  • tr-imar: Turkish zoning calculations, including parking requirements under the Otopark Yönetmeliği.

License

MIT License, see LICENSE.

Academic citation

If you use parkingstudy in research, please cite:

@software{eminoglu_parkingstudy,
  author  = {Eminoğlu, Yusuf},
  title   = {parkingstudy},
  year    = {2026},
  version = {0.1.2},
  doi     = {10.5281/zenodo.24235602},
  url     = {https://gitlab.com/geophilo1/parkingstudy_sdk}
}

Metadata

Release files for parkingstudy 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for parkingstudy 0.1.2
File Size Uploaded Provenance Actions
parkingstudy-0.1.2.tar.gz 49.9 kB Without provenance Details for parkingstudy-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for parkingstudy 0.1.2
File Interpreter ABI Platform Actions
parkingstudy-0.1.2-py3-none-any.whl Python 3 none any Details for parkingstudy-0.1.2-py3-none-any.whl

Total release size: 89.6 kB

Release files / parkingstudy-0.1.2.tar.gz

Download URL parkingstudy-0.1.2.tar.gz
Size 49.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d30facc737618180ce6e1dfacfbd7dae04335d02bfab26ff4ba62d5503781dc5
BLAKE2b-256 checksum
How to use checksums
ee5efd907479d20fba8ce221f2d70ec60bafb3034a9a3c8511426ccabc7597d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / parkingstudy-0.1.2-py3-none-any.whl

Download URL parkingstudy-0.1.2-py3-none-any.whl
Size 39.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83ffe1845fbd2fc7680756dd41ae3e3b24ed7024922a9a538f80b14b3bbb1470
BLAKE2b-256 checksum
How to use checksums
fc4d0c866b6cf12d42e548ddbae3192fb586478483bca44d0993398a8441c79d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

Security for parkingstudy 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page