{
 "title": "qipu data: San Francisco, v0.7.1",
 "description_html": "An open, sourced record of what happened at every place in San Francisco. Every line points to the page it came from, mostly scans held by the Internet Archive. <b>Claims are CC0</b>; the sources keep their own rights; quotes are short. Built from qipu's map data on 14/10/2026. Read the <a href='https://data.qipu.org/README.html'>README</a> and <a href='https://data.qipu.org/DATA_DICTIONARY.html'>data dictionary</a>.",
 "license": "CC0 1.0 (claims); sources keep their own rights",
 "license_url": "https://creativecommons.org/publicdomain/zero/1.0/",
 "source": "Internet Archive scans (SF Public Library, IGS / Democracy's Library), DataSF, and others listed in `sources`",
 "source_url": "https://archive.org/",
 "databases": {
  "qipu_sf": {
   "queries": {
    "records_at_address": {
     "title": "a) Every record about an address",
     "description": "Everything qipu holds about one door: the Board's decisions on its address, parcel or block, the building's dates, old maps, photos and stories. Each line links to its source; Board lines open the scanned page on archive.org. Try 680 HAIGHT ST or 1805 GEARY BLVD.",
     "sql": "WITH a AS (SELECT * FROM places WHERE name = upper(trim(:address)) AND kind = 'address'),\nids AS (SELECT place_id AS pid, 'address' AS matched_at FROM a\n        UNION SELECT parent_id, 'parcel' FROM a WHERE parent_id IS NOT NULL\n        UNION SELECT 'qipu:sf/place/block/' || block, 'block ' || block FROM a WHERE block IS NOT NULL)\nSELECT r.\"when\", r.kind, r.what, r.outcome, ids.matched_at, r.precision, r.link, r.source, r.record_id\nFROM ids JOIN place_records r ON r.place_id = ids.pid\nORDER BY r.\"when\" IS NULL, r.\"when\" "
    },
    "supervisor_votes": {
     "title": "b) A supervisor's voting record",
     "description": "Every printed roll call in the Journal of Proceedings where this supervisor voted, with what was decided and a link to the page. Set \"only\" to no to see just the votes against. Names as printed (\"Feinstein\") are matched to one person across years using the official roster (Wikipedia list, Wikidata ids).",
     "sql": "SELECT v.date, v.year, CASE v.vote WHEN 'aye' THEN 'yes' ELSE v.vote END AS vote, v.result, v.tally, v.what, v.instrument_id, v.page, v.name_printed\nFROM persons p JOIN votes v ON v.person_id = p.person_id AND v.year BETWEEN CAST(:from_year AS INTEGER) AND CAST(:to_year AS INTEGER)\nWHERE p.display_name LIKE '%' || :name || '%'\n  AND (:only = 'all' OR CASE v.vote WHEN 'aye' THEN 'yes' ELSE v.vote END = :only)"
    },
    "supervisor_summary": {
     "title": "b2) Every supervisor: votes on record (yes / no / absent)",
     "sql": "SELECT display_name, first_year, last_year, votes_on_record, yes, no, absent, pct_no, wikidata_url FROM supervisor_totals ORDER BY first_year, display_name"
    },
    "zoning_on_street": {
     "title": "c) Every zoning change on a street, over time",
     "description": "Board decisions about zoning (the use classification of property) that name this street, oldest first, each with its scan. Try DIVISADERO ST or MISSION ST (the street with the most).",
     "sql": "SELECT year, date, outcome, plain, place_text, instrument_id, scan_url FROM street_zoning\nWHERE street = upper(trim(:street)) OR street LIKE upper(trim(:street)) || ' (%' ORDER BY year, date"
    },
    "zoning_streets_ranked": {
     "title": "c2) Streets ranked by the number of zoning decisions",
     "sql": "SELECT street, count(*) AS zoning_decisions, min(year) AS first, max(year) AS last FROM street_zoning GROUP BY street ORDER BY zoning_decisions DESC LIMIT 40"
    },
    "refused_by_decade": {
     "title": "d) What the city refused, by decade",
     "description": "Board decisions whose outcome is refused, rejected or vetoed, counted by decade, and how many name a place.",
     "sql": "SELECT decade, count(*) AS refused_rejected_vetoed, sum(outcome = 'refused') AS refused, sum(outcome = 'rejected') AS rejected,\n       sum(outcome = 'vetoed') AS vetoed, sum(place IS NOT NULL) AS with_a_place FROM refused GROUP BY decade ORDER BY decade"
    },
    "refused_list": {
     "title": "d2) What the city refused in one decade, with places",
     "sql": "SELECT year, date, outcome, topic, plain, place, neighbourhood, scan_url FROM refused WHERE decade = CAST(:decade AS INTEGER) ORDER BY year, date"
    },
    "archive_items_for_neighbourhood": {
     "title": "e) Archive items linked to a neighbourhood (Democracy's Library first)",
     "description": "Internet Archive items qipu has linked to places in this neighbourhood, and whether each sits in Democracy's Library (by collection membership). The Western Addition appraisals join this list when that extraction lands.",
     "sql": "SELECT in_DL, title, year, kind, collection, place, excerpt, link FROM hood_archive_items WHERE hood = :hood ORDER BY in_DL DESC, year"
    },
    "dl_items_cited": {
     "title": "e2) Every Democracy's Library item qipu cites",
     "sql": "SELECT source_id, title, year_from, kind, collection, dl_rule, n_claims, url FROM sources WHERE in_democracys_library = 1 ORDER BY year_from"
    },
    "click_anywhere": {
     "title": "Click anywhere: every place containing or touching a point, and what the Archive holds about each",
     "description": "From a point: its assessor block, the neighbourhood, and every feature around it (creek, watershed, Superfund site, freeway, landfill, redevelopment area), each with its records, most specific first.",
     "sql": "WITH b AS (SELECT block, hood_id FROM block_points\n            ORDER BY (lat - CAST(:lat AS REAL)) * (lat - CAST(:lat AS REAL)) + 0.62 * (lon - CAST(:lon AS REAL)) * (lon - CAST(:lon AS REAL)) LIMIT 1),\npl AS (SELECT 'qipu:sf/place/block/' || block AS pid, 1 AS rnk, 'the block under the point' AS why FROM b\n       UNION SELECT r.to_id, CASE WHEN p.kind = 'neighbourhood' THEN 4 WHEN coalesce(p.radius_m, 0) <= 1000 THEN 2 ELSE 5 END,\n              'the block is ' || r.relation || ' ' || p.name FROM b JOIN place_relations r ON r.from_id = 'qipu:sf/place/block/' || b.block\n              JOIN places p ON p.place_id = r.to_id\n              WHERE CAST(:year AS INTEGER) = 0 OR ((p.valid_from IS NULL OR substr(p.valid_from, 1, 4) <= :year) AND (p.valid_to IS NULL OR substr(p.valid_to, 1, 4) >= :year)))\nSELECT pl.rnk AS specificity, pl.why AS place, r.\"when\", r.kind, r.what, r.outcome, r.link, r.source\nFROM pl JOIN place_records r ON r.place_id = pl.pid\nORDER BY pl.rnk, r.\"when\" DESC LIMIT 600"
    },
    "showcase": {
     "title": "A showcase place: everything the Archive holds, across collections",
     "sql": "SELECT tier, year, kind, title, variants, collection, link, rights_note, linked_via, confidence FROM showcase_items WHERE showcase = :place ORDER BY tier, year IS NULL, year, kind"
    },
    "appraisals_on_block": {
     "title": "Redevelopment appraisals on a block (Western Addition A-2, 1960s)",
     "description": "The San Francisco Redevelopment Agency's property files: what each parcel was, what it rented for and what the Agency valued it at, before the clearance. Each row opens the scanned page.",
     "sql": "SELECT year, address_printed, lot_printed, building, units, rent_example, rent_total, appraised_value, assessed_total, sale_price, present_use, url FROM x_appraisals WHERE block = :block ORDER BY lot_printed, year"
    },
    "media_registry": {
     "title": "Every photo, film and recording the map shows, with its rights",
     "sql": "SELECT kind, title, year, credit, licence, rights_note, url, used_in FROM media WHERE holder = :holder OR :holder = 'all' ORDER BY year"
    },
    "v2_votes_by_name": {
     "title": "Decisions v2: each vote with the names as printed (SF and Vancouver)",
     "sql": "SELECT year, kind, number, outcome, ayes_n || '-' || coalesce(noes_n, 0) AS tally, noes, plain, page_id FROM decisions_v2 WHERE city = :city AND year = CAST(:year AS INTEGER) AND noes_n > 0 ORDER BY page_id"
    },
    "instrument_votes": {
     "title": "How each supervisor voted on one ordinance or resolution",
     "sql": "SELECT r.date, r.outcome AS result, p.display_name AS supervisor, CASE v.vote WHEN 'aye' THEN 'yes' ELSE v.vote END AS vote, d.plain, r.scan_url\nFROM decisions d JOIN roll_calls r ON r.decision_id = d.decision_id JOIN votes v ON v.rollcall_id = r.rollcall_id JOIN persons p ON p.person_id = v.person_id\nWHERE d.instrument_id = :instrument ORDER BY r.date, v.vote, p.display_name"
    }
   },
   "tables": {
    "claims": {
     "description": "One statement per row: subject, property, value or object, time, place, the page it came from (page_id, link), the run that read it, confidence and status. Votes are in vote_claims."
    },
    "decisions": {
     "description": "One row per thing the Board of Supervisors did (an item in the Journal), with its plain line, outcome and scan."
    },
    "votes": {
     "description": "One row per supervisor per printed roll call (Ayes / Noes / Absent)."
    },
    "roll_calls": {
     "description": "Printed roll calls found in the Journal text, with printed and parsed counts."
    },
    "sources": {
     "description": "Every source cited; archive.org items with collection and Democracy's Library membership."
    },
    "pages": {
     "description": "page_id = identifier:leaf, with the archive.org page link and the IIIF image."
    },
    "places": {
     "description": "Today's places with stable qipu ids: addresses (DataSF EAS), parcels, blocks, streets, neighbourhoods, landmarks."
    }
   }
  }
 }
}