- firmenbuch.search: register number for companies linked to people/parties, only for one current register entry with the same name - firmenbuch.extracts: current extracts; officers/shareholders who are politicians in the database (exact birth date + name, new person hint birth_date) become company_role claims; nobody else is stored, raw responses are not archived, addresses never read; the register's daily change list triggers re-extracts - enrich.firmenbuch closes roles a newer extract no longer lists - Request.data (raw body, part of the fingerprint); SOAP faults are not retried - firmenbuch_number drops leading zeros; migration 0009 adds company_role and aligns stored numbers; internal politrack_org ids are no longer stored as identifiers - company_role in API types, MCP docs, person money tab, connections, labels Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
1.5 KiB
SQL
18 lines
1.5 KiB
SQL
-- Company register (Firmenbuch HVD): functions of politicians in companies (managing director, authorised
|
|
-- signatory, board member, shareholder ...), as their own claim type so that they never count as political office.
|
|
ALTER TABLE claim DROP CONSTRAINT claim_claim_type_check;
|
|
ALTER TABLE claim ADD CONSTRAINT claim_claim_type_check CHECK (claim_type IN (
|
|
'role', 'vote', 'donation', 'money_flow', 'statement', 'appearance', 'meeting', 'travel',
|
|
'side_job', 'legal_proceeding', 'lobbying', 'media_mention', 'career',
|
|
'parliamentary_question', 'government_decision', 'wiki_edit', 'declaration', 'ownership',
|
|
'affiliation', 'party_finance', 'election_result', 'company_role', 'other'));
|
|
COMMENT ON COLUMN claim.claim_type IS 'Kind of fact. election_result: a party''s result in a region (counterpart = the elected body) or a candidate''s preference votes (person, counterpart = party). company_role: a person''s function in a company according to the Firmenbuch (counterpart = the company; data.function, data.fn).';
|
|
|
|
-- Firmenbuch numbers are now stored without leading zeros ('068616g' -> '68616g'), as text.firmenbuch_number does.
|
|
DELETE FROM identifier a
|
|
WHERE a.scheme = 'firmenbuch' AND a.value ~ '^0'
|
|
AND EXISTS (SELECT 1 FROM identifier b WHERE b.entity_type = a.entity_type AND b.scheme = 'firmenbuch'
|
|
AND b.value = regexp_replace(a.value, '^0+', ''));
|
|
UPDATE identifier SET value = regexp_replace(value, '^0+', '')
|
|
WHERE scheme = 'firmenbuch' AND value ~ '^0';
|