Skip to main content

Businesses in search

#1088 adds a Businesses search type in place of Nonprofits. This page records what the owner decided on 2026-11-26, the tables, and the order of work.

Why Nonprofits shows 0 today​

search_organizations_pg (api/routes/search_postgres.py) reads mdm_organization joined to mdm_organization_nonprofit. Neither is published to Neon: about 4.2 million organizations, roughly 1.7 GB, are on the NON_SERVING list in packages/hosting/src/hosting/neon/sync_public_to_neon.py (what Neon serves, #284). On the hosted site the query fails, the error is swallowed, and the count shows 0.

Decisions​

DecisionChoiceWhy
Which businessesOnly those named in a meeting, a decision, a bill or a ballot measureResidents care about the businesses their government deals with; it keeps the served tables to a few MB of the 480 MB budget
Subtypesnonprofit, corporation, local_businessThe owner's three; government bodies and political committees aren't businesses and are left out
A company with many sites (for example a data-center operator)Listed under All locations, and under each city or state whose records name itA national company belongs to the national view; a city view shows only what that city's records say
The menuBusinesses replaces Nonprofits; nonprofit becomes a subtypeOne type, one count, no empty entry
ReleaseAfter bills and ballot measures feed it too, not only meetings and decisionsThe owner's choice: the type should cover all three kinds of record from the start

Tables​

Both are served on Neon (added to CIVIC_SERVING), with keys declared in schema.yml as CLAUDE.md requires.

business: one row per business.

ColumnMeaning
business_id (PK)master_org_id where the name matched the organization master, else the md5 of the normalized name plus state
business_namethe name as the records give it
business_type_codenonprofit, corporation or local_business (rules below)
master_org_idFK to mdm_organization, null when unmatched
state_code, state, citywhere the business is based, when known
is_all_locationstrue for a company listed under All locations
ein, website_urlwhen known
mention_count, first_mentioned_date, last_mentioned_dateover its mentions

business_mention: one row per business per record that names it.

ColumnMeaning
business_mention_id (PK)
business_idFK to business
source_kind_codemeeting, decision, bill or ballot_measure
source_record_id, source_urlthe record and its link
mention_datethe meeting date, decision date, bill action date or election date
state_code, jurisdiction_name, citythe place of the record, which decides where the business shows
quote_textthe verbatim text that names the business, which search shows as the match evidence

How a business is typed​

Rules, applied in order, with no model guessing:

  1. nonprofit: its EIN is in mdm_organization_nonprofit (IRS exempt organizations), or the extraction typed it as a nonprofit or a church.
  2. corporation: it is in the data-center, short-term-rental or topic company tables, or records from two or more states name it.
  3. local_business: any other business.

How a business is placed​

  • No place picked: every business.
  • A state or a city: the businesses with at least one mention in that place. A national company doesn't show in a city unless that city's records name it.
  • All locations: is_all_locations is true for every company in the data-center company table, and for a corporation named in two or more states. These companies are stored with no single city, as mdm_organization_data_center already does.

Where the mentions come from​

SourceTodayWork
MeetingsOrganizations the meeting analysis extracts (bronze_organizations_from_ai)#1089 builds the marts
Decisionsdecision_company_mention and the topic company mentions#1089
BillsNothing: bills has a title, subject and latest action, no text#1090 extracts names from bills that meetings reference and from current sessions in states with live cities
Ballot measuresNothing: Ballotpedia titles and summaries are loaded; bronze_ballot_measures_from_ai is an empty placeholder#1090 extracts names from the 2025–2026 measures

Extraction over the real bills and measures uses LLM calls, so it runs on the warehouse machine after the owner's yes (AGENTS.md, "GPU and paid compute").

Order of work​

  1. This page (#1088).
  2. #1089: business and business_mention from meetings and decisions, published, with their size from the publish dry run.
  3. #1090: bills and ballot measures feed business_mention.
  4. #1091: Businesses in the API and on the site, merged last.