Skip to content

Latest commit

 

History

History
158 lines (105 loc) · 9.81 KB

README.md

File metadata and controls

158 lines (105 loc) · 9.81 KB

Metrics

Overview

Pre-aggregated permit counts and valuation from a nightly rollup. Use these instead of paging through search results to count them: they answer 'how many' and 'is it trending' in one millisecond-scale call. Developer plan and above.

Available Operations

metrics_monthly

Monthly permit counts and total valuation for a city/state/category.

Available on the Developer plan and above (see /v1/billing/plans for current pricing).

Served from a nightly rollup, so it answers in milliseconds where the equivalent search-and-count takes seconds. At least one of state or city is required: an unfiltered national series would be a different (and much larger) product.

Example Usage

import os
from permitstack import Permitstack


with Permitstack(
    api_key=os.getenv("PERMITSTACK_API_KEY", ""),
) as p_client:

    res = p_client.metrics.metrics_monthly(months=24)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
state OptionalNullable[str] ➖ Two-letter state code, e.g. FL
city OptionalNullable[str] ➖ City name; case-insensitive
category OptionalNullable[str] ➖ Permit category, e.g. ROOFING
months Optional[int] ➖ How many trailing months to return
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error Type Status Code Content Type
errors.FeatureLockedError 403 application/json
errors.HTTPValidationError 422 application/json
errors.ErrorDetail 401, 429 application/json
errors.PermitstackDefaultError 4XX, 5XX */*

metrics_current

Category breakdown over a trailing window — the 'what is happening here now' view.

Available on the Developer plan and above (see /v1/billing/plans for current pricing).

Example Usage

import os
from permitstack import Permitstack


with Permitstack(
    api_key=os.getenv("PERMITSTACK_API_KEY", ""),
) as p_client:

    res = p_client.metrics.metrics_current(days=90)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
state OptionalNullable[str] ➖ N/A
city OptionalNullable[str] ➖ N/A
days Optional[int] ➖ Trailing window. Rounded to whole months by the rollup.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error Type Status Code Content Type
errors.FeatureLockedError 403 application/json
errors.HTTPValidationError 422 application/json
errors.ErrorDetail 401, 429 application/json
errors.PermitstackDefaultError 4XX, 5XX */*

metrics_cities

Busiest cities in a state — the ranking customers were building by hand.

Available on the Developer plan and above (see /v1/billing/plans for current pricing).

Example Usage

import os
from permitstack import Permitstack


with Permitstack(
    api_key=os.getenv("PERMITSTACK_API_KEY", ""),
) as p_client:

    res = p_client.metrics.metrics_cities(state="Virginia", months=12, limit=50)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
state str ✔️ N/A
category OptionalNullable[str] ➖ N/A
months Optional[int] ➖ N/A
limit Optional[int] ➖ N/A
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

Any

Errors

Error Type Status Code Content Type
errors.FeatureLockedError 403 application/json
errors.HTTPValidationError 422 application/json
errors.ErrorDetail 401, 429 application/json
errors.PermitstackDefaultError 4XX, 5XX */*