Metrics catalog

Every measure, expanded.

Auto-generated from the Airlayer view YAML. One card per measure, with its description, type, filters, and the SQL it expands to. Single source of truth for what each metric means.

29 measures across 14 views.
citations ·

citation_count

count

Total count of citation rows (citation, violation grain). Multi-violation tickets count as multiple rows.

Expanded SQL
SELECT COUNT(*) AS citation_count
FROM main_gold.fct_citations
citations ·

count_by_day_shift

count

Citations issued during the day shift (8AM-4PM).

Expanded SQL
SELECT COUNT(*) AS count_by_day_shift
FROM main_gold.fct_citations
citations ·

count_by_night_shift

count

Citations issued during night shifts (4PM-midnight + midnight-8AM).

Expanded SQL
SELECT COUNT(*) AS count_by_night_shift
FROM main_gold.fct_citations
citations ·

average_vehicle_speed_on_speed_violations

average

Average vehicle_mph across rows in the Speeding charge category. Excludes rows with NULL vehicle_mph (82.5% of total) -- those aren't speed-related.

Expanded SQL
SELECT AVG(case when charge_category like 'Speeding%' then vehicle_mph end) AS average_vehicle_speed_on_speed_violations
FROM main_gold.fct_citations
citations ·

count_distinct_violation_types

count_distinct

Number of distinct charge_category values observed.

Expanded SQL
SELECT COUNT(DISTINCT charge_category) AS count_distinct_violation_types
FROM main_gold.fct_citations
crime ·

total_incidents

count

Total count of crime incidents.

Expanded SQL
SELECT COUNT(*) AS total_incidents
FROM main_gold.fct_crime_incidents
crime ·

incidents_with_ward

count

Crime incidents with a known Somerville ward (excludes the ~13% NULL-ward and 2 CAM rows).

Expanded SQL
SELECT COUNT(*) AS incidents_with_ward
FROM main_gold.fct_crime_incidents
crime ·

incidents_with_date

count

Crime incidents with a known incident date (excludes the ~12.5% sensitive incidents).

Expanded SQL
SELECT COUNT(*) AS incidents_with_date
FROM main_gold.fct_crime_incidents
happiness_survey ·

total_respondents

sum

Total respondents across the queried grain. Note: at the city+wave+question grain this is the wave's respondent count for the question; at the city+wave grain (no question filter) it sums across questions and over-counts respondents.

Expanded SQL
SELECT SUM(respondent_count) AS total_respondents
FROM main_gold.fct_happiness_survey
happiness_survey ·

mean_score_overall

average

Mean-of-means at the grain. Mathematically correct for trend-tracking when grouped by wave / geography / question, but NOT a respondent-level grand mean -- the per-respondent average score would require querying silver. Document this in trust-contract receipts when the analyst asks for a 'true average'.

Expanded SQL
SELECT AVG(mean_score) AS mean_score_overall
FROM main_gold.fct_happiness_survey
happiness_survey ·

pct_top_two_box

custom

Standard survey 'top-two-box' -- share of respondents who rated 4 or 5 on the Likert scale, across the queried grain. Returns 0-1 (multiply by 100 for percent display).

Expanded SQL
SELECT CUSTOM(*) AS pct_top_two_box
FROM main_gold.fct_happiness_survey
happiness_survey ·

pct_bottom_two_box

custom

Standard survey 'bottom-two-box' -- share of respondents who rated 1 or 2. Returns 0-1.

Expanded SQL
SELECT CUSTOM(*) AS pct_bottom_two_box
FROM main_gold.fct_happiness_survey
offense_categories ·

category_count

count

Total categories (always 4).

Expanded SQL
SELECT COUNT(*) AS category_count
FROM main_gold.dim_offense_category
offense_codes ·

code_count

count

Total distinct offense codes (always 39 today).

Expanded SQL
SELECT COUNT(*) AS code_count
FROM main_gold.dim_offense_code
permits ·

permit_count

count

Total count of permit applications (all statuses).

Expanded SQL
SELECT COUNT(*) AS permit_count
FROM main_gold.fct_permits
permits ·

issued_permit_count

count

Count of permits actually issued (permit_status = 'Issued', 96.68% of rows).

Expanded SQL
SELECT COUNT(*) AS issued_permit_count
FROM main_gold.fct_permits
permits ·

total_issued_permit_value

sum

Sum of permit_amount across issued permits, in USD.

Expanded SQL
SELECT SUM(case when is_issued then permit_amount end) AS total_issued_permit_value
FROM main_gold.fct_permits
permits ·

avg_issued_permit_value

average

Average permit_amount across issued permits, in USD.

Expanded SQL
SELECT AVG(case when is_issued then permit_amount end) AS avg_issued_permit_value
FROM main_gold.fct_permits
permits ·

distinct_address_count

count_distinct

Number of distinct property addresses with at least one permit.

Expanded SQL
SELECT COUNT(DISTINCT address) AS distinct_address_count
FROM main_gold.fct_permits
requests ·

total_requests

count

Total 311 requests

Expanded SQL
SELECT COUNT(*) AS total_requests
FROM main_gold.fct_311_requests
requests ·

open_requests

count

Requests not yet closed (status != 'Closed')

Filters
Expanded SQL
SELECT COUNT(*) AS open_requests
FROM main_gold.fct_311_requests
WHERE status != 'Closed'
somerville_kpis ·

kpi_observation_count

count

Total (topic, year, value) observations.

Expanded SQL
SELECT COUNT(*) AS kpi_observation_count
FROM main_gold.fct_somerville_kpi
somerville_kpis ·

kpi_topic_count

count_distinct

Distinct KPI topics tracked.

Expanded SQL
SELECT COUNT(DISTINCT topic) AS kpi_topic_count
FROM main_gold.fct_somerville_kpi
somerville_kpis ·

years_of_coverage

count_distinct

Distinct years observed across all topics.

Expanded SQL
SELECT COUNT(DISTINCT year) AS years_of_coverage
FROM main_gold.fct_somerville_kpi
somerville_kpis ·

latest_value_for_topic

max

Maximum `value` across the topic. For time-series topics with one observation per year (Population, Median Household Income, etc.), MAX surfaces the most recent observation when filtered to that topic. For categorical topics with multiple values per year, prefer querying the fact directly.

Expanded SQL
SELECT MAX(value) AS latest_value_for_topic
FROM main_gold.fct_somerville_kpi
survey_questions ·

question_count

count

Total surviving questions (always 8 today).

Expanded SQL
SELECT COUNT(*) AS question_count
FROM main_gold.dim_survey_question
survey_waves ·

wave_count

count

Total waves in the survey (always 8 today).

Expanded SQL
SELECT COUNT(*) AS wave_count
FROM main_gold.dim_survey_wave
survey_waves ·

total_respondents_all_waves

sum

Sum of respondent_count across waves (12,583 today).

Expanded SQL
SELECT SUM(respondent_count) AS total_respondents_all_waves
FROM main_gold.dim_survey_wave
wards ·

ward_count

count

Total wards (always 7)

Expanded SQL
SELECT COUNT(*) AS ward_count
FROM main_gold.dim_ward